diff options
author | Jb Evain <jb@evain.net> | 2017-09-08 20:58:17 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-10-05 01:38:19 +0300 |
commit | 1ae1bc6321b402026964c4030830983c6dfaac62 (patch) | |
tree | 515656230283ad3aea260ce90bf5d853a8acb605 | |
parent | 9e694bb98def5b4e1db2250b14b4a602acf1e573 (diff) |
Avoid exception in GetSequencePointMapping when a pdb has multiple sequence points for the same offset. Fix #425
-rw-r--r-- | Mono.Cecil.Cil/Symbols.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Mono.Cecil.Cil/Symbols.cs b/Mono.Cecil.Cil/Symbols.cs index 6ef5ad2..85c5334 100644 --- a/Mono.Cecil.Cil/Symbols.cs +++ b/Mono.Cecil.Cil/Symbols.cs @@ -671,8 +671,10 @@ namespace Mono.Cecil.Cil { var offset_mapping = new Dictionary<int, SequencePoint> (sequence_points.Count); - for (int i = 0; i < sequence_points.Count; i++) - offset_mapping.Add (sequence_points [i].Offset, sequence_points [i]); + for (int i = 0; i < sequence_points.Count; i++) { + if (!offset_mapping.ContainsKey (sequence_points [i].Offset)) + offset_mapping.Add (sequence_points [i].Offset, sequence_points [i]); + } var instructions = method.Body.Instructions; |