MemoryPack icon indicating copy to clipboard operation
MemoryPack copied to clipboard

Fix issue 304: Use of C# 9 feature in library targeted at C# 7.

Open jsupnik-ext-sd opened this issue 1 year ago • 4 comments

Calling new (someSize) instead of new Dictionary<type,ushort>(someSize) is not allowed in .net versions below 9, but this library is supposed to be .net 7 compatible.

See https://github.com/Cysharp/MemoryPack/issues/304 for more info.

jsupnik-ext-sd avatar Jun 18 '24 20:06 jsupnik-ext-sd

C# 7 is too old and I don't feel I can guarantee full support all the time. Is there any reason why you must go with C# 7?

neuecc avatar Jun 21 '24 10:06 neuecc

The documentation on the readme page guarantees C#7 support. For our own uses, we were using C# 8, which also didn't support the feature. Once I fixed this one particular defect, the library built and ran correctly in C# 8.

jsupnik-ext-sd avatar Jun 24 '24 12:06 jsupnik-ext-sd

Where is mentioned about C# 7? .NET 7 and C# 7 is completely different...

neuecc avatar Jun 25 '24 06:06 neuecc

Ah, that's confusion on my part. I hadn't realized the versioning system for C# was so complicated. Regardless, I think my fix improves compatibility with older C# versions, and doesn't introduce any problems. Older C# is particularly desirable for people integrating with Unity, which tends to lag behind (and games tend to be cautious about upgrading to latest-and-greatest Unity versions).

jsupnik-ext-sd avatar Jun 25 '24 14:06 jsupnik-ext-sd

Hello. I was wondering if you were planning to take this fix as part of the main trunk for MemoryPack. If not, I'll look into updating our build process to use the forked version I created to develop the fix.

jsupnik-ext-sd avatar Jul 24 '24 15:07 jsupnik-ext-sd

Thank you. As I still don't understand the request to use C# 7 even though you are using the Source Generator, I will not accept it.

neuecc avatar Jul 25 '24 00:07 neuecc

The C# 7 part was me misreading the requirements. I can retitle if desired. The actual C# version is C# 8.

jsupnik-ext-sd avatar Jul 25 '24 12:07 jsupnik-ext-sd

In any case, it is old.

neuecc avatar Jul 25 '24 15:07 neuecc