Hi,
We're having strange crashes in the our application after moving to .net 4.0.
My C# application disappears randomly without any exception.The old version was running with .net 3.5 without any crashes, but now that we moved to the .net 4.0 it started crashing randomly.
after digging down we could get below the stacktrace:
at RealNative.RealNativeWindowCopy.DispatchMessageW(MSG& msg)
at RealNative.RealNativeWindowCopy.LocalModalMessageLoop(Form form)
at RealNative.RealNativeWindowCopy.CreateWndAndMsgLoopThreadFunction()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)
at System.Threading.ThreadHelper.ThreadStart()
The possible function which is causing issue is like :
try {
MyNativeWindow nw;
nw =newMyNativeWindow();CreateParams cp =newCreateParams();
cp.Caption=this.m_winTitle;
cp.ClassName="!!"+this.m_classname;// i've modified the treatment so if the classname starts with !!, it will be registered undet that name
nw.UserWndProc=newUserWndProc(UserWndProcWrapper);
nw.CreateHandle(cp);
m_hWnd = nw.Handle;// very important !// check if handle is nullif(m_hWnd ==IntPtr.Zero){MessageBox.Show("Exception","Error",MessageBoxButtons.OKCancel);}while(true){//// if i'm getting true that means i've got WM_QUIT.//bool bReply =LocalModalMessageLoop(null);if(bReply ==true)return;}}
Though we are not sure if this is the exact function as the application has huge code and we also have unmanaged code. So from where the exception is thrown is not very clear.
Any kind of help is welcome!
Thanks in advance!