diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2020-01-23 03:10:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-23 03:10:13 +0300 |
commit | 89d6f74529f786cd0ede4bb35c57f6d1aa8a7de8 (patch) | |
tree | ca2c095722ec229b94c7f949af2ab03dd08ee03f /main | |
parent | 87f1d0e17fa3d2666504dd242af6cb13807900b7 (diff) | |
parent | a341194db6bf368d670801d8598fd98d60511256 (diff) |
Merge pull request #9230 from mono/master-vsts1009809
Fixes VSTS Bug 1009809: Save failed
Diffstat (limited to 'main')
5 files changed, 19 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/AssemblyReference.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/AssemblyReference.cs index 67c93fb9c5..f9b4e67a9f 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/AssemblyReference.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/AssemblyReference.cs @@ -139,6 +139,10 @@ namespace MonoDevelop.Projects public SolutionItem GetReferencedItem (Solution parentSolution) { + if (parentSolution is null) { + throw new ArgumentNullException (nameof (parentSolution)); + } + var projectPath = GetMetadata ("MSBuildSourceProjectFile"); if (!string.IsNullOrEmpty (projectPath)) { var project = parentSolution.FindSolutionItem (projectPath); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs index 842593a939..3a9f8409ed 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs @@ -55,7 +55,7 @@ namespace MonoDevelop.Components { throw new NotSupportedException (); } - + public T GetNativeWidget<T> () where T : class { if (nativeWidget == null) { @@ -92,6 +92,16 @@ namespace MonoDevelop.Components throw new NotSupportedException ($"Cannot get native widget {typeof (T)}"); } + public bool TryGetNativeWidget<T> (out T widget) where T : class + { + if (nativeWidget is T) { + widget = GetNativeWidget<T> (); + return true; + } + widget = null; + return false; + } + void OnGtkDestroyed (object sender, EventArgs args) { GC.SuppressFinalize (this); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs index bd3012bef4..8446f68609 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs @@ -218,8 +218,7 @@ namespace MonoDevelop.Components { try { #if MAC - var nsWindow = parent.GetNativeWidget<NSWindow> (); - if (nsWindow != null) { + if (parent.TryGetNativeWidget<NSWindow> (out var nsWindow)) { var myNSWindow = MonoDevelop.Components.Mac.GtkMacInterop.GetNSWindow (window); myNSWindow.ParentWindow = nsWindow; } else { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.MetadataReferenceHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.MetadataReferenceHandler.cs index 30d2903c51..ea3fa26e76 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.MetadataReferenceHandler.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.MetadataReferenceHandler.cs @@ -107,6 +107,8 @@ namespace MonoDevelop.Ide.TypeSystem async Task<bool> AddReferences (AddReferencesData data) { try { + if (data.Project.ParentSolution == null) + return false; var referencedAssemblies = await data.Project.GetReferencedAssemblies (data.ConfigurationSelector, true).ConfigureAwait (false); foreach (var file in referencedAssemblies) { if (file.IsProjectReference) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs index 190e9db83b..4b49c09c4d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs @@ -426,6 +426,7 @@ namespace MonoDevelop.Ide try { await entry.SaveAsync (monitor); monitor.ReportSuccess (GettextCatalog.GetString ("Project saved.")); + } catch (OperationCanceledException) { } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Save failed."), ex); } finally { |