diff --git a/src/AddIns/Debugger/Debugger.Core/Module.cs b/src/AddIns/Debugger/Debugger.Core/Module.cs index 91290010cf..9de0526c76 100644 --- a/src/AddIns/Debugger/Debugger.Core/Module.cs +++ b/src/AddIns/Debugger/Debugger.Core/Module.cs @@ -5,9 +5,11 @@ // $Revision$ // -using Debugger.Interop; using System; using System.Collections.Generic; +using System.Runtime.InteropServices; + +using Debugger.Interop; using Debugger.Interop.CorDebug; using Debugger.Interop.CorSym; using Debugger.Interop.MetaData; @@ -226,7 +228,16 @@ namespace Debugger this.CorModule2.SetJMCStatus(0, 0, ref unused); return; } - this.CorModule2.SetJMCStatus(1, 0, ref unused); + try { + this.CorModule2.SetJMCStatus(1, 0, ref unused); + } catch (COMException e) { + // Cannot use JMC on this code (likely wrong JIT settings). + if ((uint)e.ErrorCode == 0x80131323) { + process.TraceMessage("Cannot use JMC on this code. Release build?"); + return; + } + throw; + } } public void ApplyChanges(byte[] metadata, byte[] il)