diff options
author | Jb Evain <jb@evain.net> | 2017-11-17 02:37:22 +0300 |
---|---|---|
committer | Jb Evain <jb@evain.net> | 2017-11-17 02:37:22 +0300 |
commit | 0ef6b79e12b97bea36d12eb5700d0677148a2369 (patch) | |
tree | eb3f3a1787a6e44e5e96328252a9750304088b8f /Mono.Cecil.Cil/CodeReader.cs | |
parent | 1e47c7a228b081aec1e9db02f0433a97ca7b407b (diff) |
Fix #461: wrong StateMachineScopeDebugInformation API
Diffstat (limited to 'Mono.Cecil.Cil/CodeReader.cs')
-rw-r--r-- | Mono.Cecil.Cil/CodeReader.cs | 15 |
1 files changed, 10 insertions, 5 deletions
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 () |