V10.5.3/request services fix#161
Conversation
Refactor GetServiceDescriptors() method to properly traverse wrapped service providers with cycle detection, ensuring descriptors are correctly resolved when the provider is wrapped by third-party components such as AspVersioning's InjectApiVersion.
Add ServiceProviderExtensionsTest unit test class with complete coverage for GetServiceDescriptors() method across delegating providers, AspVersioning wrapped providers, and ambiguous multi-provider cases. Add functional test to verify fault descriptor exception handling works correctly when request services are wrapped by external decorators.
Add version 10.5.3 release notes across all NuGet packages, documenting bug fixes for service provider resolution with cycle detection and improved wrapped provider support.
Document v10.5.3 patch release with bug fixes for service provider resolution with cycle detection and wrapped provider support, plus comprehensive unit and functional test coverage for dependency injection scenarios.
Greptile SummaryThis patch release fixes
Confidence Score: 5/5Safe to merge; the traversal logic is sound, cycle detection is correct, and the new tests exercise the critical paths. The while-loop traversal correctly replaces the single-case implementation, cycle detection using reference-equality visited-list is reliable, and TryLocateEmbeddedServiceProvider's generic field search handles the single-provider-field pattern correctly. Existing concerns about the internal stub not verifying the real Asp.Versioning type were raised in a prior review thread and are a known trade-off. No new structural defects were found. No files require special attention beyond what was discussed in prior review threads. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GetServiceDescriptors called] --> B[Add provider to visitedProviders]
B --> C{Has CallSiteFactory property?}
C -- Yes --> D[Read Descriptors from CallSiteFactory
return IEnumerable<ServiceDescriptor>]
C -- No --> E{TryLocateEmbeddedServiceProvider}
E -- Not found --> F[throw NotSupportedException
'This method does not support ...']
E -- Found --> G{Already in visitedProviders?}
G -- Yes --> H[throw NotSupportedException
'Cyclic IServiceProvider graph detected']
G -- No --> I[provider = embeddedProvider
Add to visitedProviders]
I --> C
subgraph TryLocateEmbeddedServiceProvider
J[Gather all IServiceProvider-typed fields
excluding self-references] --> K{originatingType ==
ServiceProviderEngineScope?}
K -- Yes --> L[Try RootProvider property
Then field name match
Then single-field fallback]
L --> M{rootProvider found?}
M -- Yes --> N[return rootProvider]
K -- No --> O{Exactly 1 distinct
nested provider?}
M -- No --> O
O -- Yes --> P[return that provider]
O -- No --> Q[return false]
end
Reviews (4): Last reviewed commit: "⬆️ update download-artifact action to v8..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #161 +/- ##
==========================================
+ Coverage 82.80% 82.82% +0.02%
==========================================
Files 602 602
Lines 19157 19181 +24
Branches 2001 2009 +8
==========================================
+ Hits 15863 15887 +24
Misses 3216 3216
Partials 78 78 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request updates the release notes for multiple NuGet packages in the Cuemon library, primarily to document dependency upgrades and a single bug fix. The main focus is on upgrading dependencies across all supported target frameworks to their latest compatible versions, with one notable bug fix in the
Cuemon.AspNetCorepackage.Dependency upgrades:
Cuemon.AspNetCore.App(.NET 10 and .NET 9)Cuemon.AspNetCore.Authentication(.NET 10 and .NET 9)Cuemon.AspNetCore.Mvc(.NET 10 and .NET 9)Cuemon.AspNetCore.Razor.TagHelpers(.NET 10 and .NET 9)Cuemon.Core.App(.NET 10, .NET 9, .NET Standard 2.0)Cuemon.Core(.NET 10, .NET 9, .NET Standard 2.0)Cuemon.Data.Integrity(.NET 10, .NET 9, .NET Standard 2.0)Cuemon.Data(.NET 10, .NET 9, .NET Standard 2.0)Cuemon.Data.SqlClient(.NET 10, .NET 9, .NET Standard 2.0)Cuemon.Diagnostics(.NET 10, .NET 9, .NET Standard 2.0)Cuemon.Extensions.AspNetCore.Authentication(.NET 10 and .NET 9)Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json(.NET 10 and .NET 9)Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml(.NET 10 and .NET 9)Cuemon.Extensions.AspNetCore.Mvc.RazorPages(.NET 10 and .NET 9)Cuemon.Extensions.AspNetCore.Mvc(.NET 10 and .NET 9)Cuemon.Extensions.AspNetCore.Text.Json(.NET 10 and .NET 9)Cuemon.Extensions.AspNetCore.Xml(.NET 10 and .NET 9)Cuemon.Extensions.AspNetCore(.NET 10 and .NET 9)Cuemon.Extensions.Collections.Generic(.NET 10, .NET 9, .NET Standard 2.0)Bug fix:
UseFaultDescriptorExceptionHandler()middleware inCuemon.AspNetCoreto ensure correct operation when request services are wrapped by external decorators or proxies.