From 0ef6b79e12b97bea36d12eb5700d0677148a2369 Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Thu, 16 Nov 2017 15:37:22 -0800 Subject: Fix #461: wrong StateMachineScopeDebugInformation API --- Mono.Cecil.Cil/CodeReader.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Mono.Cecil.Cil/CodeReader.cs') diff --git a/Mono.Cecil.Cil/CodeReader.cs b/Mono.Cecil.Cil/CodeReader.cs index c13db7d..f7f11d5 100644 --- a/Mono.Cecil.Cil/CodeReader.cs +++ b/Mono.Cecil.Cil/CodeReader.cs @@ -416,12 +416,17 @@ namespace Mono.Cecil.Cil { void ReadStateMachineScope (StateMachineScopeDebugInformation state_machine_scope) { - state_machine_scope.start = new InstructionOffset (GetInstruction (state_machine_scope.start.Offset)); + if (state_machine_scope.scopes.IsNullOrEmpty ()) + return; - var end_instruction = GetInstruction (state_machine_scope.end.Offset); - state_machine_scope.end = end_instruction == null - ? new InstructionOffset () - : new InstructionOffset (end_instruction); + foreach (var scope in state_machine_scope.scopes) { + scope.start = new InstructionOffset (GetInstruction (scope.start.Offset)); + + var end_instruction = GetInstruction (scope.end.Offset); + scope.end = end_instruction == null + ? new InstructionOffset () + : new InstructionOffset (end_instruction); + } } void ReadSequencePoints () -- cgit v1.2.3