Skip to content

Commit 04c85ad

Browse files
committed
Proper handling waiting thread state in evaluation Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=1637
1 parent 1e2d251 commit 04c85ad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Mono.Debugging.Soft/SoftEvaluationContext.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
using Mono.Debugger.Soft;
3030
using DC = Mono.Debugging.Client;
3131
using System.Runtime.CompilerServices;
32+
using System.Threading;
3233

3334
namespace Mono.Debugging.Soft
3435
{
@@ -184,7 +185,11 @@ Value RuntimeInvoke (MethodMirror method, object target, Value[] values, bool en
184185
return method.Evaluate (target is TypeMirror ? null : (Value) target, values);
185186
} catch (NotSupportedException) {
186187
AssertTargetInvokeAllowed ();
187-
188+
var threadState = Thread.ThreadState;
189+
if (threadState == ThreadState.WaitSleepJoin) {
190+
DC.DebuggerLoggingService.LogMessage ("Thread state before evaluation is {0}", threadState);
191+
throw new EvaluatorException ("Evaluation is not allowed when the thread is in 'Wait' state");
192+
}
188193
var mc = new MethodCall (this, method, target, values, enableOutArgs);
189194
//Since runtime is returning NOT_SUSPENDED error if two methods invokes are executed
190195
//at same time we have to lock invoking to prevent this...

0 commit comments

Comments
 (0)