Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Gilham <SteveGilham@users.noreply.github.com>2022-09-30 00:59:52 +0300
committerGitHub <noreply@github.com>2022-09-30 00:59:52 +0300
commite052ab52e44fd2a6564964e47e79929068731916 (patch)
tree66f464d7b2538a0d050c7a5cc4eaff21cc240958
parent92f32da3b9516b2610612cd73dfd965f141c5f64 (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.cs1
-rw-r--r--Test/Mono.Cecil.Tests/PortablePdbTests.cs17
-rw-r--r--Test/Resources/assemblies/NullConst.dllbin0 -> 5120 bytes
-rw-r--r--Test/Resources/assemblies/NullConst.pdbbin0 -> 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
new file mode 100644
index 0000000..7c58453
--- /dev/null
+++ b/Test/Resources/assemblies/NullConst.dll
Binary files differ
diff --git a/Test/Resources/assemblies/NullConst.pdb b/Test/Resources/assemblies/NullConst.pdb
new file mode 100644
index 0000000..e70f2c2
--- /dev/null
+++ b/Test/Resources/assemblies/NullConst.pdb
Binary files differ