-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Move diagnostic generation from LibraryImportGenerator to LibraryImportDiagnosticsAnalyzer #123780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… diagnostics Co-authored-by: jkoritzinsky <[email protected]>
Co-authored-by: jkoritzinsky <[email protected]>
…itional analyzer loading Co-authored-by: jkoritzinsky <[email protected]>
…till reports diagnostics) Co-authored-by: jkoritzinsky <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
jkoritzinsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot address this review.
...ime.InteropServices/gen/LibraryImportGenerator/Analyzers/LibraryImportDiagnosticsAnalyzer.cs
Show resolved
Hide resolved
...ime.InteropServices/gen/LibraryImportGenerator/Analyzers/LibraryImportDiagnosticsAnalyzer.cs
Outdated
Show resolved
Hide resolved
...raries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/DiagnosticOr.cs
Outdated
Show resolved
Hide resolved
...aries/System.Runtime.InteropServices/tests/Common/Verifiers/CSharpSourceGeneratorVerifier.cs
Show resolved
Hide resolved
…per review feedback Co-authored-by: jkoritzinsky <[email protected]>
...ibraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.cs
Outdated
Show resolved
Hide resolved
...braries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/Diagnostics.cs
Show resolved
Hide resolved
…null, remove helper method Co-authored-by: jkoritzinsky <[email protected]>
…analyzer only Co-authored-by: jkoritzinsky <[email protected]>
jkoritzinsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please address the feedback in this review.
...ime.InteropServices/gen/LibraryImportGenerator/Analyzers/LibraryImportDiagnosticsAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime.InteropServices/tests/Common/Verifiers/CSharpAnalyzerVerifier.cs
Outdated
Show resolved
Hide resolved
...aries/System.Runtime.InteropServices/tests/Common/Verifiers/CSharpSourceGeneratorVerifier.cs
Outdated
Show resolved
Hide resolved
...ibraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.cs
Outdated
Show resolved
Hide resolved
...ime.InteropServices/gen/LibraryImportGenerator/Analyzers/LibraryImportDiagnosticsAnalyzer.cs
Outdated
Show resolved
Hide resolved
…ion, simplify verifier, move options Co-authored-by: jkoritzinsky <[email protected]>
|
@copilot Please adjust CompilationExtensions.GetEnvironmentFlags to check for DisableRuntimeMarshallingAttribute on the source assembly instead of the module. Also, add handling for the rest of the diagnostic edge cases for the remaining 5% of tests. Then, please remove the Diagnostics field from LibraryImportGenerator.IncrementalStubGenerationContext and remove downstream usages. |
…y, remove Diagnostics from generator Co-authored-by: jkoritzinsky <[email protected]>
…ortDiagnosticsAnalyzer Co-authored-by: jkoritzinsky <[email protected]>
Addressed in commits f33ac74 and 9f85c66:
|
Summary
Continuing to address review feedback from @jkoritzinsky.
Changes Made
Updated
CompilationExtensions.GetEnvironmentFlags- Checks forDisableRuntimeMarshallingAttributeon the source assembly instead of the moduleRemoved
Diagnosticsfield fromIncrementalStubGenerationContext- Generator no longer collects or returns diagnosticsFixed
AddDisableRuntimeMarshallingAttributeFixerTests- Updated to useLibraryImportDiagnosticsAnalyzerinstead ofEmptyDiagnosticAnalyzerTest Status
CompileFails.ValidateSnippetstestsByValueContentsMarshalling.VerifyByValueMarshallingAttributeUsageInfoMessagestestsInvestigation Notes
The failing tests run both generator and analyzer together via
CSharpSourceGeneratorVerifier. The analyzer returns 0 diagnostics when it should report SYSLIB1051/SYSLIB1052/SYSLIB1092 diagnostics.Possible causes being investigated:
RegisterSymbolActionmay not be triggering for methods with compile errorsGeneratedCodeAnalysisFlags.Nonesetting may be affecting when the analyzer runsThis requires further investigation to understand why the analyzer doesn't report diagnostics in these specific test scenarios.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.