diff options
author | Marius Ungureanu <therzok@gmail.com> | 2017-03-14 20:33:36 +0300 |
---|---|---|
committer | Marius Ungureanu <therzok@gmail.com> | 2017-03-14 20:33:36 +0300 |
commit | d37fde9724be3c8caa47c51dd17242166fa1ce9b (patch) | |
tree | ce0f1f16ca989940db3c354a53a71f78bfcac6db /Mono.Addins/Mono.Addins.Database | |
parent | a28c1bcc5b62f42aaaaa2ed19e2fcd2380531684 (diff) |
Track Cecil API changes.
Diffstat (limited to 'Mono.Addins/Mono.Addins.Database')
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/AddinScanner.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs index 5a8e771..9337e60 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs @@ -504,10 +504,11 @@ namespace Mono.Addins.Database bool ScanConfigAssemblies (IProgressStatus monitor, string filePath, AddinScanResult scanResult, out AddinDescription config) { config = null; - + + IAssemblyReflector reflector = null; try { - IAssemblyReflector reflector = GetReflector (monitor, scanResult, filePath); - + reflector = GetReflector (monitor, scanResult, filePath); + string basePath = Path.GetDirectoryName (filePath); using (var s = fs.OpenFile (filePath)) { @@ -523,6 +524,8 @@ namespace Mono.Addins.Database // Something went wrong while scanning the assembly. We'll ignore it for now. monitor.ReportError ("There was an error while scanning add-in: " + filePath, ex); return false; + } finally { + (reflector as IDisposable)?.Dispose (); } } @@ -541,9 +544,10 @@ namespace Mono.Addins.Database bool ScanAssembly (IProgressStatus monitor, string filePath, AddinScanResult scanResult, out AddinDescription config) { config = null; - + + IAssemblyReflector reflector = null; try { - IAssemblyReflector reflector = GetReflector (monitor, scanResult, filePath); + reflector = GetReflector (monitor, scanResult, filePath); object asm = reflector.LoadAssembly (filePath); if (asm == null) throw new Exception ("Could not load assembly: " + filePath); @@ -578,6 +582,8 @@ namespace Mono.Addins.Database // Something went wrong while scanning the assembly. We'll ignore it for now. monitor.ReportError ("There was an error while scanning assembly: " + filePath, ex); return false; + } finally { + (reflector as IDisposable)?.Dispose (); } } |