【问题标题】:Strange error I cannot track down. C# .Net 4.0 Client Profile WIndows XP我无法追踪的奇怪错误。 C# .Net 4.0 客户端配置文件 Windows XP
【发布时间】:2013-07-22 18:32:05
【问题描述】:

当我尝试在 Windows XP 系统上加载 Windows 窗体应用程序时,我收到以下错误,该错误在 ThreadExceptionEventArgs 事件中捕获。 此表单在 Windows 7 PC 上运行良好,并使用 .Net 4.0 Client Profile 编写。 C# 只是为了在表单显示在屏幕上之前澄清这个错误。几天来我一直试图追踪这个问题,但我似乎无法弄清楚。我确实验证了 XP 机器上确实安装了 .net 4.0 客户端配置文件。关于 XP 和 .net 4.0 是否还有其他问题? 这是我的用法

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Outlook = Microsoft.Office.Interop.Outlook;

这是堆栈跟踪报告

错误消息:调用的目标已抛出异常。 System.RuntimeMethodHandle._SerializationInvoke 的堆栈跟踪(IRuntimeMethodInfo 方法,对象目标,SignatureStruct& declaringTypeSig,SerializationInfo 信息,StreamingContext 上下文) 在 System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(对象 obj,SerializationInfo 信息,StreamingContext 上下文) 在 System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder 持有人) 在 System.Runtime.Serialization.ObjectManager.DoFixups() 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler 处理程序,__BinaryParser serParser,布尔 fCheck,布尔 isCrossAppDomain,IMethodCallMessage methodCallMessage) 在 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(流序列化流,HeaderHandler 处理程序,布尔 fCheck,布尔 isCrossAppDomain,IMethodCallMessage methodCallMessage) 在 System.Resources.ResourceReader.DeserializeObject(Int32 typeIndex) 在 System.Resources.ResourceReader._LoadObjectV2(Int32 pos,ResourceTypeCode& typeCode) 在 System.Resources.ResourceReader.LoadObjectV2(Int32 pos,ResourceTypeCode& typeCode) 在 System.Resources.ResourceReader.LoadObject(Int32 pos, ResourceTypeCode& typeCode) 在 System.Resources.RuntimeResourceSet.GetObject(字符串键,布尔忽略大小写,布尔 isString) 在 System.Resources.RuntimeResourceSet.GetObject(字符串键,布尔忽略大小写) 在 System.Resources.ResourceManager.GetObject(字符串名称,CultureInfo 文化,布尔值 wrapUnmanagedMemStream) 在 System.Resources.ResourceManager.GetObject(字符串名称) 在 HostedVoiceContract.Form1.InitializeComponent() 在 HostedVoiceContract.Form1..ctor() 在 HostedVoiceContract.Program.Main() 源mscorlib

内部异常:System.ComponentModel.Win32Exception (0x80004005):参数不正确 在 System.Drawing.Icon.Initialize(Int32 宽度,Int32 高度) 在 System.Drawing.Icon..ctor(SerializationInfo 信息,StreamingContext 上下文) 目标 SiteVoid _SerializationInvoke(System.IRuntimeMethodInfo, System.Object, System.SignatureStruct ByRef, System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)

【问题讨论】:

    标签: winforms c#-4.0 .net-4.0 windows-xp


    【解决方案1】:

    您在表单中使用的图标有问题。通常是 Form.Icon 属性。

    XP 对图标的支持有限,您不能使用在 Vista 及更高版本上工作的那种“花哨”图标。特别是不能大于 256x256,也不能是使用 PNG 图片的那种。

    【讨论】:

    • 图标文件是 256X256 我读过一篇文章,它们不能大于 32x32,但这甚至引起了问题,所以我把它全部删除了。哦,那是一个 ICO 文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多