1

I have a .NET CF 1.1 application that has been running perfectly fine for years. Occasionally, I get a help desk ticket with the following error message (generic):

    Method not found: 
    MethodName
    AssemblyNamespace.Class

The DLL is there, and it's the same version as my other devices. What could change that would make it not find the method. Does this error imply that the assembly was loaded, or did it break before that even happened?

Does it matter how I added the reference in Visual Studio (2003, btw)? I have Copy Local set to true, and therefore I made the assumption that it needs to be in the same directory as my executable.

Any help you can offer is appreciated. Thanks.

EDIT: I believe this DLL is also in the windows directory of the device, possibly a different version. It contains a lot of hardware specific functions (i.e. backlight, keyboard state, etc.)

starblue
  • 55,348
  • 14
  • 97
  • 151
IronicMuffin
  • 4,182
  • 12
  • 47
  • 90

3 Answers3

1

No it does not matter how you add the reference in Visual studio 2003. (100% sure)
Now for the not so sure : I think that someone else has the same assembly in the GAC of the phone. So the GAC assembly gets called rather than the one you deployed and that version of the assembly lacks the requested function.

basarat
  • 261,912
  • 58
  • 460
  • 511
  • Haha...edited my question as you answered. If that's the case, how do I force it to load the one I know is correct? – IronicMuffin Nov 26 '10 at 19:47
  • And on that note...why does it only do it sometimes? I would assume it's GAC'd on every device... – IronicMuffin Nov 26 '10 at 19:47
  • check out http://stackoverflow.com/questions/49972/in-what-order-are-locations-searched-to-load-referenced-dlls for order in which assemblies are searched.
    Anyways some other software might be updating it. On some phones that software is there. On others it isn't.
    – basarat Nov 26 '10 at 19:53
  • So if I did an assembly.loadfrom() prior to calling any methods, would that load the one I want? – IronicMuffin Nov 26 '10 at 20:02
  • That *should* fix the problem. But to be safe it is better that you request the assembly version you need using Version and Public Key Token. – basarat Nov 26 '10 at 20:13
  • LoadFrom() failed to fix the problem. – IronicMuffin Nov 29 '10 at 14:16
0

Depends on how you reference the file in your code. You could be relying on the current working directory which depending on how the app is launched or what they do after, it might not be what you expect it to be.

Kelly
  • 6,992
  • 12
  • 59
  • 76
0

Sometimes .NetCf throws this exception when the device is running out of memory, instead of the expected "Out of Memory" exception. I have observed this behaviour more often when loading native dlls using P/Invoke than loading pure netcf dlls.

yms
  • 10,361
  • 3
  • 38
  • 68