Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds ahead-of-time (AOT) compatibility support by annotating reflection-based builders and activators with trimming-safe attributes, introducing runtime guards for generic type and array instantiation under AOT, and simplifying facility extension code.
- Annotate reflection-based
AddResolvermethods and activator APIs with[DynamicallyAccessedMembers] - Introduce
VerifyAotCompatibilitychecks and throw when dynamic code or value‐type arrays are unavailable under AOT - Refactor facility/extension builders to use a non‐generic base interface and remove the wrapper helper
Reviewed Changes
Copilot reviewed 84 out of 84 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ServiceDescriptorReflectionBuilder.cs | Added [DynamicallyAccessedMembers] to the generic AddResolver |
| ServiceCollectionServiceProvider.cs | Reworked GetService/GetServices, added AOT guards and helpers |
| ReflectionServiceCollectionExtensions.cs | Imported System.Diagnostics.CodeAnalysis |
| IServiceDescriptorReflectionBuilder.cs | Annotated generic AddResolver with trimming-safe attribute |
| FacilityServiceCollectionExtensions.cs | Annotated AddFacility overloads, simplified loop |
| IFacilityReflectionBuilder.cs | Annotated generic AddResolver |
| IFacilityExtensionResolver.cs | Changed Resolve to return non-generic IFacilityExtension |
| IFacilityExtensionReflectionBuilder.cs | Annotated generic AddResolver and updated Resolve return type |
| IFacilityExtension.cs | Introduced non-generic IFacilityExtension base interface |
| FacilityReflectionBuilder.cs | Updated to consume non-generic IFacilityExtension |
| FacilityExtensionWrapper.cs | Removed obsolete wrapper class |
| FacilityExtensionReflectionBuilder.cs | Updated Resolve to return non-generic extensions |
| FacilityBuilder{T}.cs | Refactored generic builder to no longer inherit base class |
| FacilityBuilder.cs | Sealed, removed generic wrapper logic |
| AppCoreNet.Extensions.DependencyInjection.Abstractions.csproj | Added <IsAotCompatible> for .NET 8 targeting |
| Activator/ServiceProviderActivator.cs | Annotated CreateInstance parameter |
| Activator/IActivator.cs | Annotated CreateInstance parameter |
| Activator/DefaultActivator.cs | Annotated CreateInstance parameter |
| Activator/ActivatorExtensions.cs | Annotated generic CreateInstance<T> |
| AppCoreNet.Extensions.sln | Added renovate.json to solution items |
Comments suppressed due to low confidence (4)
DependencyInjection/src/AppCoreNet.Extensions.DependencyInjection.Abstractions/ServiceCollectionServiceProvider.cs:93
- Add unit tests covering the AOT exception path in
MakeGenericTypeto ensure that attempting to build a generic type under AOT throws the expected error.
throw new InvalidOperationException(
DependencyInjection/src/AppCoreNet.Extensions.DependencyInjection.Abstractions/ServiceCollectionServiceProvider.cs:145
- Add tests for the
CreateArrayAOT guard to verify that building arrays of value types under AOT correctly throws an exception.
if (VerifyAotCompatibility && elementType.IsValueType)
DependencyInjection/src/AppCoreNet.Extensions.DependencyInjection.Abstractions/IFacilityExtensionResolver.cs:19
- This change from a generic
IEnumerable<IFacilityExtension<IFacility>>to a non-generic return type is breaking; consider adding an obsolete overload or bumping the major version.
IEnumerable<IFacilityExtension> Resolve(Type facilityType);
DependencyInjection/src/AppCoreNet.Extensions.DependencyInjection.Abstractions/ServiceCollectionServiceProvider.cs:16
- [nitpick] The
partialkeyword was removed; please confirm there are no other partial declarations forServiceCollectionServiceProviderto prevent compilation errors.
internal sealed class ServiceCollectionServiceProvider : IServiceProvider, IServiceProviderIsService
No description provided.