I have .net 4.0 application which is crashing without any exception. When I install .net 4.5 on my machine, application did not crash. Mostly the app is crashing when idle for sometime. I tried to attach the application to debugger , but no help. Also i tried to attach the application to windbg.exe but that too did not help.
Actually my application is not using any function of .net 4.5.
In windows Event viewer , i can see the below log for the application crash. Event Log : An unhandled exception of type 'System.AccessViolationException' occurred. Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
If you have any experience with this, or have some useful tips or tools, let me know ! All kind of help is welcome.
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()
Possible function giving error private void CreateWndAndMsgLoopThreadFunction() { try {
MyNativeWindow nw;
nw = new MyNativeWindow();
CreateParams cp = new CreateParams();
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 = new UserWndProc(UserWndProcWrapper);
nw.CreateHandle(cp);
m_hWnd = nw.Handle; // very important !
// check if handle is null
if (m_hWnd == IntPtr.Zero)
{
MessageBox.Show("VishException in CreateWndAndMsgLoopThreadFunction", "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;
}
#if _SHOW_DBG_MSGS
MDBGLogger.MDBGLogger.AlwaysLine("Exiting messageLoop");
#endif
}
catch (Exception e)
{
MessageBox.Show("VishException in CreateWndAndMsgLoopThreadFunction", "Error", MessageBoxButtons.OKCancel);
}
}