I made a WPF program that works in the VIsual studio when run. I made an installer for my program with Visual Installer Projects 2017. At one part the program crashes and I get the following dialog:
我制作了一个WPF程序,可以在运行时在VIsual工作室中运行。我使用Visual Installer Projects 2017为我的程序安装了一个安装程序。在一个部分程序崩溃,我得到以下对话框:
An unhandled Microsoft.NET Framework exception occured in Program1.exe [10204].
Program1.exe [10204]中出现未处理的Microsoft.NET Framework异常。
My catch block looks like this
我的catch块看起来像这样
Dispatcher.Invoke(new Action(() =>
{
EnableContent();
}));
}
catch (AggregateException e)
{
MessageBox.Show(e.ToString());
Dispatcher.Invoke(new Action(() =>
{
UpdateLoadMsg("No internet connection.", MsgType.FAIL);
}));
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
Dispatcher.Invoke(new Action(() =>
{
UpdateLoadMsg("Something went wrong.", MsgType.FAIL);
}));
}
Messagebox is never showed! apparently the exception isn't being catched. How to debug this?
Messagebox永远不会显示!显然这个例外没有被抓住。如何调试?
1 个解决方案
#1
2
Relevant
I found the causing exception by looking at the system logs http://www.dummies.com/computers/operating-systems/windows-10/how-to-use-event-viewer-in-windows-10/ .
我通过查看系统日志http://www.dummies.com/computers/operating-systems/windows-10/how-to-use-event-viewer-in-windows-10/找到了导致异常的原因。
Non-relevant
The exception that was being thrown was a FileNotFoundException. Setting buildaction = embedded resource wasn't enough, I had to add the file as additional installation file.
抛出的异常是FileNotFoundException。设置buildaction =嵌入式资源是不够的,我不得不将该文件添加为附加安装文件。
#1
2
Relevant
I found the causing exception by looking at the system logs http://www.dummies.com/computers/operating-systems/windows-10/how-to-use-event-viewer-in-windows-10/ .
我通过查看系统日志http://www.dummies.com/computers/operating-systems/windows-10/how-to-use-event-viewer-in-windows-10/找到了导致异常的原因。
Non-relevant
The exception that was being thrown was a FileNotFoundException. Setting buildaction = embedded resource wasn't enough, I had to add the file as additional installation file.
抛出的异常是FileNotFoundException。设置buildaction =嵌入式资源是不够的,我不得不将该文件添加为附加安装文件。