Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

Summary

Continuing to address review feedback from @jkoritzinsky.

Changes Made

  1. Updated CompilationExtensions.GetEnvironmentFlags - Checks for DisableRuntimeMarshallingAttribute on the source assembly instead of the module

  2. Removed Diagnostics field from IncrementalStubGenerationContext - Generator no longer collects or returns diagnostics

  3. Fixed AddDisableRuntimeMarshallingAttributeFixerTests - Updated to use LibraryImportDiagnosticsAnalyzer instead of EmptyDiagnosticAnalyzer

Test Status

  • 674/703 tests pass (28 still failing)
  • Remaining failures are in:
    • CompileFails.ValidateSnippets tests
    • ByValueContentsMarshalling.VerifyByValueMarshallingAttributeUsageInfoMessages tests

Investigation 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:

  1. The analyzer's RegisterSymbolAction may not be triggering for methods with compile errors
  2. The GeneratedCodeAnalysisFlags.None setting may be affecting when the analyzer runs
  3. There may be a timing issue where the analyzer runs before/after the generator

This 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.

Copilot AI changed the title [WIP] Move diagnostic generation to analyzers alongside generators Add LibraryImportDiagnosticsAnalyzer foundation for diagnostic migration Jan 29, 2026
Copilot AI requested a review from jkoritzinsky January 29, 2026 23:53
jkoritzinsky

This comment was marked as outdated.

@jkoritzinsky jkoritzinsky dismissed their stale review January 30, 2026 00:15

Mis-clicked approve

@jkoritzinsky

This comment was marked as resolved.

Copy link
Member

@jkoritzinsky jkoritzinsky left a 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.

Copilot AI changed the title Add LibraryImportDiagnosticsAnalyzer foundation for diagnostic migration Move diagnostic generation from LibraryImportGenerator to LibraryImportDiagnosticsAnalyzer Jan 30, 2026
Copilot AI requested a review from jkoritzinsky January 30, 2026 00:47
…null, remove helper method

Co-authored-by: jkoritzinsky <[email protected]>
Copy link
Member

@jkoritzinsky jkoritzinsky left a 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.

…ion, simplify verifier, move options

Co-authored-by: jkoritzinsky <[email protected]>
@jkoritzinsky
Copy link
Member

@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.

Copilot AI and others added 2 commits January 31, 2026 01:35
…y, remove Diagnostics from generator

Co-authored-by: jkoritzinsky <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 31, 2026

@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 di...

Addressed in commits f33ac74 and 9f85c66:

  1. CompilationExtensions.GetEnvironmentFlags - Updated to check compilation.Assembly.GetAttributes() instead of compilation.SourceModule.GetAttributes() for DisableRuntimeMarshallingAttribute.

  2. Removed Diagnostics field - Removed from IncrementalStubGenerationContext record and updated all downstream usages. The generator now uses discarding diagnostics bags and no longer returns diagnostics.

  3. Diagnostic edge cases - Fixed AddDisableRuntimeMarshallingAttributeFixerTests to use LibraryImportDiagnosticsAnalyzer. 28 tests still fail - the analyzer isn't reporting diagnostics for CompileFails.ValidateSnippets tests when run together with the generator. This appears to be related to how the analyzer's RegisterSymbolAction interacts with methods that have compile errors. Investigating further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants