Click to See Complete Forum and Search --> : Program written in beta 2 version of Framework 2.0... Help!!!


Toltec7
January 19th, 2007, 05:23 AM
I downloaded the DataStructures20.msi file from MSDN pages ( http://msdn2.microsoft.com/en-us/library/ms379574(VS.80).aspx ) which has some OK examples of data structure (I`m interested only in graph alorithm though) use in C# 2.0 and I`m getting the

"Error 1 The type or namespace name 'Collection' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Dani\My Documents\MSDN\DataStructures20\skmDataStructures2\NodeList.cs 15 32 skmDataStructures2"
"Warning 2 Reference to type 'System.Collections.Generic.Collection`1' claims it is defined in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll', but it could not be found c:\Documents and Settings\Dani\My Documents\MSDN\DataStructures20\skmDataStructures2\bin\Release\skmDataStructures2.dll GraphTester"

and a few similar errors when building it.

I have C# 2005 Express and .NET framework 2.0 that comes bundled with it through the internet installation.
I`ve found out by contacting the author that the code was written using beta 2 version of Framework 2.0 and hence the errors.

He could not help me though, but I hope you can. :)
Is there a possibility of conversion? Some code changes?
What are your experiences with similar issues. Is it doable?

torrud
January 19th, 2007, 06:41 AM
If you have to sourcecode of the related library you should open it within the Visual Studio. Then remove the references and add the references again. Finally recompile the project and it should work.
After that you remove the library reference inside of your application and add the reference again for the new compiled one.

waltergr
July 12th, 2007, 08:20 AM
I figured it out! :)

See http://graemef.com/blog/graeme/vs2005_november_ctp_standard_edition_initial_observations and http://www.itu.dk/people/sestoft/csharpprecisely/errata.html and http://www.google.com/search?num=30&hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=klc&q=EnableRTLMirroring+obsolete&btnG=Search

The problem is threefold:

1. System.Collections.Generic.Collection<T> became System.Collections.ObjectModel.Collection<T>

2. IEnumerable<T> now derives from IEnumerable, meaning that all classes implementing IEnumerable<T> need two implementations of GetEnumerator().

3. Once you fix those, you'll get errors that Application doesn't contain a definition for EnableRTMMirroring.

So to fix the problem:

1. In NodeList.cs, add "using System.Collections.ObjectModel;"

2. In SkipList.cs, BinarySearchTree.cs, and Graph.cs, find the implementation of public IEnumerator<T> GetEnumerator() and add this below it:

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}

3. Remove lines in *Tester\Program.cs that say "Application.EnableRTLMirroring();"

Then it should work!