🔥 Hot fixing v23.3.4 (version {0}) 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!
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.
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.
The
System.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 a
System.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.
Upgrading from 23.3.4 to {0} 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.