Skip to content

Conversation

@Dreamescaper
Copy link
Owner

Fixes #37 .

@Dreamescaper Dreamescaper requested a review from Copilot July 19, 2025 12:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #37 by excluding non-accessible types from service registration generation. The change ensures that only types accessible from the calling context are included when the source generator scans for services to register.

Key changes:

  • Added accessibility checks using SemanticModel.IsAccessible() to filter out non-accessible types
  • Refactored GenerateAttributeSource to GenerateAttributeInfo with constants for better maintainability
  • Added test cases to verify that internal and private classes are properly excluded

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
GenerateAttributeInfo.cs Renamed class and converted properties to constants for metadata name and source
DependencyInjectionGenerator.cs Updated references to use new class name and constants
DependencyInjectionGenerator.FilterTypes.cs Added accessibility check using semantic model to exclude non-accessible types
TestServices.cs Added internal test class to verify exclusion behavior
AddServicesTests.cs Added private nested class test case with explanatory comment

@Dreamescaper Dreamescaper merged commit a103969 into main Jul 19, 2025
1 check passed
@Dreamescaper Dreamescaper deleted the accessible-types branch July 19, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Service scanning should exclude non-accessible types by default

2 participants