đĨ Hot fixing v23.3.4 (version 23.3.6) aka October'24 release
Read the Docs: Ocelot 23.3
Hot fixed version: 23.3.4
Milestone: October'24
â¤ī¸ A heartfelt "Thank You" to Nikolai Masson (@Niksson) and Nikolay Kuksov (@kick2nick) for their contributions!
âšī¸ About
This release provides minor bug fixes from the previous 23.3.4 release. All bugs have been addressed in the October'24 milestone.
đ For projects utilizing the Service Discovery feature, it is recommended to update to this version to benefit from the unstable release 23.3.4, which includes fixes for both Consul and Kube discovery providers.
đ§âđģ Technical Information
The Ocelot solution encountered a significant issue with the disabled scope validation of services in the DI-container, affecting both testing projects and the core library. Initially, this was not problematic when services were designed as singletons by previous contributors and our team. However, with the introduction of more scoped services by the Ocelot team, it became clear that our testing projects could not adequately handle them.
This patch introduces scope validation across all domains: unit tests, acceptance tests, and the core library itself. We advise always enabling scope validation in your custom Ocelot solutions, especially when dealing with numerous C# overridden classes in the DI-container and any attached custom functionality.
The patch enhances functionality for two primary Service Discovery providers:
- The Ocelot.Provider.Consul provider. The addressed bug is issue #2178, reported on October 17, 2024.
TheSystem.InvalidOperationExceptionerror stating "Cannot resolve scoped service 'Ocelot.Provider.Consul.Interfaces.IConsulServiceBuilder' from root provider" has been resolved.
To clarify, theIConsulServiceBuilderservice is a scoped service in DI, injected via theAddConsul()or AddConsul<T>() methods. Therefore, theDefaultConsulServiceBuildershould also be a scoped service, withHttpContextinjected to meet your development requirements. - The Ocelot.Provider.Kubernetes provider had an issue reported as #977 on August 1, 2019.
It involved aSystem.InvalidOperationExceptionwith the message: "Cannot resolve scoped service 'KubeClient.IKubeApiClient' from root provider." This "invalid scopes" error occurred only in development mode, as release mode DLLs do not validate scopes. However, theKubeApiClientis designed to have a scoped lifetime. Acceptance tests passed because scope validation was disabled, and theKubeClientwas replaced with a singleton. This inconsistency was identified and reproduced by the old 977 issue. As a temporary solution, theIKubeApiClientwas registered as a singleton.
Looking ahead, our team intends to redesign the Kubernetes provider to have a default service builder that is scoped, similar to the Consul provider.
â Breaking Changes
Upgrading from 23.3.4 to 23.3.6 introduces no breaking changes. However, upgrading from 23.3.0 or earlier versions may result in some incompatibilities. For further information, please refer to the release notes of v23.3.4.
Starring â aka Release Influencers 
ââ Raman Maksimchuk, @raman-m
â Henrique Holtz, @henriqueholtz
â Nikolay, @kick2nick
â Nikolai Masson, @Niksson
â Emmanuel Ferdman, @emmanuel-ferdman
â dependabot[bot], @dependabot
What's Changed
- Bump everything | Hot fixing Microsoft.Extensions.Caching.Memory | Microsoft Security Advisory CVE-2024-43483 by @dependabot in #2175
- Coding best practices:
asyncvsawaitimprovements by @henriqueholtz in #2156 - #2178 DI service resolution from scoped
HttpContextrequest services for theIConsulServiceBuilderservice by @Niksson in #2179 - #977 Enable validation of DI scopes in
KubeandPollKubediscovery providers by @kick2nick in #2180 - Follow up #2179 #2180 : Enable validation of DI scopes everywhere, in commit e4bc9ff by @raman-m
- Correct broken references in
servicediscovery.rstby @emmanuel-ferdman in #2187 - Release 23.3.6 | v23.3.4 Hotfixes | October'24 release | +semver: patch by @raman-m in #2185
New Contributors
- @henriqueholtz made their first contribution in #2156
- @Niksson made their first contribution in #2179
- @kick2nick made their first contribution in #2180
Full Changelog: 23.3.5...23.3.6