问题
I have an application written wholly in C# on the .NET 3.5 compact framework that seems to be crashing at random moments with native exceptions. My application never logs any of these exceptions it just quits. Sometimes my application can run for hours or you can start it and 5 minutes later it will crash!
I have been storing up the dump files that are sometimes produced but having difficulty understanding what the problem is because I lack debug symbols for the dll that is throwing (netcfagl3_5.dll). The error is an Access Violation but trying to read the output from WinDbg has left me frustrated:
FAULTING_IP:
netcfagl3_5_7b37d000+152b4
7b3922b4 043092e5 ldr r3,[r2,#4]
EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 7b3922b4 (netcfagl3_5_7b37d000+0x000152b4)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: ffffffd4
Attempt to read from address ffffffd4
FAULTING_THREAD: 890fa60a
ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
EXCEPTION_PARAMETER1: 00000000
EXCEPTION_PARAMETER2: ffffffd4
READ_ADDRESS: ffffffd4
FOLLOWUP_IP:
netcfagl3_5_7b37d000+152b4
7b3922b4 043092e5 ldr r3,[r2,#4]
APP: nk.exe
BUGCHECK_STR: APPLICATION_FAULT_INVALID_POINTER_READ_ZEROED_STACK
PRIMARY_PROBLEM_CLASS: INVALID_POINTER_READ
DEFAULT_BUCKET_ID: INVALID_POINTER_READ
LAST_CONTROL_TRANSFER: from 7b394094 to 7b3922b4
STACK_TEXT:
2546ec78 7b394094 : 01d5ebec 890fa60a ffffffd0 ffffffd0 : netcfagl3_5_7b37d000+0x152b4
2546ec84 2551cc4c : 01d5ebec 890fa60a ffffffd0 ffffffd0 : netcfagl3_5_7b37d000+0x17094
2546ec90 7b385280 : 01d5ebec 890fa60a ffffffd0 ffffffd0 : 0x2551cc4c
2546ec9c 7b38536c : 01d5ebec 890fa60a ffffffd0 ffffffd0 : netcfagl3_5_7b37d000+0x8280
2546ece8 7b38eb2c : 01d5ebec 890fa60a ffffffd0 ffffffd0 : netcfagl3_5_7b37d000+0x836c
2546ed20 7b38ed84 : 01d5ebec 890fa60a ffffffd0 ffffffd0 : netcfagl3_5_7b37d000+0x11b2c
2546ed5c 7b38f0c4 : 01d5ebec 890fa60a ffffffd0 ffffffd0 : netcfagl3_5_7b37d000+0x11d84
2546eda4 00000000 : 01d5ebec 890fa60a ffffffd0 ffffffd0 : netcfagl3_5_7b37d000+0x120c4
I have 4 dump files here https://www.dropbox.com/s/9g6zjbxh4ghv5v3/DumpFiles.zip but I can get more.
As as a side question I have tried scouring the internet to find out where the debug symbols are for netcfagl3_5.dll with limited success so if any one know's where they can be found that would be great.
I am chasing Motorola as specifically this seems to be more of a problem with the ES400 device and any updates from them regarding this problem I will update here.
Any help would be really appreciated.
回答1:
After many hours of debugging the issue I believe I have managed to replicate the issue thus identify the cause in my application.
I have a TitleBar control that is placed on top of every form, this shows the current Form title, the battery status and status of the current synchronization with our server.
The control subscribes to an event exposed by our synchronization engine to get the latest state. When this event is raised we update the control with an icon to show its progress.
I follow all the rules regarding cross thread access and making sure the control is only manipulated using the UI thread but it seems that if we constantly get state changes something internally causes an AccessViolation.
If I use a Timer and update the control every couple of seconds rather than when the state has changed the problem goes away and we no longer get random process exits.
The crucial part of the stack trace above that helps more than anything else is the fact the netcfagl3_5 is a Windows Forms native dll so the bits of the puzzle all seem to be coming together.
来源:https://stackoverflow.com/questions/14518539/random-native-exception-from-net-compact-framework-3-5-application