getsentry / sentry-unity

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

Events not captured from Unity WebGL build after scene change #1678

Closed MobikTech closed 4 weeks ago

MobikTech commented 3 months ago

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which version of the SDK? 2.0.6

How did you install the package? (Git-URL, Assetstore) Git-URL

Which version of Unity? 2021.3.32f1

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? It is happening on WebGL build(dont know if on another platforms also, did not tested). In Editor bug is NOT reproduced

Steps to Reproduce

  1. Integrate Sentry SDK events/messages/errors/unhandledExceptions capturing on first and second scenes via SentrySdk.Capture[] methods.
  2. Capturing executed from UniTask loop in custom non MonoBehaviour classes.
  3. Make game build on WebGL platform(dev/usual, doesn't matter)
  4. Run build on any browser(tested on Chrome and Firefox, both reproduced bug).

Expected Result

All calls of SentrySdk.Capture[] methods and unhandled exceptions will be gathered and displayed on sentry.io.

Actual Result

While first scene is loaded and active all events sending to cloud correctly. But after a moment of second scene loaded all events stops to send. After this, each sending try throws NullReference exception to browser console from internal SentrySDK code(see the screenshots). image

Exceptions thrown from internal DoSendEvent method and catched by try/catch block. image

Any logs or screenshots

SentryConfiguration on which build was tested: image image image image image image image

Detailed log of Error message: image

bitsandfoxes commented 3 months ago

Thanks for reaching out and for the detailed issue! We'll have to process this but it should be fairly straight forward to reproduce!

munkiki7 commented 2 months ago

@MobikTech , we have tested the scene-changing part within our demo level, and everything works fine even after several scene changes.

Can you, please, send us a minimal example to reproduce the issue?

Edit: we do not use UniTasks.

MobikTech commented 1 month ago

@munkiki7 I prepared sample project with error reproduce, you can download it by the link.

bitsandfoxes commented 1 month ago

Thanks for the repro @MobikTech, much appreciated. We'll be taking a look!