diff --git a/src/Infrastructure.VS/DocumentEvents/ActiveDocumentTracker.cs b/src/Infrastructure.VS/DocumentEvents/ActiveDocumentTracker.cs index 1c6615d2eb..8ec57d90d8 100644 --- a/src/Infrastructure.VS/DocumentEvents/ActiveDocumentTracker.cs +++ b/src/Infrastructure.VS/DocumentEvents/ActiveDocumentTracker.cs @@ -93,15 +93,15 @@ public ActiveDocumentTracker( /// /// To support all the cases, we use SEID_DocumentFrame for uses cases 1-3 and SEID_WindowFrame for use case 4. /// - int IVsSelectionEvents.OnElementValueChanged(uint elementId, object oldValue, object newValue) + int IVsSelectionEvents.OnElementValueChanged(uint elementid, object varValueOld, object varValueNew) { threadHandling.ThrowIfNotOnUIThread(); - if (elementId == (uint)VSConstants.VSSELELEMID.SEID_DocumentFrame) + if (elementid == (uint)VSConstants.VSSELELEMID.SEID_DocumentFrame) { ITextDocument activeTextDoc = null; - if (newValue is IVsWindowFrame newWindowFrame) + if (varValueNew is IVsWindowFrame newWindowFrame) { activeTextDoc = textDocumentProvider.GetFromFrame(newWindowFrame); } @@ -109,10 +109,10 @@ int IVsSelectionEvents.OnElementValueChanged(uint elementId, object oldValue, ob // The "active document" will be null if the last document has just been closed NotifyActiveDocumentChanged(activeTextDoc); } - // if we reached here, we know that oldValue and/or newValue are a tool window, + // if we reached here, we know that varValueOld and/or varValueNew are a tool window, // and we are only interested in the use case of [tool window] -> [doc] - else if (elementId == (uint) VSConstants.VSSELELEMID.SEID_WindowFrame && - newValue is IVsWindowFrame newWindowFrame && IsDocumentFrame(newWindowFrame)) + else if (elementid == (uint) VSConstants.VSSELELEMID.SEID_WindowFrame && + varValueNew is IVsWindowFrame newWindowFrame && IsDocumentFrame(newWindowFrame)) { var activeTextDoc = textDocumentProvider.GetFromFrame(newWindowFrame); NotifyActiveDocumentChanged(activeTextDoc); diff --git a/src/IssueViz/Editor/ErrorTagging/ErrorTagTooltipProvider.cs b/src/IssueViz/Editor/ErrorTagging/ErrorTagTooltipProvider.cs index 71b27a7958..e733f236ab 100644 --- a/src/IssueViz/Editor/ErrorTagging/ErrorTagTooltipProvider.cs +++ b/src/IssueViz/Editor/ErrorTagging/ErrorTagTooltipProvider.cs @@ -20,6 +20,7 @@ using System; using System.ComponentModel.Composition; +using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; @@ -94,12 +95,17 @@ public object Create(IAnalysisIssueBase analysisIssueBase) Foreground = GetVsThemedColor(EnvironmentColors.SystemCaptionTextBrushKey) }; - instanceCount++; - logger.LogVerbose($"[ErrorTagTooltipProvider] tooltip instance count: {instanceCount}"); + var currentCount = IncrementInstanceCount(); + logger.LogVerbose($"[ErrorTagTooltipProvider] tooltip instance count: {currentCount}"); return content; } + private static long IncrementInstanceCount() + { + return Interlocked.Increment(ref instanceCount); + } + private static void ApplyHyperlinkStyle(Hyperlink hyperlink) { // Style the hyperlink to behave like other error tooltips i.e. diff --git a/src/IssueViz/IssueVisualizationControl/ViewModels/IssueVisualizationViewModel.cs b/src/IssueViz/IssueVisualizationControl/ViewModels/IssueVisualizationViewModel.cs index f7e6b66d83..3edbaa3b48 100644 --- a/src/IssueViz/IssueVisualizationControl/ViewModels/IssueVisualizationViewModel.cs +++ b/src/IssueViz/IssueVisualizationControl/ViewModels/IssueVisualizationViewModel.cs @@ -304,7 +304,8 @@ private IReadOnlyList BuildLocationListItems(IAnalysisIssueFl if (flowLocations != null && flowLocations.Any()) { - for (var i = 0; i < flowLocations.Count; i++) + var i = 0; + while (i < flowLocations.Count) { var location = flowLocations[i]; @@ -317,7 +318,7 @@ private IReadOnlyList BuildLocationListItems(IAnalysisIssueFl listItems.AddRange(sequentialLocations.Select(x => (ILocationListItem)new LocationListItem(x))); - i += sequentialLocations.Count - 1; + i += sequentialLocations.Count; } }