0

so I have this solution with 2 projects. I transferred whole solution from my laptop, where it works fine, to my PC where I get this error:

System.InvalidProgramException was unhandled HResult=-2146233030
Message=JIT Compiler encountered an internal limitation.
Source=RestSharp StackTrace: at RestSharp.Deserializers.XmlDeserializer.GetElementByName(XElement root, XName name) at RestSharp.Deserializers.XmlDeserializer.GetValueFromXml(XElement root, XName name, PropertyInfo prop) at RestSharp.Deserializers.XmlAttributeDeserializer.GetValueFromXml(XElement root, XName name, PropertyInfo prop) at RestSharp.Deserializers.XmlDeserializer.Map(Object x, XElement root) at RestSharp.Deserializers.XmlDeserializer.Deserialize[T](IRestResponse response) at WolframAlphaNET.WolframAlpha.GetResponse[T](RestRequest request) in i:\VS_Projects_Shared\CCProject\WolframAlpha.NET\WolframAlpha.cs:line 390 at WolframAlphaNET.WolframAlpha.Query(String query) in i:\VS_Projects_Shared\CCProject\WolframAlpha.NET\WolframAlpha.cs:line 374 at CCProject.Search.button1_Click(Object sender, EventArgs e) in i:\VS_Projects_Shared\CCProject\CCProject\Search.cs:line 54 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.RunDialog(Form form) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at System.Windows.Forms.Form.ShowDialog() at CCProject.Form1.button2_Click(Object sender, EventArgs e) in i:\VS_Projects_Shared\CCProject\CCProject\Form1.cs:line 97 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at CCProject.Program.Main() in i:\VS_Projects_Shared\CCProject\CCProject\Program.cs:line 19 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

At this line of code that is part of 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;
    }

Here are PEVerify.exe results:

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\CalorieCounter.exe

Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.33440 Copyright (c) Microsoft Corporation. All rights reserved.

All Classes and Methods in I:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\C alorieCounter.exe Verified.

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\CalorieCounter.exe /md /il

Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.33440 Copyright (c) Microsoft Corporation. All rights reserved.

All Classes and Methods in I:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\C alorieCounter.exe Verified.

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\WolframAlpha.NET.dll

Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.33440 Copyright (c) Microsoft Corporation. All rights reserved.

All Classes and Methods in I:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\W olframAlpha.NET.dll Verified.

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools>PEVerify.exe I:\ VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\RestSharp.dll

Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.33440 Copyright (c) Microsoft Corporation. All rights reserved.

All Classes and Methods in I:\VS_Projects_Shared\CalorieCounter\CalorieCounter\bin\Debug\R estSharp.dll Verified.

  • You can move only the source code, and recreate the solution, even the projects, again. This should work. – meJustAndrew Aug 12 '16 at 14:40
  • That HRESULT maps to the following Win32 API error code: `COR_E_INVALIDPROGRAM: A program contained invalid IL or bad metadata. Usually this is a compiler bug.` Are you using the same version of the .NET Framework on your PC and laptop? The compiler changed between 4.5 and 4.6.1 afaik. – toadflakz Aug 12 '16 at 14:52
  • @toadflakz I never installed 4.6. I only have up to 4.5.1 on both PC and Laptop – OuttaControl Aug 12 '16 at 16:41

1 Answers1

0

The error InvalidProgramException is thrown when the translated Microsoft intermediate language (MSIL) instructions contain invalid commands. Because of the invalid or corrupt MSIL instructions the just-in-time (JIT) compiler can no longer continue to compile the MSIL instructions, and the JIT compiler throws the InvalidProgramException. For more information look here. This may mean that the translated file (EXE or DLL) containing the GetResponse() function has become corrupt, and needs to be re-translated. The two other possibility are that your MSIL translator on your PC has a bug, or the .NET Framework JIT compiler bundled into the EXE or DLL has a bug. You can find out the exact problem by running the PEverify tool to verify the MSIL code in your EXE or DLL. On the information page linked above follow the instructions in "How to troubleshoot the InvalidProgramException exception". After running PEverify, please add the result to the end of your question.

[Edit]

I have been looking around for other solutions to your problem. One solution I found is to change your Intellisense settings to "Show Events Only" or completely off. I do not know why this works, but it has been reported as a solution.

Community
  • 1
  • 1
  • It says file not found or has bad headers o.O both on laptop and PC, it doesn't matter what PEVerify.exe i use(v8.0, v8.1A) and no what ever file i chose to verify, any exe or dll says same error. – OuttaControl Aug 12 '16 at 15:46
  • Please post the full results of the PEverify tool to the end of your question. We will need to know the specific error codes involved. Also include the command that you used. For example: ...NETFX 4.6.1 Tools> PEVerify.exe "C:\Users\[User Name]\Documents\Visual Studio 2015\Projects\Test\Test\bin\Debug\Test.exe" – Konnor Andrews Aug 12 '16 at 16:02
  • There added results to question, all verified ok – OuttaControl Aug 12 '16 at 16:40