【问题标题】:XmlParseException occuring in PresentationFramework for deploys onlyPresentationFramework 中发生的 XmlParseException 仅用于部署
【发布时间】:2010-12-31 04:21:23
【问题描述】:

当我将 WPF 应用程序部署到另一个用户的计算机时,我遇到了以下异常:

未处理的类型异常 'System.Windows.Markup.XamlParseException' 发生在 PresentationFramework.dll 中

但是,当我打开 WPF 应用程序时,它运行良好。应用程序在启动时崩溃并显示此消息。我已经仔细检查以确保他们的机器上安装了 .NET 3.5 SP1,并且还验证了他们可以运行原型 WPF 应用程序。有没有解决此类错误的好方法?

谢谢!

【问题讨论】:

    标签: .net wpf xaml .net-3.5


    【解决方案1】:

    您可以设置一些代码来捕获未处理的异常:

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

    如果这不能发现确切的问题,它至少可以为您提供足够的信息来开始。

    【讨论】:

    • 非常感谢!这给我带来了一些严重的问题,但事实证明我确实有一个无法连接的 tcpclient。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-22
    • 1970-01-01
    • 2016-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多