2009-12-30 24 views
2

我收到以下異常,當我部署我的WPF應用程序到其他用戶的計算機:XmlParseException發生的歷史爲僅部署

類型的未處理的異常 「System.Windows.Markup.XamlParseException」 發生在PresentationFramework.dll中

但是,WPF應用程序運行良好,當我打開它。此應用程序在啓動時崩潰。我仔細檢查過以確保.NET 3.5 SP1安裝在他們的機器上,並且驗證他們可以運行原型WPF應用程序。有沒有一種好的方法來解決這種類型的錯誤?

謝謝!

回答

3

您可以設置一些代碼來捕獲未處理的異常:

在App.xaml中

<Application 
    ... 
    DispatcherUnhandledException="App_DispatcherUnhandledException" /> 

在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; 
} 

如果沒有發現確切的問題,它可能至少會爲您提供足夠的信息來開始。

+0

非常感謝!這造成了一些嚴重的問題,但事實證明,我確實有一個無法連接的tcpclient。 – Automatico

相關問題