.NET 应用程序无法启动和接收 XamlParseException

2024-04-25

我编写了一个可以在我的开发 PC(Windows 7)上安装和运行的应用程序。

  • 开发环境:Window 7、VS2010 WPF C# 两者都有.NET 4 and .NET 3.5已安装

在其他客户端计算机(XP SP3、2和1)上,安装没有错误,但无法启动。在任务管理器中,我可以看到应用程序在自行关闭之前短暂占用内存。

我通过以下方式确保了我的开发 PC 和各种客户端 XP 计算机上的 .NET 3.5 一致性:

  • 应用目标.NET 3.5 (or 3.5 客户概况)
  • 使用VS2010安装程序进行部署:目标.NET 3.5处于发射状态
  • 在应用程序和安装程序项目的调试过程中,没有任何有关 .NET 兼容性的错误

eventvwr收到以下警告:

 ¬º˛¿‡–Õ:   ¥ÌŒÛ
 ¬º˛¿¥‘¥:   .NET Runtime
 ¬º˛÷÷¿‡:   Œfi
 ¬º˛ ID:    1026
»’∆⁄:       2011-10-18
 ¬º˛:       15:18:32
”√ªß:       N/A
º∆À„ª˙: WWW-9DB69D5A3AF
√Ë ˆ:
Application: Foo.exe
Framework Version: v4.0.30319
Description: ”…”⁄Œ¥æ≠¥¶¿Ìµƒ“Ï≥££¨Ω¯≥Ã÷’÷π°£
“Ï≥£–≈œ¢: System.Windows.Markup.XamlParseException
∂—’ª:
   ‘⁄ System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)
   ‘⁄ System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
   ‘⁄ System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
   ‘⁄ System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
   ‘⁄ System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext)
   ‘⁄ System.Windows.Application.LoadComponent(System.Uri, Boolean)
   ‘⁄ System.Windows.Application.DoStartup()
   ‘⁄ System.Windows.Application.<.ctor>b__1(System.Object)
   ‘⁄ System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   ‘⁄ MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   ‘⁄ System.Windows.Threading.DispatcherOperation.InvokeImpl()
   ‘⁄ System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   ‘⁄ System.Threading.ExecutionContext.runTryCode(System.Object)
   ‘⁄ System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   ‘⁄ System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   ‘⁄ System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   ‘⁄ System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   ‘⁄ System.Windows.Threading.DispatcherOperation.Invoke()
   ‘⁄ System.Windows.Threading.Dispatcher.ProcessQueue()
   ‘⁄ System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   ‘⁄ MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   ‘⁄ MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   ‘⁄ System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   ‘⁄ MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   ‘⁄ System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   ‘⁄ MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   ‘⁄ MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   ‘⁄ System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   ‘⁄ System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   ‘⁄ System.Windows.Threading.Dispatcher.Run()
   ‘⁄ System.Windows.Application.RunDispatcher(System.Object)
   ‘⁄ System.Windows.Application.RunInternal(System.Windows.Window)
   ‘⁄ System.Windows.Application.Run(System.Windows.Window)
   ‘⁄ System.Windows.Application.Run()
   ‘⁄ FooSoftware.App.Main()


”–πÿ∏¸∂‡–≈œ¢£¨«Î≤Œ‘ƒ‘⁄ http://go.microsoft.com/fwlink/events.asp µƒ∞Ô÷˙∫Õ÷ß≥÷÷––ƒ°£

这个 XamlParseException 导致我的应用程序无法在 XP Window 计算机上启动。到底是怎么回事?


XamlParseException是应用程序启动时出现问题时发生的一般错误。我建议您修改应用程序启动代码以跟踪实际发生的情况并获取,不仅是 XamlParseException,而且还包括内部异常,这应该可以帮助您确定问题的根源。这是一个例子:

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            // hook on error before app really starts
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            base.OnStartup(e);
        }

        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            // put your tracing or logging code here (I put a message box as an example)
            MessageBox.Show(e.ExceptionObject.ToString());
        }
    }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

