Raywan
Raywan

Reputation: 41

WPF Application crashes on second system without a session of visual studio running

We have a WPF application built in Visual Studio built in system A. It runs out of VS on system A (as well as in VS, obviously). But when I take the .exe to a second system (B) and run it there it crashes before it comes up. It puts up the infamous message: "xxx has stopped working, Windows is checking for a solution to the problem". Of course, Windows never finds a solution. But it runs if I have Visual Studio running on system B (even though it's a new session with no connection whatsoever to the application). This has me scratching my head. I have already tried everything in this thread: Application crash without Visual Studio installed

I was absolutely sure the part about 'disable the option "Enable Visual Studio hosting process"' would solve the problem but it didn't. I have disabled that option in the project settings for all instances and it still crashes. Any ideas? Sorry if I can't share the code.

Upvotes: 1

Views: 1043

Answers (1)

J R B
J R B

Reputation: 2136

there can be lots of reason. first you have to check window Event Viewer, you will able to find actual reason.

also you should handle DispatcherUnhandledException="Application_DispatcherUnhandledException". this will show actual error.

in App.XAML :

DispatcherUnhandledException="Application_DispatcherUnhandledException"

and in App.cs:

private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
    {

        e.Handled = true;
    }

Upvotes: 1

Related Questions