diff options
author | Steve Gilham <SteveGilham@users.noreply.github.com> | 2022-09-30 00:59:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 00:59:52 +0300 |
commit | e052ab52e44fd2a6564964e47e79929068731916 (patch) | |
tree | 66f464d7b2538a0d050c7a5cc4eaff21cc240958 | |
parent | 92f32da3b9516b2610612cd73dfd965f141c5f64 (diff) |
Address issue #873 (#874)
* Address issue #873
* Be explicit as to what we support writing
* Use normal test infrastructure
* Restore writing primitives
* Restore style
* Can't verify .net core assembly
Co-authored-by: Jb Evain <jb@evain.net>
-rw-r--r-- | Mono.Cecil/AssemblyWriter.cs | 1 | ||||
-rw-r--r-- | Test/Mono.Cecil.Tests/PortablePdbTests.cs | 17 | ||||
-rw-r--r-- | Test/Resources/assemblies/NullConst.dll | bin | 0 -> 5120 bytes | |||
-rw-r--r-- | Test/Resources/assemblies/NullConst.pdb | bin | 0 -> 10424 bytes |
4 files changed, 18 insertions, 0 deletions
diff --git a/Mono.Cecil/AssemblyWriter.cs b/Mono.Cecil/AssemblyWriter.cs index 9972c12..df8afdc 100644 --- a/Mono.Cecil/AssemblyWriter.cs +++ b/Mono.Cecil/AssemblyWriter.cs @@ -2192,6 +2192,7 @@ namespace Mono.Cecil { case ElementType.None: case ElementType.Var: case ElementType.MVar: + case ElementType.GenericInst: signature.WriteInt32 (0); break; case ElementType.String: 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 () })) { diff --git a/Test/Resources/assemblies/NullConst.dll b/Test/Resources/assemblies/NullConst.dll Binary files differnew file mode 100644 index 0000000..7c58453 --- /dev/null +++ b/Test/Resources/assemblies/NullConst.dll diff --git a/Test/Resources/assemblies/NullConst.pdb b/Test/Resources/assemblies/NullConst.pdb Binary files differnew file mode 100644 index 0000000..e70f2c2 --- /dev/null +++ b/Test/Resources/assemblies/NullConst.pdb |