How do I stop Visual C# 2005 crashing when debugging on a windows mobile device?
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.
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).
重新安装Visual Studio 2005的Service Pack 1后,此问题似乎已得到解决
链接地址: http://www.djcxy.com/p/53650.html