diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs index b4d470505..6c18b8829 100644 --- a/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs +++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs @@ -68,9 +68,9 @@ static Dictionary LoadNameIndex(BitAccess bits, out int age, out Gu BitSet present = new BitSet(bits); BitSet deleted = new BitSet(bits); - if (!deleted.IsEmpty) { - throw new PdbDebugException("Unsupported PDB deleted bitset is not empty."); - } + //if (!deleted.IsEmpty) { + // throw new PdbDebugException("Unsupported PDB deleted bitset is not empty."); + //} int j = 0; for (int i = 0; i < max; i++) { diff --git a/symbols/pdb/Test/Mono.Cecil.Tests/PdbTests.cs b/symbols/pdb/Test/Mono.Cecil.Tests/PdbTests.cs index 6f2d2fa74..86dfb3dac 100644 --- a/symbols/pdb/Test/Mono.Cecil.Tests/PdbTests.cs +++ b/symbols/pdb/Test/Mono.Cecil.Tests/PdbTests.cs @@ -1,6 +1,5 @@ using System.IO; using System.Linq; - using Mono.Cecil.Cil; using Mono.Cecil.Pdb; @@ -56,7 +55,7 @@ .locals init (System.Int32 i, System.Int32 CS$1$0000, System.Boolean CS$4$0001) IL_0020: ldloc.1 IL_0021: ret ", main); - }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider)); + }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider)); } [Test] @@ -82,7 +81,7 @@ public void DebuggerHiddenVariable () Assert.AreEqual ("i", variables [0].Name); Assert.IsFalse (variables [0].IsDebuggerHidden); - }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider)); + }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider)); } [Test] @@ -103,7 +102,7 @@ public void Document () Assert.AreEqual (new byte [] { 228, 176, 152, 54, 82, 238, 238, 68, 237, 156, 5, 142, 118, 160, 118, 245 }, document.Hash); Assert.AreEqual (DocumentLanguage.CSharp, document.Language); Assert.AreEqual (DocumentLanguageVendor.Microsoft, document.LanguageVendor); - }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider)); + }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider)); } [Test] @@ -124,7 +123,7 @@ public void BasicDocument () Assert.AreEqual (new byte [] { 184, 188, 100, 23, 27, 123, 187, 201, 175, 206, 110, 198, 242, 139, 154, 119 }, document.Hash); Assert.AreEqual (DocumentLanguage.Basic, document.Language); Assert.AreEqual (DocumentLanguageVendor.Microsoft, document.LanguageVendor); - }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider)); + }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider)); } [Test] @@ -248,7 +247,7 @@ public void LocalConstants () constant = scope.Constants [1]; Assert.AreEqual ("c", constant.Name); - Assert.AreEqual ((decimal) 74, constant.Value); + Assert.AreEqual ((decimal)74, constant.Value); Assert.AreEqual (MetadataType.ValueType, constant.ConstantType.MetadataType); method = type.GetMethod ("Foo"); @@ -448,7 +447,7 @@ public void CreateMethodFromScratch () method.DebugInformation.SequencePoints.Add (sequence_point); - method.DebugInformation.Scope = new ScopeDebugInformation (body.Instructions [0], null) { + method.DebugInformation.Scope = new ScopeDebugInformation (body.Instructions [0], null) { Variables = { new VariableDebugInformation (temp, "temp") } }; @@ -476,5 +475,15 @@ public void TypeNameExceedingMaxPdbPath () Assert.IsTrue (module.HasSymbols); }, symbolReaderProvider: typeof (NativePdbReaderProvider), symbolWriterProvider: typeof (NativePdbWriterProvider)); } + + [Test] + public void ReadPdbMixedNativeCLIModule () + { + // MixedNativeCLI.exe was copy/pasted from from https://docs.microsoft.com/en-us/cpp/preprocessor/managed-unmanaged?view=msvc-170#example + TestModule ("MixedNativeCLI.exe", module => { + module.ReadSymbols (); + }, readOnly: true); + } + } } diff --git a/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.exe b/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.exe new file mode 100644 index 000000000..b2fbecbf1 Binary files /dev/null and b/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.exe differ diff --git a/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.exe.metagen b/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.exe.metagen new file mode 100644 index 000000000..ef3c1a894 --- /dev/null +++ b/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.exe.metagen @@ -0,0 +1,5 @@ +ImageRuntimeVersion: v4.0.30319 +Assembly MixedNativeCLI, Version=0.0.*, Culture=Invariant Language (Invariant Country): + hash=SHA1, flags=PublicKey +Assembly mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089: + hash=None, flags=None diff --git a/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.pdb b/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.pdb new file mode 100644 index 000000000..2bb2e08ae Binary files /dev/null and b/symbols/pdb/Test/Resources/assemblies/MixedNativeCLI.pdb differ