Error in running WPF application Error in running WPF application wpf wpf

Error in running WPF application


You may to check the following steps to catch more details on the exception : SO Question


I have encountered same issue, and I have solved this.This is caused by missing some environment dll, try to instal Visual C++ Redistributable http://www.microsoft.com/en-us/download/details.aspx?id=30679, and then run your app.


To get more info on the exception, add this method to your App.xaml.cs

public partial class App : Application {    void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) {        Exception ex = e.Exception;        Exception ex_inner = ex.InnerException;        string msg = ex.Message + "\n\n" + ex.StackTrace + "\n\n" +            "Inner Exception:\n" + ex_inner.Message + "\n\n" + ex_inner.StackTrace;        MessageBox.Show(msg, "Application Halted!", MessageBoxButton.OK);        e.Handled = true;        Application.Current.Shutdown();    }}

And DispatcherUnhandledException="App_DispatcherUnhandledException" to your App.xaml:

<Application x:Class="MyApp.App"             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             StartupUri="MainWindow.xaml"             DispatcherUnhandledException="App_DispatcherUnhandledException">    <Application.Resources>             </Application.Resources></Application>