From b9f069cb227cf8908cb1566efaca2e42983153a5 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 20 Nov 2015 18:08:21 -0800 Subject: [PATCH] Guard TrackAssembly Because it can fail sometimes --- Microsoft.PowerShell.Linux.Host/typecatalog.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Microsoft.PowerShell.Linux.Host/typecatalog.cs b/Microsoft.PowerShell.Linux.Host/typecatalog.cs index c95ee63d06..20f1da7e51 100644 --- a/Microsoft.PowerShell.Linux.Host/typecatalog.cs +++ b/Microsoft.PowerShell.Linux.Host/typecatalog.cs @@ -3,6 +3,7 @@ namespace Microsoft.PowerShell.Linux.Host using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics; using System.IO; using System.Linq; using System.Management.Automation; @@ -76,11 +77,18 @@ namespace Microsoft.PowerShell.Linux.Host { if (assembly != null) { - // Console.WriteLine(assembly.Location); - // Console.WriteLine(assembly.ExportedTypes.Count()); - foreach (var type in assembly.ExportedTypes) + try { - TrackType(type.FullName, assembly); + // Console.WriteLine(assembly.Location); + // Console.WriteLine(assembly.ExportedTypes.Count()); + foreach (var type in assembly.ExportedTypes) + { + TrackType(type.FullName, assembly); + } + } + catch (System.IO.FileNotFoundException) + { + Debug.WriteLine("Could not track assembly {0}", assembly.Location); } } }