From 53358a83e02685004082e0f5a87830cdffff0278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Karlas=CC=8C?= Date: Fri, 13 Apr 2018 14:55:44 +0200 Subject: Fix 591345: [Updater] "Updates have been downloaded and are ready to install" still shown after updating to Alpha Problem was with changes around MonoDevelop.Ide.AddinUpdater.UpdateChannel/UpdateLevel migration where `idx` was not set for each channel resulting in UpdateChannel.Equals returning wrong values causing https://github.com/xamarin/md-addins/blob/5b4c8d9/Xamarin.Ide/Xamarin.Ide/Xamarin.Ide.Updater/UpdatesDialog.cs#L278 to not execute and update list of updatable items. --- .../MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'main/src/core') diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs index dff987d8c7..0613ef279a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs @@ -89,7 +89,17 @@ namespace MonoDevelop.Ide.Updater var updateChannelId = PropertyService.Get ("MonoDevelop.Ide.AddinUpdater.UpdateChannel"); if (string.IsNullOrEmpty (updateChannelId)) return UpdateChannel.FromUpdateLevel (PropertyService.Get ("MonoDevelop.Ide.AddinUpdater.UpdateLevel", UpdateLevel.Stable)); - return new UpdateChannel (updateChannelId, updateChannelId, "", 0); + if (UpdateChannel.Stable.Id == updateChannelId) + return UpdateChannel.Stable; + else if (UpdateChannel.Beta.Id == updateChannelId) + return UpdateChannel.Beta; + else if (UpdateChannel.Alpha.Id == updateChannelId) + return UpdateChannel.Alpha; + else if (UpdateChannel.Test.Id == updateChannelId) + return UpdateChannel.Test; + else + //idx matters in .Equals() so we can't do `new UpdateChannel (updateChannelId, updateChannelId, "", 0);` + throw new NotImplementedException ($"Unknown update channel id:{updateChannelId}"); } set { PropertyService.Set ("MonoDevelop.Ide.AddinUpdater.UpdateChannel", value.Id); -- cgit v1.2.3 From aab87b65567b05faaa1558b7b836bb3e5bccbf8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Karlas=CC=8C?= Date: Fri, 13 Apr 2018 17:06:16 +0200 Subject: We need to handle `updateChannelId` which is not Stable/Beta/Alpha This can be set via environment variable `VS_UPDATER_SERVICE_URL`. Real fix is not in `.Equals()` using `Id` to compare instead of `Idx`, but since some sorting still depends on Idx, I'm keeping .Idx fix for standard channels. --- .../core/MonoDevelop.Core/MonoDevelop.Core.Setup/UpdateChannel.cs | 8 ++++---- .../core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'main/src/core') diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/UpdateChannel.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/UpdateChannel.cs index 04b80584f3..0b0cee17f1 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/UpdateChannel.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/UpdateChannel.cs @@ -60,7 +60,7 @@ namespace MonoDevelop.Core.Setup return false; } - return a.Idx == Idx; + return a.Id == Id; } public bool Equals (UpdateChannel a) @@ -68,7 +68,7 @@ namespace MonoDevelop.Core.Setup if ((object)a == null) { return false; } - return (a.Idx == Idx); + return (a.Id == Id); } public static bool operator == (UpdateChannel a, UpdateChannel b) @@ -79,7 +79,7 @@ namespace MonoDevelop.Core.Setup if (Object.ReferenceEquals (a, null) || Object.ReferenceEquals (b, null)) { return false; } - return a.Idx == b.Idx; + return a.Id == b.Id; } public static bool operator != (UpdateChannel a, UpdateChannel b) @@ -90,7 +90,7 @@ namespace MonoDevelop.Core.Setup if (Object.ReferenceEquals (a, null) || Object.ReferenceEquals (b, null)) { return true; } - return a.Idx != b.Idx; + return a.Id != b.Id; } public static bool operator <= (UpdateChannel a, UpdateChannel b) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs index 0613ef279a..1a8bfb5e26 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/UpdateService.cs @@ -98,8 +98,7 @@ namespace MonoDevelop.Ide.Updater else if (UpdateChannel.Test.Id == updateChannelId) return UpdateChannel.Test; else - //idx matters in .Equals() so we can't do `new UpdateChannel (updateChannelId, updateChannelId, "", 0);` - throw new NotImplementedException ($"Unknown update channel id:{updateChannelId}"); + return new UpdateChannel (updateChannelId, updateChannelId, "", 0); } set { PropertyService.Set ("MonoDevelop.Ide.AddinUpdater.UpdateChannel", value.Id); -- cgit v1.2.3