roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2

Home Page:https://docs.cssharp.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JsonConverter for Vector and QAngle broken with dotnet 8

B3none opened this issue · comments

When people are running v201 there's an issue with dotnet 8 which is caused by the way the Vector and QAngle classes are implemented.

Here's a link to my JsonConverter: https://github.com/B3none/cs2-retakes/blob/master/RetakesPlugin/Modules/Configs/JsonConverters/VectorJsonConverter.cs

Errors posted by community member:
https://pastes.io/uwpu4xdcya

It seems to be related to these lines:

public unsafe ref float X => ref Unsafe.Add(ref *(float*)Handle, 0);
public unsafe ref float Y => ref Unsafe.Add(ref *(float*)Handle, 1);
public unsafe ref float Z => ref Unsafe.Add(ref *(float*)Handle, 2);

@ipsvn sent this: dotnet/runtime#95893

He also made the PR to fix it in my plugin too 👍

It seems to be an issue with the JsonConverter attributes not being loaded in dotnet8 for some reason, but I can confirm this is not an error with CounterStrikeSharp. Although the Vector and Qangle classes do need some refinement 👀

Here's his PR for context:
https://github.com/B3none/cs2-retakes/pull/94/files

For now I'll close this ticket as it's not a CounterStrikeSharp issue.