diff --git a/src/OpenDebugAD7/AD7DebugSession.cs b/src/OpenDebugAD7/AD7DebugSession.cs index ca16de40e..5496021ef 100644 --- a/src/OpenDebugAD7/AD7DebugSession.cs +++ b/src/OpenDebugAD7/AD7DebugSession.cs @@ -1206,17 +1206,17 @@ protected override void HandleGotoRequestAsync(IRequestResponder return; } - var gotoTarget = m_gotoCodeContexts[responder.Arguments.TargetId]; - IDebugThread2 thread = null; - lock (m_threads) - { - if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread)) - throw new AD7Exception("Could not find thread!"); - } - BeforeContinue(); var builder = new ErrorBuilder(() => AD7Resources.Error_UnableToSetNextStatement); try { + var gotoTarget = m_gotoCodeContexts[responder.Arguments.TargetId]; + IDebugThread2 thread = null; + lock (m_threads) + { + if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread)) + throw new AD7Exception("Unknown thread id: " + responder.Arguments.ThreadId.ToString(CultureInfo.InvariantCulture)); + } + BeforeContinue(); builder.CheckHR(thread.SetNextStatement(null, gotoTarget)); } catch (AD7Exception e) @@ -1258,18 +1258,22 @@ protected override void HandleGotoTargetsRequestAsync(IRequestResponder