开发平台:Win7 + Vs2010 (WFP .Net4)

安装平台:WinXpSp3

长话短说,昨天在进行一个WPF程序的安装时,发生一个很麻烦的错误,具体表现为:打开这个软件就直接报错,报错界面如下:

到事件查看器里面,看到2条错误,分别是:

.NET Runtime

事件类型:    错误
事件来源:    .NET Runtime
事件种类:    无
事件 ID:    1026
日期:        2012/05/31
事件:        8:08:03
用户:        N/A
计算机:    LWS-12
描述:
应用程序: RepairPartsScreen.exe
Framework 版本: v4.0.30319
说明: 由于未经处理的异常,进程终止。
异常信息: 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)在 RepairPartsScreen.App.Main()有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持中心。

.NET Runtime 4.0 Error Reporting

事件类型:    错误
事件来源:    .NET Runtime 4.0 Error Reporting
事件种类:    无
事件 ID:    5000
日期:        2012/05/31
事件:        8:07:59
用户:        N/A
计算机:    LWS-12
描述:
EventType clr20r3, P1 repairpartsscreen.exe, P2 1.0.0.0, P3 4fc5e671, P4 presentationframework, P5 4.0.0.0, P6 4ba1f8db, P7 78ff, P8 0, P9 system.windows.markup.xamlparse, P10 NIL.有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持中心。
数据:
0000: 63 00 6c 00 72 00 32 00   c.l.r.2.
0008: 30 00 72 00 33 00 2c 00   0.r.3.,.
0010: 20 00 72 00 65 00 70 00    .r.e.p.
0018: 61 00 69 00 72 00 70 00   a.i.r.p.
0020: 61 00 72 00 74 00 73 00   a.r.t.s.
0028: 73 00 63 00 72 00 65 00   s.c.r.e.
0030: 65 00 6e 00 2e 00 65 00   e.n...e.
0038: 78 00 65 00 2c 00 20 00   x.e.,. .
0040: 31 00 2e 00 30 00 2e 00   1...0...
0048: 30 00 2e 00 30 00 2c 00   0...0.,.
0050: 20 00 34 00 66 00 63 00    .4.f.c.
0058: 35 00 65 00 36 00 37 00   5.e.6.7.
0060: 31 00 2c 00 20 00 70 00   1.,. .p.
0068: 72 00 65 00 73 00 65 00   r.e.s.e.
0070: 6e 00 74 00 61 00 74 00   n.t.a.t.
0078: 69 00 6f 00 6e 00 66 00   i.o.n.f.
0080: 72 00 61 00 6d 00 65 00   r.a.m.e.
0088: 77 00 6f 00 72 00 6b 00   w.o.r.k.
0090: 2c 00 20 00 34 00 2e 00   ,. .4...
0098: 30 00 2e 00 30 00 2e 00   0...0...
00a0: 30 00 2c 00 20 00 34 00   0.,. .4.
00a8: 62 00 61 00 31 00 66 00   b.a.1.f.
00b0: 38 00 64 00 62 00 2c 00   8.d.b.,.
00b8: 20 00 37 00 38 00 66 00    .7.8.f.
00c0: 66 00 2c 00 20 00 30 00   f.,. .0.
00c8: 2c 00 20 00 73 00 79 00   ,. .s.y.
00d0: 73 00 74 00 65 00 6d 00   s.t.e.m.
00d8: 2e 00 77 00 69 00 6e 00   ..w.i.n.
00e0: 64 00 6f 00 77 00 73 00   d.o.w.s.
00e8: 2e 00 6d 00 61 00 72 00   ..m.a.r.
00f0: 6b 00 75 00 70 00 2e 00   k.u.p...
00f8: 78 00 61 00 6d 00 6c 00   x.a.m.l.
0100: 70 00 61 00 72 00 73 00   p.a.r.s.
0108: 65 00 20 00 4e 00 49 00   e. .N.I.
0110: 4c 00 0d 00 0a 00         L.....  

上面的报错信息除了 System.Windows.Markup.XamlParseException 外,基本无用

但可以判断为软件在窗口的Loaded前就挂了,因为没有任何异常被抛出。

找了一上午,终于发现有人有类似的问题:http://social.msdn.microsoft.com/Forums/zh-CN/wpf/thread/cfa1a133-3424-4fc6-b523-7a4cea5f8f3b

也就是说,因为我用了WinXP不支持的256×256大小的ico,造成窗口在初始化时,在读取资源时失败。

对应方法是把ico的大小改为96×96就行了,换句话说,256×256的ICO还是不要用了

原文如下

I've had this error message appear when running certain WPF applications running XP sp3.

