I have a large Compact Frameworks V2.0 application that in most cases works very well. On certain devices about once a day, a user receives a Native Error 0xC0000005 that i
A 0xC0000005 is an access violation, so something is trying to read from or write to an address that it doesn't have rights to access. These tend to be really hard to find and experience is one of the best tools (well Platform Builder's debugger is really helpful too, but that's a whole separate avenue of debugging and requires experience that you probably don't have or you'd have already tried it). I find that logging tends to be less useful that subtractive coding - removing P/invoke calls with mock managed calls whenever possible.
Access violations in managed apps typically happen for one of these reasons:
You'll note the trend here that almost all of these are P/Invokes and that's no accident. It's quite difficult to get managed code to do this on its own.
My native C++ exception handling was not including async exception, and thus was not catching access violation exceptions.
This may/may not be helpful for my problem, but might be helpful for others.
Using the /EHa switch as documented in this link will allow for catching these types of exceptions:
http://msdn.microsoft.com/en-us/library/1deeycx5.aspx