Skip to content

Commit 9951f45

Browse files
Prefer Debug.Assert over message logged at debug-time.
1 parent 5e215f2 commit 9951f45

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,9 @@ await _projectManager
200200

201201
private void AddDocumentToMiscProjectCore(ProjectSnapshotManager.Updater updater, string filePath, SourceText? sourceText = null)
202202
{
203-
_logger.LogDebug($"Asked to add {filePath} to the miscellaneous files project, because we don't have project info (yet?)");
204-
205-
#if DEBUG
206-
// Note: This shouldn't happen because every caller checks to see if the document is already in a project
207-
// before attempting to add it. This is just a sanity check.
208-
209-
if (_projectManager.TryFindContainingProject(filePath, out var projectKey))
210-
{
211-
// Already in a known project, so we don't want it in the misc files project
212-
_logger.LogDebug($"File {filePath} is already in {projectKey}, so we're not adding it to the miscellaneous files project");
213-
return;
214-
}
215-
#endif
203+
Debug.Assert(
204+
!_projectManager.TryFindContainingProject(filePath, out _),
205+
$"File already belongs to a project and can't be added to the misc files project");
216206

217207
_logger.LogInformation($"Adding document '{filePath}' to miscellaneous files project.");
218208

0 commit comments

Comments
 (0)