sentry-unity
sentry-unity copied to clipboard
Assembly Alias causes `System.Text.Json` exception
Steps to reproduce:
- Build the SDK with TFM
netstandard2.1(i.e. using Unity 2022 or newer) - Run the aliasing tool
- Attempt to capture an error, session, transaction
- Observe the following error while the SDK attempts to serialize an envelope
TypeLoadException: VTable setup of type System.Text.Json.Utf8JsonWriter failed
This does not happen when skipping the aliasing step.
As workarounds:
- Use version Unity 2021 or older to build the SDK - and that's how CI does it
- Disable aliasing when packing/repacking the SDK
Workaround #1 won't work for us, so I attempted workaround #2. It worked in editor, but when I did a player build, it crashes with a new error:
System.Text.Json.Utf8JsonWriter doesn't implement interface System.IAsyncDisposable
Since we're SOL on this one, I'll try my luck and see if @xoofx has any idea what might be going on 🙏
tl;dr: Same code base, if we build with netstandard2.1 (i.e. using Unity 2022 or newer) it crashes. Works if we build with ns2.0.