23.3.6
🔥 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.InvalidOperationException
error stating "Cannot resolve scoped service 'Ocelot.Provider.Consul.Interfaces.IConsulServiceBuilder' from root provider" has been resolved.
To clarify, theIConsulServiceBuilder
service is a scoped service in DI, injected via theAddConsul()
or AddConsul<T>() methods. Therefore, theDefaultConsulServiceBuilder
should also be a scoped service, withHttpContext
injected to meet your development requirements. - The Ocelot.Provider.Kubernetes provider had an issue reported as #977 on August 1, 2019.
It involved aSystem.InvalidOperationException
with 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, theKubeApiClient
is designed to have a scoped lifetime. Acceptance tests passed because scope validation was disabled, and theKubeClient
was replaced with a singleton. This inconsistency was identified and reproduced by the old 977 issue. As a temporary solution, theIKubeApiClient
was 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:
async
vsawait
improvements by @henriqueholtz in #2156 - #2178 DI service resolution from scoped
HttpContext
request services for theIConsulServiceBuilder
service by @Niksson in #2179 - #977 Enable validation of DI scopes in
Kube
andPollKube
discovery 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.rst
by @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