[patch] building Microsoft.Scripting.Metadata on Mono

Hey,

Microsoft.Scripting.Metadata is being built with warnaserror, but it
contains a couple of issues that are not detected by csc, but that are
by dmcs, crashing the build. Here’s a fix:

<<<<<<
diff --git a/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs
b/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs
index ddb9387…7ed9bd5 100644
— a/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs
+++ b/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs
@@ -108,7 +108,6 @@ namespace Microsoft.Scripting.Metadata {
int size;
int fileDescriptor = 0;
MemoryMapping mapping = null;

  •        IntPtr ptr = IntPtr.Zero;
    
           // make sure we don't get interrupted before we save the
    

handle and the pointer:
RuntimeHelpers.PrepareConstrainedRegions();
diff --git a/Runtime/Microsoft.Scripting.Metadata/MetadataImport.cs
b/Runtime/Microsoft.Scripting.Metadata/MetadataImport.cs
index 22655c5…17c375a 100644
— a/Runtime/Microsoft.Scripting.Metadata/MetadataImport.cs
+++ b/Runtime/Microsoft.Scripting.Metadata/MetadataImport.cs
@@ -1100,7 +1100,6 @@ namespace Microsoft.Scripting.Metadata {
#region Dump
#if DEBUG
public unsafe void Dump(TextWriter output) {

  •        IntPtr imageStart = (IntPtr)_image.Pointer;
           output.WriteLine("Image:");
           output.WriteLine("  {0}", _image.Length);
           output.WriteLine();
    

<<<<<<

Those variables aren’t used, triggering warnings, that are turned into
errors.

And geez, looking at the code, you guys should have used cecil/light :wink:

Thanks, I’ll fix it.

BTW: The code is based on CCI2 PE reader
(http://ccimetadata.codeplex.com).

Tomas