Q:

Application launching 100% in debug but not in real life

I have looked all over the web but did not find anything that could help me out here.
I run Windows 8 with my beloved VS 2012 and my PC has the 4.5 framework.
I have developed a WPF C# application that I am targeting for the 4.0 Framework.
When I run it in debug mode in VS 2012 it runs perfectly but when I publish to my publish folder, run setup.exe and try to run the app, nothing happens. It does not give me any error messages but it also doesn't show any window, as if it weren't doing anything.
Is this an issue some folks have run into and if so, how can I remedy?
What info do you need? I am running the app through a bootstrapper and MVVM model; nothing extravagant.

A:

This can be a very tricky thing to fix. You have a number of options:
First, open Task Manager, then look to see if a new Process appears when you start your published application. If no process for your application is added, then you really have problems. However, if a process does appear, then you can attach your Visual Studio to this process to debug it. Please refer to the Attach to Running Processes with the Visual Studio Debugger page at MSDN for help with this.
If you can't do that, then you pretty much have to try to find the offending code without help. You'll need to edit the code to pop up loads of message boxes with the values of various objects to see if any of them are unexpectedly null. You can use common sense with this... this will never cause you a problem:
int value = 0;

Whereas this is much more likely to:
FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write, FileShare.None);

In the latter case, add something like this afterwards:
MessageBox.Show(string,Format("path value: {0}", path));

One last point to make is that if the main Window does not appear, then your problem could well be in your constructor. If you can't debug your published version, then I really wish you good luck in finding the problem... it could be quite difficult.

