Skip to content

Commit e052ab5

Browse files
SteveGilhamjbevain
andauthored
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>
1 parent 92f32da commit e052ab5

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

Mono.Cecil/AssemblyWriter.cs

+1
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,7 @@ SignatureWriter GetConstantSignature (ElementType type, object value)
21922192
case ElementType.None:
21932193
case ElementType.Var:
21942194
case ElementType.MVar:
2195+
case ElementType.GenericInst:
21952196
signature.WriteInt32 (0);
21962197
break;
21972198
case ElementType.String:

Test/Mono.Cecil.Tests/PortablePdbTests.cs

+17
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,23 @@ public void NullClassConstant ()
453453
}, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider));
454454
}
455455

456+
[Test]
457+
public void NullGenericInstConstant ()
458+
{
459+
TestModule ("NullConst.dll", module => {
460+
var type = module.GetType ("NullConst.Program");
461+
var method = type.GetMethod ("MakeConst");
462+
var symbol = method.DebugInformation;
463+
464+
Assert.IsNotNull (symbol);
465+
Assert.AreEqual (1, symbol.Scope.Constants.Count);
466+
467+
var a = symbol.Scope.Constants [0];
468+
Assert.AreEqual ("thing", a.Name);
469+
Assert.AreEqual (null, a.Value);
470+
}, verify: false, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider));
471+
}
472+
456473
[Test]
457474
public void InvalidConstantRecord ()
458475
{
5 KB
Binary file not shown.
10.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)