C# code throwing exception while not running - c#

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.

Related

System.Diagnostics.Process.Start causes error "No application is associated with the specified file for this operation" when deployed

I am new to c# and have created a web form using ASP.NET 4.7.2 and Visual Studio 2019. One of my buttons links to a url using:
System.Diagnostics.Process.Start("www.google.com", "_blank");
However, when I debug my app locally, it works fine. Once I deploy the app and click on the same button, this error shows up:
Exception Details: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
This points directly at the line where I make the call to System.Diagnostics.Process.Start.
What am I doing wrong?

JIT debugging not showing for WPF application

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.

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.

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