From a1105a49ada467404f8bc0436cb84a0ab36ef4c4 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Tue, 13 Oct 2020 20:45:52 +0200 Subject: [PATCH] Add failing test for #694 (#695) Co-authored-by: Jb Evain --- Test/Mono.Cecil.Tests/PortablePdbTests.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Test/Mono.Cecil.Tests/PortablePdbTests.cs b/Test/Mono.Cecil.Tests/PortablePdbTests.cs index fe60dc82a..fc0516e7c 100644 --- a/Test/Mono.Cecil.Tests/PortablePdbTests.cs +++ b/Test/Mono.Cecil.Tests/PortablePdbTests.cs @@ -748,5 +748,28 @@ public void DoubleWriteAndReadAgainModuleWithDeterministicMvid () Assert.AreNotEqual (mvid1_in, mvid2_in); Assert.AreNotEqual (mvid1_out, mvid2_out); } + + [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); + } + }); + } } }