I'm running a dll from .net 2.0, and it runs fine. I load it into a .Net 3.0 program, and boom it fails --- on a basic switch statement it takes the wrong branch. I can set breakpoints, verify values/equality in the immediate window, all is fine. It just chooses to run the wrong branch. Very disturbing.

For the record here is the code that is failing, maybe I'm just not spotting something obvious.

switch (curTag) // value is TagType.RemoveObject2
{
	case TagType.RemoveObject: // *** takes this branch
		ControlTags.Add(new RemoveObjectTag(r)); 
		break;

	case TagType.RemoveObject2:
		ControlTags.Add(new RemoveObject2Tag(r));
		break;
		
// from the immediate window:

curTag == TagType.RemoveObject
false
(int)curTag
28
(int)TagType.RemoveObject2
28
(int)TagType.RemoveObject
5
curTag == TagType.RemoveObject2
true

Not sure what to say here, I keep thinking it is something stupid, but it is the same dll both times (runs fine from a .net 2.0 program that refs the same dll, and parses the same swf file, and even uses the same code to do that). Maybe they just aren't meant to run together? Hmm...

posted on Wednesday, March 26, 2008 1:16 AM
Feedback
  • # RE: Weirdest VS2008/.Net3.0 bug...
    Jeff Lewis
    Posted @ 3/26/2008 10:35 AM
    Just a guess, but did you recompile any (more likely one) of the DLL's?

    If you have an enum in Enums.dll like:
    enum X {X0,X1,X2}

    And you use it in UseEnums.dll like:
    if (x = X.X0)...

    Then you add and recompile Enums.dll:
    enum X {Y,X0,X1,X2}

    If you don't recompile UseEnums.dll your in trouble. UseEnums actually has the value of the enum at compile time, not at run time.

    The intermediate window, on the other hand, loads the new dll and uses the new values.

Blog Stats

  • Posts - 120
  • Stories - 1
  • Comments - 390
  • Trackbacks - 47

.Net Blogs

01101 Blogs

Flash Blogs

Graphics

People