marți, 26 ianuarie 2010

.NET CF Exceptions

My .NET CF application is throwing some wierd exceptions which I can see when executing it in debug mode.
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll

These exceptions are thrown when the Image property is set:
myBtn.Image = ( (System.Drawing.Image) ( resources.GetObject( "myBtn.Image" ) ) );

It is confusing as the image is actually loaded and I can see it displayed on the control when I run the application. Apparently this is a bug of the .NET CF, which "slips" these execptions to the debugger, after it had actually handled them internally. People at Microsoft say it is safe to ignore these exceptions. Well, I've spent a couple of hours trying to figure it out before I found some hints here:

http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesvbcs/thread/ac29e918-a966-44e8-910b-75c6cc12aabf/
It all became easier after this. Ignorance solves it all.

Niciun comentariu:

Trimiteți un comentariu