I'm looking for common causes of Access Violation errors under .NET.
Things I have checked so far -
- Call Dispose on all objects implementing IDisposable
- Check for valid arguments in calls to COM objects
- Explicitly remove all manually added event handlers
- DO NOT explicity call GC.Collect/GC.WaitForPendingFinalizers
- Add and Remove memory pressure when dealing with native objects (Bitmap, etc..) (Added)
- Verify all PInvoke calls for valid argument types
- Ensure proper use of IntPtr, SafeHandle and HandleRef
- Threading (Thread Safe, Reentrant functions), proper use of waithandles. (Added)
- Ensure application and DLL's are all targetting the same platform (x86 or x64) (The application and dll's should target the same platform as the COM objects.) (Added)
Any other suggestions?
Edit - Moved crash dump analysis to different question.