-
Notifications
You must be signed in to change notification settings - Fork 2k
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
netstandard 2.1 support for Orleans.Serialization #8222
Conversation
src/Orleans.Serialization/Buffers/Adaptors/PooledArrayBufferWriter.cs
Outdated
Show resolved
Hide resolved
Thank you for doing this. Is it possible to add a < .NET 6.0 target to the serialization unit tests so that it has coverage? Perhaps .NET 4.8.1 (since it's not end of life, unlike .NET Core 3.1 and .NET 5.0) |
I went with .NET Core 3.1 since .NET 4.8.1 doesn't actually support netstandard2.1. |
There are currently a handful of failing tests. The common aspect is needing to deserialize a
|
LGTM. My only concerns are:
|
@jsteinich I opened a PR against your fork to fix the test failures: PerBlue#2 The .NET Core 3.1 tests aren't being run in Azure DevOps yet. I'll see if we can fix that easily |
Confirmed that it fixed the test issues on my end as well. Thanks for fixing that; would have probably taken a bit to track that one down.
This is a bit unfortunate, but I don't believe there is a way to run a test against netstandard2.1 directly and anything newer wouldn't fully be testing all conditional code. |
You're right, I don't think we have any options. |
@@ -274,8 +274,10 @@ internal static class ShallowCopyableTypes | |||
{ | |||
[typeof(decimal)] = true, | |||
[typeof(DateTime)] = true, | |||
#if NET6_0_OR_GREATER |
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.
These conditions aren't going to work as expected on .NET 5 or 6 because we don't have a build target for these frameworks and so these conditions will be always false when running on .net3.1 - 6.0.
@@ -72,7 +72,17 @@ public static Guid ReadValue<TInput>(ref Reader<TInput> reader, Field field) | |||
{ | |||
if (BitConverter.IsLittleEndian) |
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.
This block could have been made conditional on NET7+ and the existing fallback would work on any other platform.
@@ -37,18 +37,24 @@ public void Configure(TypeManifestOptions typeManifest) | |||
wellKnownTypes[25] = typeof(int[]); | |||
wellKnownTypes[26] = typeof(string[]); | |||
wellKnownTypes[27] = typeof(Type); | |||
#if NET6_0_OR_GREATER |
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.
These conditions are not going to work as expected on .NET 5 or 6.
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.
Perhaps we should add additional targets. There are likely some conditions which can be lowered to previous versions, like this one.
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.
I contemplated just using the NET7_0_OR_GREATER
everywhere, but felt having conditions that better match the actual dependency made more sense. The net effect (since only 2 build targets exist) is as if only the single condition was used, but I can see how someone looking at the source might be confused.
Make Orleans.Serialization compatible with netstandard 2.1 to enable greater usage outside of Orleans.
Note: it would be possible to support netstandard 2.0; however, that requires quite a bit more conditionals or removal of some niceties.
Microsoft Reviewers: Open in CodeFlow