I am getting the following exception when I deploy my WPF app to another user's machine:
An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
However, the WPF app runs fine when I open it. The app crashes at StartUp with this message. I've double-checked to make sure .NET 3.5 SP1 is installed on their machine, and also verified th开发者_StackOverflowey can run a prototype WPF app. Is there a good way to troubleshoot this type of error?
Thanks!
You can setup some code to catch unhandled exceptions:
In App.Xaml
<Application
...
DispatcherUnhandledException="App_DispatcherUnhandledException" />
In App.Xaml.cs
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
// Add code to output the exception details to a message box/event log/log file, etc.
// Be sure to include details about any inner exceptions
// Prevent default unhandled exception processing
e.Handled = true;
}
If that doesn't uncover the exact issue, it may, at least, give you enough information to get started.
精彩评论