JIT debugging not showing for WPF application - c#

I'm running an WPF application on a different computer than I am developing it on. Currently I am only using the files from Debug instead of Release. I notice that when I run an application made in Windows Forms, a JIT debugging window shows up when an unhandled exception occurs. This is not the case for my WPF application though. I've check my visual studio settings and I have JIT enabled. Installing visual studio on the computer where the application needs to run is not really possible. Is there a way I can get the JIT debugging window to show up? I am having a real pain in trying to figure out what is going on when the application crashes and doesn't give me any information about it.

So I've not been able to replicate the windows form unhandled exception window but I've got the next best thing using this article:
https://www.wpf-tutorial.com/wpf-application/handling-exceptions/
Adding the following code into app.xaml
DispatcherUnhandledException="Application_DispatcherUnhandledException"
And the following code into app.xaml.cs
public partial class App : Application
{
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show("An unhandled exception just occurred: " + e.Exception.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning);
e.Handled = true;
}
}
I get a MessageBox telling me what the error is. It also handles the exception and allows the application to continue running.

Related

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.

C# code throwing exception while not running

I'm working in Visual Studio 14. When I initially open the solution, a catch block in my application is triggered and a messagebox displays as if the app were running.
The exception occurs when the app tries to get a connectionstring from my app.config.
Why would it throw an error if the app is not being executed? It even does it periodically while I'm working elsewhere in the code.

Click Once Deployment Requires Visual Studio Installation

I try to deploy a Click Once Installer but run into a very strange issue:
The installer runs fine but as soon as the application is supposed to start it crashes with the following message
[MyApp] has encountered a problem and needs to close. We are sorry for
the inconvenience.
and no useful information about the cause. As soon as I install Visual Studio Professional 2012 on the same machine, the application starts fine but sometimes behaves very strange (e.g. I have to click to red close button twice to close the application). Funny enough, the problem not always appears, I suspect it has something to do with the order in which I install the .Net Framework/Visual Studio/the Click Once installer.
I am pretty much lost here .....
Btw: The framework targetVersion and supportedRuntime of the Click-Once installer are 4.0 and 4.0.30319 respectively.
Add an UnhandledException handler to your app. This will allow you to see the exception that is causing the crash.
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
static void MyHandler(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = (Exception)e.ExceptionObject;
MessageBox.Show("Unhandled domain exception:\n\n" + ex.Message);
}
Note that the use of MessageBox is only for debugging. A logging system should be used for your release version.

System.StackOverFlowException error in published code

I am using VS 2010. I did changes in the code to log the application exceptions. In visual studio, when I debug, I am able to log all the exceptions in the folder allotted for that. But I'm not able to log the exceptions when I publish my application. (System.StackOverFlowException occurred in mscorlib.dll) This is the error I'm getting from the published application when I'm getting an exception and I'm not able to log any application related exceptions.
You cannot catch a System.StackOverFlowException. Unless you are throw it yourself or your application runs within a debugger or other host process.
You must use a debugger to capture the exception. If the exception doesn't occur in your test setup, you should get the data the 'user' is using.

How can I find the cause of an ExecutionEngineException

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

Categories

Resources