diff --git a/src/Integration/Notifications/VisualStudioStatusBarHelper.cs b/src/Integration/Notifications/VisualStudioStatusBarHelper.cs index e3197c7b3d..503a0609d4 100644 --- a/src/Integration/Notifications/VisualStudioStatusBarHelper.cs +++ b/src/Integration/Notifications/VisualStudioStatusBarHelper.cs @@ -29,6 +29,7 @@ namespace SonarLint.VisualStudio.Integration.Notifications public static class VisualStudioStatusBarHelper { private const string SccStatusBarHostName = "PART_SccStatusBarHost"; + private const string StatusBarRightFrameControlContainerName = "PART_StatusBarRightFrameControlContainer"; public static void RemoveStatusBarIcon(FrameworkElement statusBarIcon) { @@ -60,10 +61,8 @@ public static void AddStatusBarIcon(FrameworkElement statusBarIcon) /// private static void AddStatusBarIcon(Window window, UIElement statusBarIcon) { - var statusBarPart = window?.Template?.FindName(SccStatusBarHostName, window) as FrameworkElement; - var parent = statusBarPart?.Parent as DockPanel; - - if (parent == null) + if(!GetOldStatusBarPlacement(SccStatusBarHostName, window, out var statusBarPart, out var parent) + && !GetOldStatusBarPlacement(StatusBarRightFrameControlContainerName, window, out statusBarPart, out parent)) { Debug.Fail("Could not find status bar container"); return; @@ -72,5 +71,12 @@ private static void AddStatusBarIcon(Window window, UIElement statusBarIcon) var index = parent.Children.IndexOf(statusBarPart); parent.Children.Insert(index + 1, statusBarIcon); } + + private static bool GetOldStatusBarPlacement(string statusBarElementToAttachAfter, Window window, out FrameworkElement statusBarElement, out DockPanel parent) + { + statusBarElement = window?.Template?.FindName(statusBarElementToAttachAfter, window) as FrameworkElement; + parent = statusBarElement?.Parent as DockPanel; + return parent != null; + } } }