Skip to content

Review conditional code #1129

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

Merged
merged 12 commits into from
Jun 16, 2025
Merged

Conversation

drewnoakes
Copy link
Member

Follows #1128

We had a bunch of conditional code on frameworks that are no longer in support. Clean them up.
> SYSLIB0051: 'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
This was previously only for NET40, but actually ISynchronizeInvoke is available in all supported target frameworks now, and there's no reason to exclude it in any of them.
These were conditioned on a target we no longer build.
@drewnoakes
Copy link
Member Author

@chrbauer would be great if you could take a look over these changes.

Copy link
Contributor

@AlexandreArpin AlexandreArpin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super happy to see some activity on NetMQ

I double checked all the changes, lgtm!

@@ -82,10 +82,9 @@ public async Task AsyncWithCancellationToken()
await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await server.ReceiveStringAsync(source.Token));
}

#if NETCOREAPP3_1

#if NETSTANDARD || NET
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still get tripped up by pragma defines but this pragma only enabled the test on net5+ (dotnet test 4.7.2 does not pick it up according to the CI logs)

I imagine this pragma was part of when certain targets didn't support IAsyncEnumerable? With netstandard2.0, net4.7.2 and net8+ supporting it, I imagine this pragma can removed let the tests run always?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not working out the box. The IAsyncEnumerable it not defined in net472. But maybe it could work with an "polyfill" nuget as suggested here: https://stackoverflow.com/questions/56651472/does-c-sharp-8-support-the-net-framework

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works: chrbauer@bead6f8

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrbauer want to file that as a PR? Seems like a good change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> #1131

@@ -536,7 +533,7 @@ public void RemoveReferences(int amount)
/// Override the Object ToString method to show the object-type, and values of the MsgType, Size, and Flags properties.
/// </summary>
/// <returns>a string that provides some detail about this Msg's state</returns>
public override string ToString()
public override readonly string ToString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resharper complains about the order of modifiers. Should be public readonly override string ToString()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue that we don't specify a .editorconfig file that both Roslyn and JetBrains tooling can use to agree upon certain style things in the code.

Copy link
Contributor

@chrbauer chrbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

@drewnoakes drewnoakes merged commit 12044d5 into zeromq:master Jun 16, 2025
2 checks passed
@drewnoakes drewnoakes deleted the review-conditional-code branch June 16, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants