C#: Add compilation errors to the debug log in BMN.#20849
Merged
michaelnebel merged 2 commits intogithub:mainfrom Nov 18, 2025
Merged
C#: Add compilation errors to the debug log in BMN.#20849michaelnebel merged 2 commits intogithub:mainfrom
michaelnebel merged 2 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds compilation errors to the debug log when extracting in build-mode none (BMN), making it easier to diagnose issues causing bad database quality. The changes refactor common diagnostic filtering logic into a shared base class method.
- Refactored diagnostic filtering logic from
TracingAnalyserinto a new protected method in the baseAnalyserclass - Added diagnostic logging to
StandaloneAnalyserusing debug-level logging - Moved the
errorsToIgnoreHashSet fromTracingAnalyserto the baseAnalyserclass for reuse
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| csharp/ql/lib/change-notes/2025-11-17-compiler-error-debug.md | Documents the new feature in the change notes |
| csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs | Adds GetFilteredDiagnostics() method and errorsToIgnore HashSet to the base class |
| csharp/extractor/Semmle.Extraction.CSharp/Extractor/TracingAnalyser.cs | Refactors to use the new base class method instead of inline diagnostic filtering |
| csharp/extractor/Semmle.Extraction.CSharp/Extractor/StandaloneAnalyser.cs | Adds LogDiagnostics() method to log compilation errors at debug level for BMN |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
374
to
379
| protected List<Diagnostic> GetFilteredDiagnostics() => | ||
| compilation is not null | ||
| ? compilation.GetDiagnostics() | ||
| .Where(e => e.Severity >= DiagnosticSeverity.Error && !errorsToIgnore.Contains(e.Id)) | ||
| .ToList() | ||
| : []; |
There was a problem hiding this comment.
Inconsistent indentation: line 375 has an extra leading space that doesn't align with the expression pattern formatting on subsequent lines. The condition check should align with line 376.
d423367 to
9f69ff2
Compare
hvitved
approved these changes
Nov 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we add compilation errors to the Debug log when extracting in BMN. This could make it easier to diagnose issues causing bad database quality (without having a copy of the database).