getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
218 stars 52 forks source link

I just updated to 2.2.0 and now I'm see this error on launch in Unity Editor WebGL platform. #1843

Closed ziggyeye closed 1 month ago

ziggyeye commented 1 month ago

Sentry: (Error) Failed to persist session on the file system. System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Stream has been closed'. at System.IO.FileStream.Flush () [0x0000d] in :0 at System.Text.Json.Utf8JsonWriter.Flush () [0x00094] in <106b5ea9b1fa4ad5922e9fb9e8765bf0>:0 at System.Text.Json.Utf8JsonWriter.Dispose () [0x00011] in <106b5ea9b1fa4ad5922e9fb9e8765bf0>:0 at Sentry.GlobalSessionManager.PersistSession (Sentry.SessionUpdate update, System.Nullable`1[T] pauseTimestamp) [0x0011b] in /sentry-unity/src/sentry-dotnet/src/Sentry/GlobalSessionManager.cs:91

bruno-garcia commented 1 month ago

Looks like the same problem reported here

bruno-garcia commented 1 month ago

cc @jamescrosswell did we change something in the core Sentry package that could cause this?

bruno-garcia commented 1 month ago

The diff in Unity is here: https://github.com/getsentry/sentry-unity/compare/2.1.4...2.2.0

Bit it's most likely caused by some change in the .NET SDK, possible either:

Or

Confirming that WebGL is in the KnownPlatforms: https://github.com/getsentry/sentry-unity/blob/8966aaf2de800353c10daa0c5745222bd06131ff/package-dev/Runtime/SentryInitialization.cs#L296 So it should have file I/O enabled

bruno-garcia commented 1 month ago

OK so @jamescrosswell figured out:

He fixed this problem in this PR:

We bumped it in this repo. but that fix wasn't included in the last release.. It has been sitting on main so I just triggered a release now.

It'll be version 2.2.1

bitsandfoxes commented 1 month ago

The released 2.2.1 addresses this issue. Please feel free to reach out if you're running into any troubles.