Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

neuecc
Copy link
Member

@neuecc neuecc commented Dec 9, 2024

and more formatters for .NET 9.

  • Int128
  • UInt128
  • Rune
  • OrderedDictionary<T, V>
  • ReadOnlySet<T>

@AArnott
Copy link
Collaborator

AArnott commented Dec 9, 2024

Most of those types are in .NET 8, FYI.

@neuecc
Copy link
Member Author

neuecc commented Dec 10, 2024

Yes, I thought I'd take this opportunity to add the things that hadn't been included.

@neuecc
Copy link
Member Author

neuecc commented Dec 10, 2024

The addition of Int128 was discussed in #1740.
I've decided to use IBinaryInteger<>.TryWriteLittleEndian for writing.

When it comes to serialization methods, one could consider a pattern where numbers within the long range are serialized as Integers, while anything beyond that is serialized as binary.
However, since having the result format itself change is not desirable, I opted to always serialize as binary.

commit: 889dcc9 cc: @pCYSl5EDgo

@neuecc
Copy link
Member Author

neuecc commented Dec 10, 2024

I used MessagePackReader.ReadBytes this time.
Thinking about it again, APIs that force ReadOnlySequence are defective products that also have performance issues.
I'll make this API Obsolete soon.

@neuecc neuecc marked this pull request as ready for review December 10, 2024 10:48
Comment on lines +82 to +87
#if NET5_0_OR_GREATER
{ typeof(IReadOnlySet<>), typeof(InterfaceReadOnlySetFormatter<>) },
#endif
#if NET6_0_OR_GREATER
{ typeof(PriorityQueue<,>), typeof(PriorityQueueFormatter<,>) },
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO you can just group both of these under #if NET because 5 and 6 are not supported any more, so anything in .NET 8 can be simply if NET

Copy link
Member Author

Choose a reason for hiding this comment

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

That's true.
However, it's not a bad thing to have a clear time for adding it.
Also, I don't think they'll integrate it every time they turn off support, so I'll leave it as it is.

Comment on lines 183 to +192
#if NET5_0_OR_GREATER
{ typeof(System.Half), HalfFormatter.Instance },
{ typeof(System.Text.Rune), RuneFormatter.Instance },
#endif
#if NET6_0_OR_GREATER
{ typeof(DateOnly), DateOnlyFormatter.Instance },
{ typeof(TimeOnly), TimeOnlyFormatter.Instance },
#endif
#if NET7_0_OR_GREATER
{ typeof(Int128), Int128Formatter.Instance },
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest grouping all these under #if NET

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net472</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net9.0;net472</TargetFrameworks>
<LangVersion>13</LangVersion>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider changing this in the repo root Directory.Build.targets instead of here so you get C# 13 in more projects.

Copy link
Member Author

Choose a reason for hiding this comment

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

Root settings do affect Unity (creating situations where something works in Visual Studio but not in Unity).
I was surprised that CentralPackageTransitivePinningEnabled also affected Analyzers and broke the environment.
The recent increase in implicit insertions and high rate of problems is getting a bit tiresome.
Of course, many things have become more convenient.
That said, yes, let's move the LangVersion specification to Directory.Build.targets.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The recent increase in implicit insertions and high rate of problems is getting a bit tiresome.

Do you want to elaborate on this? What are these implicit insertions you speak of?

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 am saying that there are increasing cases that cannot be solved by looking at the csproj file alone.
Configuration settings are being inserted from various places.

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.

2 participants