user404068
user404068

Reputation: 207

WPF UI crashes only when debugging

If I go to Debug -> Start Without Debugging my WPF app runs fine, but if I go to Debug -> Start Debugging then the UI will disappear and this will be in the Output window under Debug:

The program '[6744] UI.exe: Managed (v4.0.30319)' has exited with code -1073740791 (0xc0000409)

No exceptions are thrown or anything. Why might this happen? I am using the Prism library so I'm not sure if it is related to that.

I am able to debug without crashes if I attach the debugger to the process manually.

Upvotes: 5

Views: 1422

Answers (6)

Oleg Sh
Oleg Sh

Reputation: 9011

I had the same problem, have changed "Platform target" from x86 to "Any CPU" and it works fine. But only for VS2010, not for VS2013

Upvotes: 0

Vlad Rudenko
Vlad Rudenko

Reputation: 2869

This problem could be caused by Microsoft EMET (Enhanced Mitigation Experience Toolkit) utility (http://support.microsoft.com/kb/2458544) if you have such installed.

Check the Application Event Log for errors like "Application Name: UI.exe. EMET detected EAF mitigation and will close the application: UI.exe".

If you have such errors - try to configure or just uninstall EMET :-)

Upvotes: 0

badmadbot
badmadbot

Reputation: 21

I have a similar problem in my multi threading app. I was trying to find the solution but no success. If your app using sime kind of multi threading - the issue may be in it. Check, that you UI run in same thread with the main thread...

Upvotes: 0

BrightShadow
BrightShadow

Reputation: 604

If You are using PRISM some errors can occur if any of Containers (set as region) has content. Every regions must be empty container controls or empty item controls.

Prism has a few different configuration for Debug and Release mode that can be a reason. Try to analyze line by line Your XAML code files where You have regions controls and check if tags are empty. The best way to be sure that containers are empty is to create short tag versions

e.g. try this

<ContentControl />

instead of this

<ContentControl></ContentControl>

Upvotes: 0

anmaia
anmaia

Reputation: 967

In my case, I have the same problem. When I changed the "Assembly name" to, in the max 42 characters, my app was build...

I thought that is crazy, but work.

Upvotes: 1

Teoman Soygul
Teoman Soygul

Reputation: 25742

You probably have a heap corrupting exception during object initializations (stackoverflow or an arbitrary out-of-memory condition). This is mostly caused by P/Invoke methods or other unsafe code. If you're not using any unsafe code, check out the 3rd party libraries that you're using as the source of error.

Upvotes: 0

Related Questions