Error in running WPF application

2019-06-17 04:34发布

The application is working fine on the computer where it's made, but when I copied it to another one, same OS, it crashed and it showed this error:

Problem signature:
  Problem Event Name: CLR20r3
  Problem Signature 01: vpn2.exe
  Problem Signature 02: 1.0.0.0
  Problem Signature 03: 4f615c78
  Problem Signature 04: mscorlib
  Problem Signature 05: 4.0.0.0
  Problem Signature 06: 4ba1da6f
  Problem Signature 07: 3dab
  Problem Signature 08: ce
  Problem Signature 09: System.Windows.Markup.XamlParse
  OS Version: 6.1.7600.2.0.0.256.1
  Locale ID: 1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

Now, I know this kind of errors usually appear when there are missing components, like .NET framework or something, but I made sure that I installed the same (or higher) version of .NET framework and again it's not working. I looked at the installed components at the operating system where the application is working, and I can see there are a lot of installed programs that came with Visual Studio 2010 and I don't know which one of them is needed for this application to work, and I really don't have the time to try them all. If anyone has had the similar problem, please give me some ideas, thanks in advance.

3条回答
劫难
2楼-- · 2019-06-17 05:19

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.

查看更多
家丑人穷心不美
3楼-- · 2019-06-17 05:21

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>
查看更多
Juvenile、少年°
4楼-- · 2019-06-17 05:23

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

查看更多
登录 后发表回答