diff --git a/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/AssemblyReader.cs index b64846368..224d8a869 100644 --- a/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/AssemblyReader.cs @@ -3017,7 +3017,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) { + } else if (type.etype == ElementType.Object || type.etype == ElementType.None || type.etype == ElementType.Class || type.etype == ElementType.Array) { value = null; } else value = signature.ReadConstantSignature (type.etype); diff --git a/Test/Mono.Cecil.Tests/ImageReadTests.cs b/Test/Mono.Cecil.Tests/ImageReadTests.cs index fa5562e90..de7a2ccdd 100644 --- a/Test/Mono.Cecil.Tests/ImageReadTests.cs +++ b/Test/Mono.Cecil.Tests/ImageReadTests.cs @@ -207,6 +207,20 @@ public void Net471TargetingAssembly () }); } + [Test] + public void LocallyScopedConstantArray () + { + TestModule ("LocallyScopedConstantArray.dll", module => { + Assert.IsTrue (module.HasDebugHeader); + var method = module.Types + .Single (x => x.Name == "TestClass") + .Methods + .Single (x => x.Name == "TestMethod"); + var debugInformation = method.DebugInformation; + Assert.IsNull (debugInformation.Scope.Constants.Single ().Value); + }, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider)); + } + [Test] public void ExternalPdbDeterministicAssembly () { diff --git a/Test/Resources/assemblies/LocallyScopedConstantArray.dll b/Test/Resources/assemblies/LocallyScopedConstantArray.dll new file mode 100644 index 000000000..ae5eaf443 Binary files /dev/null and b/Test/Resources/assemblies/LocallyScopedConstantArray.dll differ diff --git a/Test/Resources/assemblies/LocallyScopedConstantArray.pdb b/Test/Resources/assemblies/LocallyScopedConstantArray.pdb new file mode 100644 index 000000000..eea50b965 Binary files /dev/null and b/Test/Resources/assemblies/LocallyScopedConstantArray.pdb differ