From d9aafb05c19b17d44ec00a021054d3f5fa1d69e1 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 10 Jul 2018 13:49:55 +0100 Subject: [PATCH] In ws-proxy, don't let the debugger die just because some .pdb doesn't correspond to files we have locally --- .../MonoDebugProxy/ws-proxy/MonoProxy.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Blazor.Server/MonoDebugProxy/ws-proxy/MonoProxy.cs b/src/Microsoft.AspNetCore.Blazor.Server/MonoDebugProxy/ws-proxy/MonoProxy.cs index 7a5d4fd300..273227dd22 100644 --- a/src/Microsoft.AspNetCore.Blazor.Server/MonoDebugProxy/ws-proxy/MonoProxy.cs +++ b/src/Microsoft.AspNetCore.Blazor.Server/MonoDebugProxy/ws-proxy/MonoProxy.cs @@ -589,8 +589,17 @@ namespace WsProxy { var res = new StringWriter (); res.WriteLine ($"//dotnet:{id}"); - using (var f = new StreamReader (File.Open (src_file.LocalPath, FileMode.Open))) { - res.Write (f.ReadToEnd ()); + try + { + using (var f = new StreamReader(File.Open(src_file.LocalPath, FileMode.Open))) + { + res.Write(f.ReadToEnd()); + } + } + catch (Exception ex) + { + res.WriteLine($"Unable to open file {src_file.LocalPath}"); + res.WriteLine($"\nException:\n{ex}"); } var o = JObject.FromObject (new {