Skip to content

Commit 21de57b

Browse files
author
David Karlaš
committed
Fix throwing exception in case of scopeIndex 0
1 parent b719660 commit 21de57b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Mono.Debugging.Soft/SoftDebuggerAdaptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ static string GetHoistedIteratorLocalName (FieldInfoMirror field, SoftEvaluation
722722
var i = field.Name.IndexOf (">__", StringComparison.Ordinal);
723723
if (i != -1 && field.VirtualMachine.Version.AtLeast (2, 43)) {
724724
int scopeIndex;
725-
if (int.TryParse (field.Name.Substring (i + 3), out scopeIndex)) {
725+
if (int.TryParse (field.Name.Substring (i + 3), out scopeIndex) && scopeIndex > 0) {//0 means whole method scope
726726
scopeIndex--;//Scope index is 1 based(not zero)
727727
var scopes = cx.Frame.Method.GetScopes ();
728728
if (scopeIndex < scopes.Length) {

0 commit comments

Comments
 (0)