-
Notifications
You must be signed in to change notification settings - Fork 16
Update package versions and condition in csproj #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Updated System.Text.Json and System.Diagnostics.DiagnosticSource package references to version 10.0.0. Simplified the condition to check for TargetFramework not equal to net8.0.
|
💚 CLA has been signed |
|
When using Elastic.Clients.Elasticsearch 8.19.12 (NuGet) with System.Text.Json 10.0.0, a runtime MissingMethodException occurs: System.MissingMethodException: Method not found: Root Cause The NuGet package Elastic.Transport 0.10.1 was compiled against System.Text.Json 8.0.5. When the application loads System.Text.Json 10.0.0 at runtime, there is a binary incompatibility due to internal breaking changes in The issue manifests during JSON serialization when Elastic.Transport calls JsonSerializer.SerializeAsync(), which internally uses types whose implementation changed between versions 8.x and 10.0. Solution Recompile Elastic.Transport and Elastic.Clients.Elasticsearch against System.Text.Json 10.0.0. This ensures the compiled IL references the correct internal type implementations. Changes Made elastic-transport-net (Elastic.Transport.csproj): Key Takeaway System.Text.Json 10.0.0 has internal breaking changes that require dependent libraries to be recompiled - simply updating the runtime DLL without recompiling causes MissingMethodException errors. |
flobernd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the PR.
Let's always use the STJ 10 package unless we are targeting net10 anyways.
| <ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))"> | ||
| <PackageReference Include="System.Text.Json" Version="8.0.5" /> | ||
| <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" /> | ||
| <ItemGroup Condition="'$(TargetFramework)' != 'net8.0'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <ItemGroup Condition="'$(TargetFramework)' != 'net8.0'"> | |
| <ItemGroup Condition="'$(TargetFramework)' != 'net10.0'"> |
|
@sripraneeth Hi. Are you planning to update the PR? |
Updated System.Text.Json and System.Diagnostics.DiagnosticSource package references to version 10.0.0. Simplified the condition to check for TargetFramework not equal to net8.0.
When using Elastic.Clients.Elasticsearch 8.19.12 (NuGet) with System.Text.Json 10.0.0, a runtime MissingMethodException occurs:
System.MissingMethodException: Method not found:
'Boolean Elastic.Transport.Extensions.TransportSerializerExtensions.TryGetJsonSerializerOptions(...)'
Root Cause
The NuGet package Elastic.Transport 0.10.1 was compiled against System.Text.Json 8.0.5. When the application loads System.Text.Json 10.0.0 at runtime, there is a binary incompatibility due to internal breaking changes in
System.Text.Json (specifically in internal types like PooledByteBufferWriter).
The issue manifests during JSON serialization when Elastic.Transport calls JsonSerializer.SerializeAsync(), which internally uses types whose implementation changed between versions 8.x and 10.0.
Solution
Recompile Elastic.Transport and Elastic.Clients.Elasticsearch against System.Text.Json 10.0.0. This ensures the compiled IL references the correct internal type implementations.
Changes Made
elastic-transport-net (Elastic.Transport.csproj):
Key Takeaway
System.Text.Json 10.0.0 has internal breaking changes that require dependent libraries to be recompiled - simply updating the runtime DLL without recompiling causes MissingMethodException errors.