diff options
author | Marek Safar <marek.safar@gmail.com> | 2022-10-06 14:06:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-06 14:06:59 +0300 |
commit | 1a88006d339e21a684b28efc62fe7b587b464fc3 (patch) | |
tree | cda666d27eb727e45cfbff127e2b06d9156050ca /Test/Mono.Cecil.Tests | |
parent | 1840b7410d37a613e684b6f9650e39e2d4950bbb (diff) | |
parent | 186a05b95879dd6f546bf2e21aaa54680d3d4711 (diff) |
Merge pull request #38 from marek-safar/sync
Diffstat (limited to 'Test/Mono.Cecil.Tests')
-rw-r--r-- | Test/Mono.Cecil.Tests/ILProcessorTests.cs | 3 | ||||
-rw-r--r-- | Test/Mono.Cecil.Tests/PortablePdbTests.cs | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Test/Mono.Cecil.Tests/ILProcessorTests.cs b/Test/Mono.Cecil.Tests/ILProcessorTests.cs index 09b17a6..fd462c3 100644 --- a/Test/Mono.Cecil.Tests/ILProcessorTests.cs +++ b/Test/Mono.Cecil.Tests/ILProcessorTests.cs @@ -470,7 +470,8 @@ namespace Mono.Cecil.Tests { }; // For some reason the Native PDB reader/writer store the custom info on the method.DebugInfo.CustomInfo, while portable PDB stores it on method.CustomInfo. - var customDebugInfo = roundtripType == RoundtripType.Pdb ? method.DebugInformation.CustomDebugInformations : method.CustomDebugInformations; + var customDebugInfo = (roundtripType == RoundtripType.Pdb && Platform.HasNativePdbSupport) + ? method.DebugInformation.CustomDebugInformations : method.CustomDebugInformations; customDebugInfo.Add (new StateMachineScopeDebugInformation () { Scopes = { new StateMachineScope(instructions[1], instructions[6]) diff --git a/Test/Mono.Cecil.Tests/PortablePdbTests.cs b/Test/Mono.Cecil.Tests/PortablePdbTests.cs index 3aa0ffc..a89f79d 100644 --- a/Test/Mono.Cecil.Tests/PortablePdbTests.cs +++ b/Test/Mono.Cecil.Tests/PortablePdbTests.cs @@ -454,6 +454,23 @@ namespace Mono.Cecil.Tests { } [Test] + public void NullGenericInstConstant () + { + TestModule ("NullConst.dll", module => { + var type = module.GetType ("NullConst.Program"); + var method = type.GetMethod ("MakeConst"); + var symbol = method.DebugInformation; + + Assert.IsNotNull (symbol); + Assert.AreEqual (1, symbol.Scope.Constants.Count); + + var a = symbol.Scope.Constants [0]; + Assert.AreEqual ("thing", a.Name); + Assert.AreEqual (null, a.Value); + }, verify: false, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider)); + } + + [Test] public void InvalidConstantRecord () { using (var module = GetResourceModule ("mylib.dll", new ReaderParameters { SymbolReaderProvider = new PortablePdbReaderProvider () })) { |