Hello
First, I am sorry about my cross-posting, but my problem, although happened
to windows forms, is about fixing exceptions not thrown by code. So can be
applied to C# in general.
My customer reported getting this exception (details below) in the his
application. The exception was thrown in the Control.WmPaint method, which
is in the System.Windows.Forms assembly, and none of the methods in the
stack trace is in my application code. All are in the System.Windows.Forms
assembly.
The application is running on Windows 2000 professional (German) (SP4 with
all windows updates installed) and .NET Framework 1.1 (German)
************** Ausnametext **************
System.NullReferenceException: Der Objektverweis wurde nicht auf eine
Objektinstanz festgelegt.
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
The first thing that I thought of, that may be WmPaint catches an exception
thrown by my code, and rethrows the exception, but a look at the disassembly
of WmPaint told me that WmPaint doesn't have any catch or throw statements.
This bug occurred only once, and my customer and I were unable to reproduce
it again. The question is how can I track and fix a problem like this when
the exception is not thrown by my code, or a method called by my code?
Any help is appreciated.
Thanks a lot in advance,
Best regards
Sherif ElMetainy