From c8bf8c6416beab7bcc61841629ac4a61f58716fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 12 Jul 2019 15:07:08 +0200 Subject: Fixes VSTS FeedbackTicket 943824: Diff Incorrect https://devdiv.visualstudio.com/DevDiv/_workitems/edit/943824 Diff View could be loaded before the text view had the text - that caused that the "local" text was empty. The blame view had the same issue (but crashed) - fixed that as well. --- .../MonoDevelop.VersionControl/BlameCommand.cs | 7 ++++++- .../MonoDevelop.VersionControl/DiffCommand.cs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs index ca53d8f23d..3d337b01d3 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs @@ -26,6 +26,7 @@ using System.Linq; using System.Threading.Tasks; +using Microsoft.VisualStudio.Text.Editor; using Mono.Addins; using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; @@ -53,7 +54,11 @@ namespace MonoDevelop.VersionControl foreach (var item in items) { var document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer); - document?.GetContent ()?.ShowBlameView (); + if (document == null) + continue; + document.RunWhenContentAdded (tv => { + document.GetContent ()?.ShowBlameView (); + }); } return true; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs index 8044332165..262e303734 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs @@ -26,6 +26,7 @@ using System.Linq; using System.Threading.Tasks; +using Microsoft.VisualStudio.Text.Editor; using Mono.Addins; using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; @@ -52,7 +53,11 @@ namespace MonoDevelop.VersionControl foreach (var item in items) { var document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer); - document?.GetContent ()?.ShowDiffView (); + if (document == null) + continue; + document.RunWhenContentAdded (tv => { + document.GetContent ()?.ShowDiffView (); + }); } return true; -- cgit v1.2.3