Skip to content

Comments

Do not register types as IDisposable or IAsyncDisposable when AsImplementedInterfaces used #27

Merged
Dreamescaper merged 1 commit intomainfrom
exclude-idisposables
May 11, 2025
Merged

Do not register types as IDisposable or IAsyncDisposable when AsImplementedInterfaces used #27
Dreamescaper merged 1 commit intomainfrom
exclude-idisposables

Conversation

@Dreamescaper
Copy link
Owner

Fixes #26 .

@Dreamescaper Dreamescaper requested a review from Copilot May 11, 2025 19:02
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 updates the source generator to exclude IDisposable and IAsyncDisposable when using AsImplementedInterfaces. Key changes include:

  • Making the Namespace property nullable and updating GetModifiers to accept null.
  • Filtering out IDisposable and IAsyncDisposable from implemented interfaces and updating the corresponding test.
  • Minor refactoring in obtaining assembly references and marking singleton instances as readonly.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ServiceScan.SourceGenerator/Model/MethodModel.cs Updated nullable Namespace and GetModifiers parameter signature.
ServiceScan.SourceGenerator/DependencyInjectionGenerator.ParseMethodModel.cs Changed return type to nullable for better error handling.
ServiceScan.SourceGenerator/DependencyInjectionGenerator.FindServicesToRegister.cs Introduced filtering for IDisposable/IAsyncDisposable and helper methods.
ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs Refactored assembly lookup using a nullable intermediate variable.
ServiceScan.SourceGenerator/CombinedProviderComparer.cs Updated singleton Instance to be readonly.
ServiceScan.SourceGenerator.Tests/AddServicesTests.cs Added test to verify that IDisposable interfaces are excluded.
.editorconfig Updated var style preferences.
Comments suppressed due to low confidence (1)

ServiceScan.SourceGenerator.Tests/AddServicesTests.cs:804

  • [nitpick] Consider renaming the test method 'IDisposableServiceAreExcludedWithImplementedInterfaces' to a grammatically consistent plural form, such as 'IDisposableServicesAreExcludedWithImplementedInterfaces', for improved clarity.
public void IDisposableServiceAreExcludedWithImplementedInterfaces()

@Dreamescaper Dreamescaper changed the title Exclude IDisposable and IAsyncDisposable when used with AsImplementedInterfaces Do not register types as IDisposable or IAsyncDisposable when AsImplementedInterfaces used May 11, 2025
@Dreamescaper Dreamescaper merged commit 24fc9df into main May 11, 2025
1 check passed
@Dreamescaper Dreamescaper deleted the exclude-idisposables branch May 11, 2025 19:03
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.

Do not register types as IDisposable or IAsyncDisposable when AsImplementedInterfaces used

1 participant