From fe8b5a079fa22e1b6a98cb1971ea5f351a725a31 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Fri, 2 Oct 2020 22:05:22 +0200 Subject: [PATCH] Add failing test for #694 --- Test/Mono.Cecil.Tests/PortablePdbTests.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Test/Mono.Cecil.Tests/PortablePdbTests.cs b/Test/Mono.Cecil.Tests/PortablePdbTests.cs index 45b0333f1..61847817b 100644 --- a/Test/Mono.Cecil.Tests/PortablePdbTests.cs +++ b/Test/Mono.Cecil.Tests/PortablePdbTests.cs @@ -770,5 +770,27 @@ public void LoadPdbOnDemand () Assert.AreEqual (9, debug_info.SequencePoints.Count); } + [Test] + public void ClearSequencePoints () + { + TestPortablePdbModule (module => { + var type = module.GetType ("PdbTarget.Program"); + var main = type.GetMethod ("Main"); + + main.DebugInformation.SequencePoints.Clear (); + + var destination = Path.Combine (Path.GetTempPath (), "mylib.dll"); + module.Write(destination, new WriterParameters { WriteSymbols = true }); + + Assert.Zero (main.DebugInformation.SequencePoints.Count); + + using (var resultModule = ModuleDefinition.ReadModule (destination, new ReaderParameters { ReadSymbols = true })) { + type = resultModule.GetType ("PdbTarget.Program"); + main = type.GetMethod ("Main"); + + Assert.Zero (main.DebugInformation.SequencePoints.Count); + } + }); + } } }