Fix check for a project being properly loaded#54983
Merged
jasonmalinowski merged 2 commits intoJul 8, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates dotnet-format’s analyzer runner to better detect when a project is “properly loaded” for analysis, specifically fixing scenarios like building/analyzing System.Private.CoreLib where mscorlib.dll is not a reliable sentinel.
Changes:
- Replace the
mscorlib.dllmetadata-reference heuristic with a compilation-based check thatSystem.Objectis available. - Make referenced-project loading verification async and recursive across
ProjectReferences. - Add
System.Diagnosticsfor a debug-only assertion (but see review comment about release behavior).
Show a summary per file
| File | Description |
|---|---|
| src/Dotnet.Format/dotnet-format/Analyzers/AnalyzerRunner.cs | Switches the “references loaded” detection from mscorlib.dll to System.Object availability and recurses across referenced projects before running analyzers. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 4
mwiemer-microsoft
requested changes
Jun 25, 2026
mwiemer-microsoft
left a comment
Member
There was a problem hiding this comment.
At least typo fixes, maybe the AI-suggested changes as well
JoeRobich
approved these changes
Jun 26, 2026
We were explicitly looking for an mscorlib.dll as being in the list of references, but that won't work for Corlib itself since it has no references. Just replace the check that to do analysis, we have to have a System.Object somewhere. Fixes dotnet#53595
This isn't needed since it's just a console app.
0ea6a28 to
185aaba
Compare
mwiemer-microsoft
approved these changes
Jun 26, 2026
JoeRobich
approved these changes
Jul 2, 2026
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.
We were explicitly looking for an mscorlib.dll as being in the list of references, but that won't work for Corlib itself since it has no references. Just replace the check that to do analysis, we have to have a System.Object somewhere.
Fixes #53595