From a50c23e0f832ad5840ce7ceedb1af5ed2d41a5b6 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Thu, 26 Mar 2020 20:57:35 -0700 Subject: [PATCH] Disable some asserts that are incorrect with source generators Fixing these is tracked by https://github.com/dotnet/roslyn/issues/42823. --- .../DocumentHighlighting/AbstractDocumentHighlightsService.cs | 4 +++- .../FindReferences/Finders/LinkedFileReferenceFinder.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs index 02ac25459d222..c26f252c2ac52 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs @@ -257,9 +257,11 @@ private static async Task> CreateSpansAsync( // GetDocument will return null for locations in #load'ed trees. // TODO: Remove this check and add logic to fetch the #load'ed tree's // Document once https://github.com/dotnet/roslyn/issues/5260 is fixed. + // TODO: the assert is also commented out becase generated syntax trees won't + // have a document until https://github.com/dotnet/roslyn/issues/42823 is fixed if (document == null) { - Debug.Assert(solution.Workspace.Kind == WorkspaceKind.Interactive || solution.Workspace.Kind == WorkspaceKind.MiscellaneousFiles); + // Debug.Assert(solution.Workspace.Kind == WorkspaceKind.Interactive || solution.Workspace.Kind == WorkspaceKind.MiscellaneousFiles); continue; } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs index cd10b448299d6..51a0f859ed0c4 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs @@ -27,9 +27,11 @@ public async Task> DetermineCascadedSymbolsAs // GetDocument will return null for locations in #load'ed trees. // TODO: Remove this check and add logic to fetch the #load'ed tree's // Document once https://github.com/dotnet/roslyn/issues/5260 is fixed. + // TODO: the assert is also commented out becase generated syntax trees won't + // have a document until https://github.com/dotnet/roslyn/issues/42823 is fixed if (originalDocument == null) { - Debug.Assert(solution.Workspace.Kind == WorkspaceKind.Interactive || solution.Workspace.Kind == WorkspaceKind.MiscellaneousFiles); + // Debug.Assert(solution.Workspace.Kind == WorkspaceKind.Interactive || solution.Workspace.Kind == WorkspaceKind.MiscellaneousFiles); continue; }