Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF DotNET Application will run in debug mode, but .EXE will not run

I wrote a WPF application in C# using VS 2010. The application will run fine in debug mode using Visual Studio, but when I go to run the .EXE from the bin\release folder, nothing happens. I do not get any error messages from windows and there are no errors or warnings in VS. I have tried to build, rebuild and clean the solution (in every possible order) with no luck. My solution contains 2 projects, both of which use .NET 4.0 framework, and I have .NET 4.0 installed on my PC. I have tried on both XP and Win7 and still nothing.

I also just noticed that the output from Debug when I run the application in debug mode says: "Cannot find or open the PDB file" after each .Dll it loads.

I am compiling to the Release folder every time, but i did try changing it to the debug folder and clean/rebuild just to see if that would make a difference, and it didnt, so I changed it back, tried it again, and still nothing.

Any Ideas?

like image 640
user441603 Avatar asked Nov 17 '10 16:11

user441603


People also ask

How do I run an EXE in debug mode?

Just use File/Open Project/Solution, select EXE file and Open it. Then select Debug/Start debugging. The other option is to run the EXE first and then Select Debug/Attach to process. Save this answer.


4 Answers

Here are a couple of ideas that come to mind

  • If you are on a x64 machine, try changing the application from being AnyCPU to x86. This the mode that applications default to in debug mode and it's possible an issue running in x64 is causing a problem in release builds
  • Possible the Release binaries are out of date. Delete the binaries from the Release folder, rebuild and run the newly generated runs
  • Run the release build under the debugger in Visual Studio and see if it till crashes
like image 143
JaredPar Avatar answered Sep 20 '22 15:09

JaredPar


I was experiencing the above issue too, however none of the other solutions worked for me.

My Application logs in Event Viewer listed event ids 1018 and 1022. This appeared to be bizarrely related to an ASP.NET 2.0 dll (bizarre; as this was a blank WPF project only). The logs contained messages like this:

Windows cannot open the 64-bit extensible counter DLL ASP.NET_64_2.0.50727 in a 32-bit environment

In the end it turned out to be resolved when I disabled my anti-virus. I had read that this resolution worked for someone with McAfee; and it also worked for my environment, which has Avast.

like image 36
ne1410s Avatar answered Sep 20 '22 15:09

ne1410s


I had a very similar issue.

Check out this setting on your App Pool entry:

  • Go to Advanced Settings.
  • Change 'Enable 32-bit Applications' to 'TRUE'.

This worked for me!

like image 44
Ethan Turk Avatar answered Sep 17 '22 15:09

Ethan Turk


I assume you tried on a machine that doesn't have visual studio installed, and also none of the components you are using for development.

You have only one option: start the application with a debugger on the machine that causes problems and check for exceptions there. (use WinDBG for example - it's light and easy).

This looks like a problem with missing dependencies, but might be something else also.

The Debugging Labs should give you enough information on how to use windbg to find your problem:

  • .NET Debugging labs

Also use this:

  • WinDBG Cheat Sheet
like image 35
Bogdan Maxim Avatar answered Sep 19 '22 15:09

Bogdan Maxim