WPF app goes beyond Visual Studio

I have a WPF application that works fine in VS.NET, but if I try to run it outside of VS.NET, I get "... ran into a problem and must close". dialog. This happens in debug and release modes. Why is this happening?

+1


a source to share


2 answers


This is most likely an uncaught exception. You can try using Application.DispatcherUnhandledException Event to display a message box, except to narrow down the problem:

Add this to your App.xaml as a tag attribute <Application>

:

DispatcherUnhandledException="Application_DispatcherUnhandledException"

      



while the implementation of this handler might look like this:

private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
    System.Windows.MessageBox.Show(e.Exception.ToString());
}

      

But without much context, it might be something that is causing it, and you probably have a better understanding of where it comes from when considering an exception.

+6


a source


Make sure you have all the libraries your executable needs to run in the same folder as the executable, as well as any required configuration or manifest files.

Have you already tried to run the application directly from the debug / release folders? Are all your links marked as "Copy to Output Directory"?



Another thing to check is that your project file is not configured to add a parameter to your application.

+1


a source







All Articles