Nick.Sologoub
4/14/2008 12:50:00 PM
I am developing an application that is working as a module for
Outlook.
In different parts of application, sometimes when form is closed I am
getting SynchronizationLockException. According to stack trace the
method that produces this exception is DestroyHandle. This exception
can occur on one PC and won't occur on another. Is it bug inside .NET
and how can avoid it? Please see below for more information:
10.4.2008 15:28:22Error description: Cannot perform action on email
item. *** EXCEPTION *** Message:
System.Threading.SynchronizationLockException: Object synchronization
method was called from an unsynchronized block of code. at
System.Windows.Forms.NativeWindow.DestroyHandle() at
System.Windows.Forms.Control.DestroyHandle() at
System.Windows.Forms.Control.Dispose(Boolean disposing) at
System.Windows.Forms.Form.Dispose(Boolean disposing) at
System.ComponentModel.Component.Dispose() at
System.Windows.Forms.Form.WmClose(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd,
Int32 msg, Int32 wParam, Int32 lParam) at
System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam,
Int32 lparam) at System.Windows.Forms.Form.Close() at
OutlookForms.ContextSensitiveToolbar.EmailContextSensitiveMenu.OnButtonClick(String
Action, String[] parameters) TargetSite: Void DestroyHandle() Source:
System.Windows.Forms StackTrace: at
System.Windows.Forms.NativeWindow.DestroyHandle() at
System.Windows.Forms.Control.DestroyHandle() at
System.Windows.Forms.Control.Dispose(Boolean disposing) at
System.Windows.Forms.Form.Dispose(Boolean disposing) at
System.ComponentModel.Component.Dispose() at
System.Windows.Forms.Form.WmClose(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd,
Int32 msg, Int32 wParam, Int32 lParam) at
System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam,
Int32 lparam) at System.Windows.Forms.Form.Close() at
OutlookForms.ContextSensitiveToolbar.EmailContextSensitiveMenu.OnButtonClick(String
Action, String[] parameters)