How can I find the cause of an ExecutionEngineException - c#

I have a WPF application(.net 4.0) which is working fine on Windows 7 systems. But when I try to run the application windows 8.1 it is working fine for 15 to 20 mins but after that suddenly a popup message is showing like
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available
popup message showing with two options Debug and close program. When I press debug it is showing message as FatalExecutionEngineError detected
The runtime has encountered a fatal error. The address of the error was at 0x713543ed, on thread 0x23624. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
if i press continue further showing message as
An unhandled exception of type 'System.ExecutionEngineException' occurred in PresentationFramework.dll
But i didn't get the exact reason why it is failing and which portion of code is causing the problem?
After searching over the net i have tried the following
Added DispatcherUnhandledException handler and App domain Unhandled exception handler and also added legacyUnhandledExceptionPolicy to . But nothing is works for me still facing the crash on Windows 8.1
Can someone point me how to detect the code portion which causing the crash? and How to handle FatalExecutionEngineEror exception?
EDIT
CLR version Used in both windows 7 and 8.1 is 4.0.30319

Related

FatalExecutionEngineError when RegisterAllAreas called

I have encountered the following error when starting a debugging session:
Managed Debugging Assistant 'FatalExecutionEngineError' : 'The runtime has encountered a fatal error. The address of the error was at 0x6a1cb403, on thread 0xc88. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.'
The error occurs on a asp.net web application built on .net framework 4.7.1 when AreaRegistration.RegisterAllAreas() is called but only on every second debugging session. As far as I known, the error started to occur after we introduced a reference to netstandard. After stopping and starting a new debugging session, everything works fine until the next debugging session.
We are using Visual Studio 2017
After some googling I found the solution. The issue is caused by bug in .Net Framework.
Editing C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config and inserting disableNativeImageLoad element solved the issue.
<runtime>
<disableNativeImageLoad>
<assemblyIdentity name="netstandard" />
</disableNativeImageLoad>
</runtime>

DotNetBrowser unhandled exception during execution

I've developed a multithreading WPF application which is using one instance of DotNet component (namespace WPF.DotNetBrowser).
The application was running during about 21 hours of nonstop work, and then it crashed.
An undandled exeption was raised in .dll library (which was added using the docs). Visual Studio Warning (which usually describes raised exceptions) shows:
An unhandled exception of type 'lld.reworBteNtoD ni derrucco'
And further description was:
Additional information: Failed to send message GetDeviceScaleFactorMessage {type=GetDeviceScaleFactor, uid=3719442, deviceScaleFactor=0}.
Finally the application went to break mode and the 'output' tab contained the following
An undandled exception of type '' occured in DotNetBrowser.dll
So it couldn't even determine the type of exception that had been raised. I think it happens because the exception was raised in the dll file.
How can I work around this? VS was running under admin rights and the application can crash unexpectedly at any time of it's execution.

UWP Access violation exception when activating any input field

Something strange happens with my app.
Windows 10 UWP Application, works fine on PC and on some phones. But on my lumia 730 (with latest preview build) and on devices of some my customers app crashes when you trying to activate any input field.
Application "[7376] <AppName>.exe" has terminated with code -1073741819 (0xc0000005) 'Access violation'.
Theres no any stacktrace and other error messages. How I can debug the error and find the trouble?
UPD: Windows certification kit says that everything is allright
UPD2: In emulator of Windows 10 build 14393 I ahve the same trouble
UPD3: I did turn on machine code debugging and load the pdb files.
Now I have an error in wrl\client.h on these lines:
// query for U interface
template<typename U>
HRESULT As(_Inout_ Details::ComPtrRef<ComPtr<U>> p) const throw()
{
return ptr_->QueryInterface(__uuidof(U), p);
}
Any ideas?

AccessViolationException on WebBrowser only on XP

I just got some feedback of some users of our application, they have got issues on windows XP with our application. This application works fine on Windows 7, but not on Windows XP.
One other strange thing: If I build this on a Windows XP workstation(with VS2010), it works on my local workstations, and if I put this build on another XP workstation, it doesn't work anymore.
When running on XP, I just got an error telling me that XXXXX has encountered a problem and needs to close. We are sorry for the inconvenience.
I found in the EventViewer Application's log this stacktrace:
Application: MyApplication.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Windows.Forms.UnsafeNativeMethods+IOleObject.DoVerb(Int32, IntPtr, IOleClientSite, Int32, IntPtr, COMRECT)
at System.Windows.Forms.WebBrowserBase.DoVerb(Int32)
at System.Windows.Forms.WebBrowserBase.TransitionFromRunningToInPlaceActive()
at System.Windows.Forms.WebBrowserBase.TransitionUpTo(AXState)
at System.Windows.Forms.WebBrowserBase.OnParentChanged(System.EventArgs)
at System.Windows.Forms.Control.AssignParent(System.Windows.Forms.Control)
at System.Windows.Forms.Control+ControlCollection.Add(System.Windows.Forms.Control)
at My.NameSpace.Here.Controls.LearningCenterControl.InitializeComponent()
at My.NameSpace.Here.Controls.LearningCenterControl..ctor()
at My.NameSpace.Here.MainForm.InitializeComponent()
at My.NameSpace.Here.MainForm..ctor()
at My.NameSpace.Here.MainForm.get_Instance()
at My.NameSpace.Here.Program.Main(System.String[])
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
This happens on the InitializeComponent of the designer of one of my userControl:
this.m_learingResourceBrowser = new System.Windows.Forms.WebBrowser();
I guess there a Security issue with XP, but what?
I found this:
REM Mark project as DEP Noncompliant
call "$(DevEnvDir)..\..\VC\bin\vcvars32.bat"
call "$(DevEnvDir)..\..\VC\bin\editbin.exe" /NXCOMPAT:NO "$(TargetPath)"
I've put this Post-build event on the exe project, but I didn't saw any improvement
I've also tried to run directly the command with my exe:
editbin.exe /NXCOMPAT:NO YourProgram.exe
Any idea about what could cause this issue?
EDIT
I found this answer which states:
To test if its a DEP issue do this.
Right click on "My Computer" Select "Properties" and "Advanced" Under
"Startup and Recovery, click Settings Now click on "Edit" The notepad
has just begun. Simply replace the line: Code: noexecute optionn by
AlwaysOff Restart your PC to complete the transaction.
And I after this I don't have this error anymore. So my question is: currently I've done the previous operation only on the main exe. Should I do this operation on all dll? Because my project is composed of more than 230 projects, so it would be hard to test everything.

Is MonoDevelop remote debugging works on Windows

I'm using mono-2.6.7 and monodevelop-2.4, my OS is Windows 7.
I'm trying to implement a remote debugger for my own runtime (based on mono, mono is embedded in it, used lang - C#) in a way it's done by Novell for Moonlight.
Unfortunately, no success...
After clicking "Debug" in MonoDevelop:
IDE is put into debug state,
my runtime starts,
successfully sends DWP-Handshake to listening IDE
and then connection terminates and Debugging ends.
For some reasons (absolutely not clear for me) IDE doesn't send a handshake after recieving it from my runtime but simply terminates a connection.
The code i use is in another question: Can't use Mono Soft Debugger Remote Debugging because 'debugger-agent: DWP handshake failed' error
Does smb know if it can be done the save way it's done for Moonlight? Or it's it's impossible? Maybe there is another solution?
Prooved! It works. The problem was in unhandled exception thrown by VirtualMachineManager.ListenInternal(2) method in Mono.Debugger.Soft. More details here - Can't use Mono Soft Debugger Remote Debugging because 'debugger-agent: DWP handshake failed' error

Categories

Resources