The fix in my case was to check the icon (.ico) files being used by any of your windows in your application.It turned out that having a 256 * 256 32bit png image in the icon file used by the application window was causing the problem. Deleting that image, leaving the other icon types solved the problem.

转载于:https://www.cnblogs.com/LancerLiu/archive/2012/05/31/2528104.html

WinXP下由于图标造成的System.Windows.Markup.XamlParseException相关推荐

  1. 关于WPF 中 “System.Windows.Markup.XamlParseException”类型的未经处理的异常在 PresentationFramework.dll 中发生 异常的处理。

    关于WPF 中 "System.Windows.Markup.XamlParseException"类型的未经处理的异常在 PresentationFramework.dll 中发 ...

  2. WPF运行报错System.Windows.Markup.XamlParseException:““在“System.Windows.StaticResourceExtension”

    报错信息 System.Windows.Markup.XamlParseException:""在"System.Windows.StaticResourceExtens ...

  3. System.Windows.Markup.XamlParseException:““在“System.Windows.StaticResourceExtension”上提供值时引发了异常

    在写WPF程序时,出现了以下错误,看错误名,应该是xaml的解释器未找到StaticResourceExtension的资源,后来参考文章:https://muzizongheng.blog.csdn ...

  4. System.Windows.Markup.XamlParseException:““无法从文本“pack://application:,,,/Resources/images/Picture.jpg

    问题描述 切换到.net Core 3.1后突然资源字典里面图片资源报错找不到(其他资源没有试不确定),并且确定Pack_url格式一定正确,找不到错误的原因.而使用.net 4.7.2就正常. 解决 ...

  5. win10在主题下桌面图标设置时提示windows无法访问指定设备、路径或文件问题的解决方法

    win10在主题->桌面图标设置时提示:'windows无法访问指定设备.路径或文件'问题的解决方法. 问题: 心血来潮想整理下桌面图标点开 个性化>主题>桌面图标显示,发现系统提示 ...

  6. System.Timers.Timer与System.Windows.Forms.Timer 区别

    根据msdn解释:System.Threading.Timer 是一个简单的轻量计时器,它使用回调方法并由线程池线程提供服务. 不建议将其用于 Windows 窗体,因为其回调不在用户界面线程上进行. ...

  7. System.Windows.Forms命名空间的MessageBox.show()用法大全

    摘要:     //     显示消息窗口(也称为对话框)向用户展示消息. 这是一个模式窗口,可阻止应用程序中的其他操作,直到用户将其关闭. System.Windows.Forms.MessageB ...

  8. System.IO.Directory.GetCurrentDirectory与System.Windows.Forms.Application.StartupPath的用法

    .Net Framework中System.IO.Directory.GetCurrentDirectory()方法用于获得应用程序当前工作目录.如果使用此方法获得应用程序所在的目录,应该注意:Sys ...

  9. System.Windows.Forms.ListView : Control

    #region 程序集 System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...

最新文章

  1. xcode 8   去除无用打印信息
  2. java有参数 无参数方法
  3. 判别器loss为0_TensorFlow v2.0实现逻辑斯谛回归
  4. php模板初级教程,风格模板初级不完全修改教程
  5. 检测网络是否稳定的计算机命令,如何查看自己的网络是否稳定
  6. oracle 测试sql执行时间_从 TPCH 测试学习性能优化技巧
  7. Python中的原始字符串
  8. 收藏! | 入门必读:计算机视觉四大基本任务(分类、定位、检测、分割)
  9. 浙大计算机学院陈越老师,浙江大学计算机科学与技术学院导师介绍 陈越
  10. opencv学习——翻转摄像头
  11. 微信用户扫码登录和登录退出的业务逻辑实现(java版)
  12. Grammarly:最优秀的日常英文写作辅助工具——论文英文校验
  13. RocketMq部署与使用
  14. LintCode 1144.范围加法之二
  15. vscode怎样设置成中文
  16. robotframework报错
  17. Python实现群发邮件
  18. hellojs使用 推特登录/api nuxt vue
  19. Bootstrap导航栏下拉菜单不生效的问题
  20. 32 位 ARM® Cortex®-M0+内核 单片机

热门文章

  1. G power计算样本量——混合实验设计
  2. 为文本文档 设置 快捷键
  3. mysql中如何获取交集
  4. 我的项目-2020-2021
  5. 一篇文章畅游在C语言基础知识学习的海洋中(持续更新中……)
  6. 在GPU云服务器中部署Stable Diffusion web UI
  7. 基于不均匀光照下的颜色校正——retinex算法,通态滤波算法
  8. Vue项目搭建时npm install出现npm ERR code 1报错
  9. html练习题及答案文库,HTML_XML与网页制作测试题及答案电子教案.doc
  10. 这个900度近视画家笔下的“神秘女子”,会让你分不清照片和画作!