diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2019-08-01 16:29:05 +0300 |
---|---|---|
committer | Mike Krüger <mikkrg@microsoft.com> | 2019-08-01 16:29:05 +0300 |
commit | 8bba0f122b624e3903d7908c5e3f4d0088734323 (patch) | |
tree | 013356f2147585fc186fcc4302522a8dcec343a1 /main/src/addins/MonoDevelop.AssemblyBrowser | |
parent | e049f39707821ddeef092b9057613d3db81b13ed (diff) |
Fixes VSTS Bug 944655: [FATAL] System.ArgumentException exception in
System.Threading.Tasks.Task.WhenAll[PEFile]()
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/944655
That exact crash shouldn't happen anymore in the current version
(definitions is now an ImmutableList and never null) but a crash at
that point should not crash the IDE in any case.
Diffstat (limited to 'main/src/addins/MonoDevelop.AssemblyBrowser')
-rw-r--r-- | main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs index a4b6937b34..b34a637c1f 100644 --- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs +++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs @@ -917,31 +917,36 @@ namespace MonoDevelop.AssemblyBrowser internal void Open (string url, AssemblyLoader currentAssembly = null, bool expandNode = true) { - Task.WhenAll (this.definitions.Select (d => d.LoadingTask)).ContinueWith (d => { - // At least one of them failed. - if (d.IsFaulted) { - LoggingService.LogError ("Failed to load assemblies", d.Exception); - - // It's possible the assembly in which the type we're looking for exists - // so try probing for it regardless. - } + try { + Task.WhenAll (this.definitions.Select (d => d.LoadingTask)).ContinueWith (d => { + // At least one of them failed. + if (d.IsFaulted) { + LoggingService.LogError ("Failed to load assemblies", d.Exception); + + // It's possible the assembly in which the type we're looking for exists + // so try probing for it regardless. + } - suspendNavigation = false; - ITreeNavigator nav = SearchMember (url, expandNode); - if (definitions.Count == 0) // we've been disposed - return; - if (nav != null) - return; - try { - if (currentAssembly != null) { - OpenFromAssembly (url, currentAssembly); - } else { - OpenFromAssemblyNames (url); + suspendNavigation = false; + ITreeNavigator nav = SearchMember (url, expandNode); + if (definitions.Count == 0) // we've been disposed + return; + if (nav != null) + return; + try { + if (currentAssembly != null) { + OpenFromAssembly (url, currentAssembly); + } else { + OpenFromAssemblyNames (url); + } + } catch (Exception e) { + LoggingService.LogError ("Error while opening the assembly browser with id:" + url, e); } - } catch (Exception e) { - LoggingService.LogError ("Error while opening the assembly browser with id:" + url, e); - } - }, Runtime.MainTaskScheduler).Ignore (); + }, Runtime.MainTaskScheduler).Ignore (); + } catch (Exception e) { + LoggingService.LogError ("Error while opening assembly :" + url); + MessageService.ShowError (GettextCatalog.GetString ("Error while opening assembly {0}.", url), e); + } } void OpenFromAssembly (string url, AssemblyLoader currentAssembly, bool expandNode = true) |