From bdbf1cb87abc8f9554ee331a1113d533ae5ec5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Mon, 26 Jun 2023 19:46:22 -0700 Subject: [PATCH] More workarounds for VS Code project system issues (#68792) --- .../Core/Portable/EditAndContinue/ActiveStatementsMap.cs | 8 +++++++- src/Features/Core/Portable/EditAndContinue/EditSession.cs | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs index 2c7db324cce73..5ec846bdd527f 100644 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs @@ -115,6 +115,12 @@ public static ActiveStatementsMap Create( } } + // TODO: Remove. Workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1830914. + if (EditAndContinueMethodDebugInfoReader.IgnoreCaseWhenComparingDocumentNames) + { + byDocumentPath = byDocumentPath.WithComparers(keyComparer: StringComparer.OrdinalIgnoreCase); + } + return new ActiveStatementsMap(byDocumentPath, byInstruction.ToImmutableDictionary()); } @@ -190,7 +196,7 @@ void AddStatement(LinePositionSpan unmappedLineSpan, ActiveStatement activeState { // Protect against stale/invalid active statement spans read from the PDB. // Also guard against active statements unmapped to multiple locations in the unmapped file - // (when multiple #line map to the same span that overlaps with the active statement). + // (when multiple #line directives map to the same span that overlaps with the active statement). if (TryGetTextSpan(oldText.Lines, unmappedLineSpan, out var unmappedSpan) && oldRoot.FullSpan.Contains(unmappedSpan.Start) && mappedStatements.Add(activeStatement)) diff --git a/src/Features/Core/Portable/EditAndContinue/EditSession.cs b/src/Features/Core/Portable/EditAndContinue/EditSession.cs index 8109d91d46d0b..eb73bbadd8283 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditSession.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditSession.cs @@ -1188,8 +1188,9 @@ internal static void GetActiveStatementAndExceptionRegionSpans( // Adds a region with specified PDB spans. void AddNonRemappableRegion(SourceFileSpan oldSpan, SourceFileSpan newSpan, bool isExceptionRegion) { - // it is a rude edit to change the path of the region span: - Debug.Assert(oldSpan.Path == newSpan.Path); + // TODO: Remove comparer, the path should match exactly. Workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1830914. + Debug.Assert(string.Equals(oldSpan.Path, newSpan.Path, + EditAndContinueMethodDebugInfoReader.IgnoreCaseWhenComparingDocumentNames ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal)); // The up-to-date flag is copied when new active statement is created from the corresponding old one. Debug.Assert(oldActiveStatement.IsMethodUpToDate == newActiveStatement.IsMethodUpToDate);