diff --git a/symbols/pdb/Mono.Cecil.Pdb/NativePdbWriter.cs b/symbols/pdb/Mono.Cecil.Pdb/NativePdbWriter.cs index 7bb9c6f15..9597d7fa4 100644 --- a/symbols/pdb/Mono.Cecil.Pdb/NativePdbWriter.cs +++ b/symbols/pdb/Mono.Cecil.Pdb/NativePdbWriter.cs @@ -267,6 +267,7 @@ public void Write () public void Dispose () { + writer.Close (); } } diff --git a/symbols/pdb/Mono.Cecil.Pdb/SymWriter.cs b/symbols/pdb/Mono.Cecil.Pdb/SymWriter.cs index f309f2f6c..fcc92611c 100644 --- a/symbols/pdb/Mono.Cecil.Pdb/SymWriter.cs +++ b/symbols/pdb/Mono.Cecil.Pdb/SymWriter.cs @@ -30,6 +30,7 @@ static extern int CoCreateInstance ( readonly ISymUnmanagedWriter2 writer; readonly Collection documents; + bool closed = false; public SymWriter () { @@ -78,6 +79,10 @@ public void DefineConstant2 (string name, object value, int sigToken) public void Close () { + if (closed) + return; + + closed = true; writer.Close (); Marshal.ReleaseComObject (writer);