【发布时间】:2016-08-12 14:31:04
【问题描述】:
所以我有 2 个项目的这个解决方案。我将整个解决方案从运行良好的笔记本电脑转移到出现此错误的 PC:
System.InvalidProgramException 未处理 HResult=-2146233030
Message=JIT 编译器遇到内部限制。
来源=RestSharp StackTrace: 在 RestSharp.Deserializers.XmlDeserializer.GetElementByName(XElement 根,XName 名称) 在 RestSharp.Deserializers.XmlDeserializer.GetValueFromXml(XElement 根, XName 名称,PropertyInfo 道具) 在 RestSharp.Deserializers.XmlAttributeDeserializer.GetValueFromXml(XElement 根、XName 名称、PropertyInfo 属性) 在 RestSharp.Deserializers.XmlDeserializer.Map(对象 x,XElement 根) 在 RestSharp.Deserializers.XmlDeserializer.Deserialize[T](IRestResponse 回复) 在 WolframAlphaNET.WolframAlpha.GetResponse[T](RestRequest request) 中 i:\VS_Projects_Shared\CCProject\WolframAlpha.NET\WolframAlpha.cs:line 390 在 i:\VS_Projects_Shared\CCProject\WolframAlpha.NET\WolframAlpha.cs:line 中的 WolframAlphaNET.WolframAlpha.Query(字符串查询) 374 在 CCProject.Search.button1_Click(Object sender, EventArgs e) 中 i:\VS_Projects_Shared\CCProject\CCProject\Search.cs:第 54 行 在 System.Windows.Forms.Control.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs 事件) 在 System.Windows.Forms.Control.WmMouseUp(消息和 m,MouseButtons 按钮,Int32 点击) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 System.Windows.Forms.ButtonBase.WndProc(消息和 m) 在 System.Windows.Forms.Button.WndProc(消息和 m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam) 在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(味精和味精) 在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 原因, Int32 pvLoopData) 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 原因,ApplicationContext 上下文) 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 原因,ApplicationContext 上下文) 在 System.Windows.Forms.Application.RunDialog(窗体) 在 System.Windows.Forms.Form.ShowDialog(IWin32Window 所有者) 在 System.Windows.Forms.Form.ShowDialog() 在 CCProject.Form1.button2_Click(Object sender, EventArgs e) 中 我:\VS_Projects_Shared\CCProject\CCProject\Form1.cs:第 97 行 在 System.Windows.Forms.Control.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs 事件) 在 System.Windows.Forms.Control.WmMouseUp(消息和 m,MouseButtons 按钮,Int32 点击) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 System.Windows.Forms.ButtonBase.WndProc(消息和 m) 在 System.Windows.Forms.Button.WndProc(消息和 m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam) 在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(味精和味精) 在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 原因, Int32 pvLoopData) 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 原因,ApplicationContext 上下文) 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 原因,ApplicationContext 上下文) 在 System.Windows.Forms.Application.Run(窗体 mainForm) 在 i:\VS_Projects_Shared\CCProject\CCProject\Program.cs:line 19 中的 CCProject.Program.Main() 在 System.AppDomain._nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数) 在 System.AppDomain.nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数) 在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,String [] args) 在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext、ContextCallback 回调、对象状态、布尔值 保留SyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback 回调, 对象状态, Boolean 保留SyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态) 在 System.Threading.ThreadHelper.ThreadStart() InnerException:
这行代码是 WolframAlpha.NET 的一部分 https://github.com/Genbox/WolframAlpha.NET:
private T GetResponse<T>(RestRequest request)
{
RestResponse response = (RestResponse)_client.Execute(request);
XmlAttributeDeserializer deserializer = new XmlAttributeDeserializer();
T results = deserializer.Deserialize<T>(response); //this line
return results;
}
以下是 PEVerify.exe 结果:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 工具>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\CalorieCounter.exe
Microsoft (R) .NET Framework PE 验证程序。版本 4.0.30319.33440 版权所有 (c) 微软公司。保留所有权利。
所有类和方法 我:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\C alorieCounter.exe 已验证。
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 工具>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\CalorieCounter.exe /md /il
Microsoft (R) .NET Framework PE 验证程序。版本 4.0.30319.33440 版权所有 (c) 微软公司。保留所有权利。
所有类和方法 我:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\C alorieCounter.exe 已验证。
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 工具>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\WolframAlpha.NET.dll
Microsoft (R) .NET Framework PE 验证程序。版本 4.0.30319.33440 版权所有 (c) 微软公司。保留所有权利。
所有类和方法 我:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\W olframAlpha.NET.dll 已验证。
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 工具>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\RestSharp.dll
Microsoft (R) .NET Framework PE 验证程序。版本 4.0.30319.33440 版权所有 (c) 微软公司。保留所有权利。
所有类和方法 我:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\R estSharp.dll 已验证。
【问题讨论】:
-
您只能移动源代码,然后重新创建解决方案,甚至是项目。这应该有效。
-
HRESULT 映射到以下 Win32 API 错误代码:
COR_E_INVALIDPROGRAM: A program contained invalid IL or bad metadata. Usually this is a compiler bug.您是否在 PC 和笔记本电脑上使用相同版本的 .NET Framework?编译器在 4.5 和 4.6.1 afaik 之间发生了变化。 -
@toadflakz 我从未安装过 4.6。我在 PC 和笔记本电脑上都只有 4.5.1
标签: c# visual-studio restsharp