.NET 应用程序无法启动和接收 XamlParseException 的相关文章

  • 实体框架一对多关系

    我的 EF 查询大约需要 3 秒才能获取 10 个玩家 因为它获取另一个表的所有 500k 行 而不是我需要的少数行 这是玩家实体 namespace RocketLeagueStats Database Entities Table pl
  • __libc_start_main 发生了什么?

    我真的很想理解从高级代码到可执行文件的步骤 但是遇到了一些困难 我写了一个空的int main C 文件并尝试通过以下方式破译反汇编objdump d 这是发生的事情 in start 设置对齐方式 将参数压入堆栈 调用 libc star
  • C# 中的 DateTime.Parse 抛出异常

    我不知道为什么抛出异常 这是工作代码 DateTime Parse 1 12 2012 12 00 00 AM 这是抛出异常的一个 DateTime Parse 1 13 2012 12 00 00 AM 抛出的异常是 格式异常 包括此消息
  • CRTP 能否完全取代小型设计的虚拟功能?

    Is CRTP http en wikipedia org wiki Curiously recurring template pattern有足够的能力智胜virtual功能齐全 我认为 CRTP 的唯一缺点是为每个重复模式生成大量代码
  • 如何使构造函数只能由基类访问?

    如果我想要一个只能从子类访问的构造函数 我可以使用protected构造函数中的关键字 现在我想要相反的 我的子类应该有一个构造函数 该构造函数可以由其基类访问 但不能从任何其他类访问 这可能吗 这是我当前的代码 问题是子类有一个公共构造函
  • 通知另一个线程数据可用的最快方法是什么?有什么替代旋转的方法吗?

    我的一个线程将数据写入循环缓冲区 另一个线程需要尽快处理该数据 我本来想写这么简单的spin 伪代码 while true while a i do nothing just keep checking over and over proc
  • g++.exe 和 x86_64-w64-mingw32-g++.exe 有什么区别?

    同样的问题也适用于 gcc ar 等 在 Code Blocks 中将工具链可执行文件从 Something exe 更改为 x86 64 w64 mingw32 something exe 时 代码仍然可以完美编译 此外 32 位和 64
  • C 或 C++ 中是否有轻量级的多部分/表单数据解析器? [关闭]

    Closed 此问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我正在考虑将多部分表单数据解析集成到 Web 服务器模块中 以便可以减轻后端 Web 应用程序 通常用动
  • 类模板的可变参数构造函数模板的特化

    这是一个带有可变参数构造函数的类 它专门用于从临时对象进行复制和移动 template
  • 恢复多个监视器的窗口大小/位置

    许多帖子都涉及恢复 WinForm 位置和大小 例子 www stackoverflow com questions 92540 save and restore form position and size http www stacko
  • 将迭代器取消引用到临时范围时出现非指针操作数错误

    Using auto empty line auto str return str size 0 我们做得到 auto line range with first non empty ranges view drop while range
  • 如何找到 QDockWidget 标题栏的高度?

    我正在尝试找到 a 的高度QDockWidget标题栏 以便对自定义布局进行一些智能调整大小 但标题栏不是单独的小部件 它内置于停靠小部件的私有布局中 并且没有成员可以访问它 还有其他方法可以找到它的高度吗 是的 您可以使用以下命令找到标题
  • 如何为用户提供给定 boost::spirit 语法的自动完成建议?

    我正在使用 Boost Spirit 在我的 C GUI 应用程序中为非技术用户构建简单的 数据过滤器 语言 语言与纯英语非常相似 并且可以解析为 AST 我被要求使该过程尽可能对用户友好 因此我希望提供类似 CLang 的错误消息 无法识
  • 策略模式的现实示例

    我一直在读关于OCP原理 http en wikipedia org wiki Open closed principle以及如何使用策略模式来实现这一目标 我打算尝试向几个人解释这一点 但我能想到的唯一例子是根据 订单 的状态使用不同的验
  • 在javascript中调用c#函数[重复]

    这个问题在这里已经有答案了 可能的重复 从 Javascript 调用 ASP NET 函数 https stackoverflow com questions 3713 call asp net function from javascr
  • gcc总是做这种优化吗? (公共子表达式消除)

    作为示例 假设表达式sys gt pot atoms item gt P kind mass在循环内求值 循环只改变item 因此表达式可以简化为atoms item gt P kind mass通过将变量定义为atoms sys gt p
  • 从原始 URL 获取重定向 URL

    我的数据库中有一个表 其中包含一些网站的 URL 我必须打开这些 URL 并验证这些页面上的一些链接 问题是某些 URL 被重定向到其他 URL 对于这样的 URL 我的逻辑是失败的 有什么方法可以传递原始 URL 字符串并获取重定向的 U
  • 如何检查多个变量是否等于同一值?

    如何比较多个项目 例如 我希望检查所有变量 A B 和 C 是否都等于字符 X 或所有三个变量都等于 O 如果其中 2 个为 X 1 个为 O 则应返回 false I tried if A B C X A B C O Do whateve
  • C 警告函数调用中缺少标记

    这是我的警告 Missing sentinel in function call 我怎样才能删除它 我正在使用 linux 和 gcc 编译器 看来您可能没有终止数组声明NULL 如果没有 null 您可能会遇到一些内存怪异 因为运行时将不
  • C# 泛型中的通配符等效项

    假设我有一个通用类 如下所示 public class GeneralPropertyMap

随机推荐