diff --git a/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/AssemblyReader.cs index d18a51ed0..2a593587c 100644 --- a/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/AssemblyReader.cs @@ -3013,7 +3013,7 @@ ConstantDebugInformation ReadLocalConstant (uint rid) value = new decimal (signature.ReadInt32 (), signature.ReadInt32 (), signature.ReadInt32 (), (b & 0x80) != 0, (byte) (b & 0x7f)); } else if (type.IsTypeOf ("System", "DateTime")) { value = new DateTime (signature.ReadInt64()); - } else if (type.etype == ElementType.Object || type.etype == ElementType.None || type.etype == ElementType.Class || type.etype == ElementType.Array) { + } else if (type.etype == ElementType.Object || type.etype == ElementType.None || type.etype == ElementType.Class || type.etype == ElementType.Array || type.etype == ElementType.GenericInst) { value = null; } else value = signature.ReadConstantSignature (type.etype); diff --git a/Test/Mono.Cecil.Tests/PortablePdbTests.cs b/Test/Mono.Cecil.Tests/PortablePdbTests.cs index fc0516e7c..b0c1f3238 100644 --- a/Test/Mono.Cecil.Tests/PortablePdbTests.cs +++ b/Test/Mono.Cecil.Tests/PortablePdbTests.cs @@ -456,6 +456,24 @@ public void InvalidConstantRecord () } } + [Test] + public void GenericInstConstantRecord () + { + using (var module = GetResourceModule ("ReproConstGenericInst.dll", new ReaderParameters { SymbolReaderProvider = new PortablePdbReaderProvider () })) { + var type = module.GetType ("ReproConstGenericInst.Program"); + var method = type.GetMethod ("Main"); + var symbol = method.DebugInformation; + + Assert.IsNotNull (symbol); + Assert.AreEqual (1, symbol.Scope.Constants.Count); + + var list = symbol.Scope.Constants [0]; + Assert.AreEqual ("list", list.Name); + + Assert.AreEqual ("System.Collections.Generic.List`1", list.ConstantType.FullName); + } + } + [Test] public void SourceLink () { diff --git a/Test/Resources/assemblies/ReproConstGenericInst.dll b/Test/Resources/assemblies/ReproConstGenericInst.dll new file mode 100644 index 000000000..4fce084b5 Binary files /dev/null and b/Test/Resources/assemblies/ReproConstGenericInst.dll differ diff --git a/Test/Resources/assemblies/ReproConstGenericInst.pdb b/Test/Resources/assemblies/ReproConstGenericInst.pdb new file mode 100644 index 000000000..7e564b5cd Binary files /dev/null and b/Test/Resources/assemblies/ReproConstGenericInst.pdb differ