views:

89

answers:

2

I'm attempting to debug a .NET Compact framework C# application on a Windows Mobile 6 device using Visual Studio 2005. If execution reaches a breakpoint I have previously set, 9 times out of 10 it crashes. If it doesn't crash first time, that breakpoint will continue working correctly, even through multiple executions of the application.

+2  A: 

I get an exception code 0xC0000005 (STATUS_ACCESS_VIOLATION) at address 0x00000000015fab774.

That's a native exception. In a managed application this is typically caused by one of your P/Invokes or a flaw in a customised version of WindowsCE.

I had an identical issue with some printer code a while back. The native exception ONLY occured during attached debug and then not all the time but sometimes all of the time. :D. It never happened in production.
The actual issue was a bad bit of C++ that got a string (well a pointer to a string) and then gobbled the next 1024 bytes onwards. Problem was, sometimes it wasn't supposed to access some of those bytes! I think it happened during debug due to either more memory being used or some curious memory alignment scenario.
We fixed that issue by passing the length of the string to the C++ call too so it didn't have to take the next 1024 blindly.

It is worth noting that there are many more possibilities that result in a 0xC0000005. Some very helpful people haved added some of those possibilities here.

If you do not have access to any of the lower level code I recommend taking this issue up with the people who provided your OS image (typically the manufactuer) as well as any providers of low level components you use. This issue is HARD to fix so I wouldn't expect a fix myself, especially if the Manufacturer is Symbol, Intermec or Datalogic (formers have shit support and the latter just fired most of their devs).

Quibblesome
Unfortunately, it's Visual Studio itself that is crashing and generating the access violation, the app itself is fine until Visual Studio restarts because of the error
Kentaree
A: 

This issue seems to have been resolved after a re-install of Service Pack 1 for Visual Studio 2005

Kentaree