fix: #791 stack overflow in the weaver (#792)

remove unnecessary manual dispose calls in weaver
This commit is contained in:
Paul Pacheco 2019-04-10 09:58:49 -05:00 committed by vis2k
parent 5c850aa9ca
commit 7b57830e6c

View File

@ -580,8 +580,6 @@ static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyRes
} }
catch (Exception ex) catch (Exception ex)
{ {
if (CurrentAssembly.MainModule.SymbolReader != null)
CurrentAssembly.MainModule.SymbolReader.Dispose();
Weaver.Error(ex.Message); Weaver.Error(ex.Message);
throw ex; throw ex;
} }
@ -589,8 +587,6 @@ static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyRes
if (WeavingFailed) if (WeavingFailed)
{ {
if (CurrentAssembly.MainModule.SymbolReader != null)
CurrentAssembly.MainModule.SymbolReader.Dispose();
return false; return false;
} }
} }
@ -608,16 +604,12 @@ static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyRes
catch (Exception e) catch (Exception e)
{ {
Log.Error("ProcessPropertySites exception: " + e); Log.Error("ProcessPropertySites exception: " + e);
if (CurrentAssembly.MainModule.SymbolReader != null)
CurrentAssembly.MainModule.SymbolReader.Dispose();
return false; return false;
} }
if (WeavingFailed) if (WeavingFailed)
{ {
//Log.Error("Failed phase II."); //Log.Error("Failed phase II.");
if (CurrentAssembly.MainModule.SymbolReader != null)
CurrentAssembly.MainModule.SymbolReader.Dispose();
return false; return false;
} }
@ -627,9 +619,6 @@ static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyRes
WriterParameters writeParams = Helpers.GetWriterParameters(readParams); WriterParameters writeParams = Helpers.GetWriterParameters(readParams);
CurrentAssembly.Write(dest, writeParams); CurrentAssembly.Write(dest, writeParams);
} }
if (CurrentAssembly.MainModule.SymbolReader != null)
CurrentAssembly.MainModule.SymbolReader.Dispose();
} }
return true; return true;