Skip to content

feat: WebGL - dotnet support - #657

Merged
vaind merged 40 commits into
mainfrom
feat/webgl
Apr 19, 2022
Merged

vaind merged 40 commits into
mainfrom
feat/webgl

Conversation

@vaind

@vaind vaind commented Mar 22, 2022 •

Copy link
Copy Markdown
Contributor

Approaches

I've gone through multiple iterations/alternative approaches. You can see them in previous commits:

MVP TODOs

Future PRs

  • Capture Javascript & native errors - WebGL JavaScript & native error handling #668
  • warn/error out during build when "com.unity.modules.unitywebrequest": "1.0.0" package is disabled - otherwise Unity just throws a vague error: Cannot create web request without initializing the system that I couldn't get any useful resolution for by googling - requires editor build script so could be also part of WebGL JavaScript & native error handling #668 which brings that.

@github-actions

github-actions Bot commented Mar 22, 2022 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 9f82cd5

This was referenced Mar 22, 2022
@vaind vaind changed the title feat: WebGL - basic support feat: WebGL - dotnet error support Mar 25, 2022
@vaind vaind changed the title feat: WebGL - dotnet error support feat: WebGL - dotnet support Mar 25, 2022
Comment thread src/Sentry.Unity/WebGL/SentryWebGL.cs Outdated
Comment thread src/Sentry.Unity/WebGL/SentryWebGL.cs Outdated
@mattjohnsonpint

Copy link
Copy Markdown
Contributor

@vaind - Please try layering on top of the changes I made with getsentry/sentry-dotnet#1560 and let me know if you have any pain points. I think it should let your code be much cleaner. Thanks.

@vaind
vaind force-pushed the feat/webgl branch 2 times, most recently from e9f9faf to 5a15262 Compare March 31, 2022 10:08
Comment thread src/Sentry.Unity/WebGL/SentryWebGL.cs Outdated
Comment thread src/Sentry.Unity/WebGL/SentryWebGL.cs Outdated
@vaind
vaind force-pushed the feat/webgl branch 5 times, most recently from edd5d89 to db050d4 Compare April 13, 2022 11:44
@vaind
vaind enabled auto-merge (squash) April 15, 2022 06:50
@vaind
vaind disabled auto-merge April 15, 2022 08:29

@bruno-garcia bruno-garcia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! :shipit:

I left some notes for and nits for reference

Comment thread Directory.Build.targets Outdated
Comment thread samples/unity-of-bugs/Assets/Scripts/SmokeTester.cs Outdated

public bool EnqueueEnvelope(Envelope envelope)
{
_ = _behaviour.StartCoroutine(_transport.SendEnvelopeAsync(envelope));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that we'll need some form of back pressure in a follow up PR.
If we capture events in a tight loop, would this negatively affect performance?
In other SDKs (I believe the JavaScript SDK does this) we cap the number of futures we spawn to a number by tracking how many async operations are in-flight. In the .NET SDK it's done through the background worker, but here we could have a counter and only start a new coroutine if less than N are currently running

public int QueuedItems { get; }
}

internal class UnityWebRequestTransport : HttpTransportBase

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it's not the goal of this PR. this transport has the potential to unblock usages outside WebGL. Mainly Console platforms. We can refactor things out to be reused later, so that perhaps a selected number of platforms. Possibly even: Anything that's not desktop and mobile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why I've moved it to a separate file in the Sentry.Unity csproj - should be a good starting point without major git-diffs when we want to use for another platform.

Comment thread src/Sentry.Unity/UnityWebRequestTransport.cs Outdated
Comment thread src/Sentry.Unity/UnityWebRequestTransport.cs Outdated
Comment thread src/Sentry.Unity/UnityWebRequestTransport.cs Outdated
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
@galenmolk

Copy link
Copy Markdown

Hi @vaind ! Thank you for your work on WebGL support for this SDK. We're Sentry customers utilizing the tool on other platforms, so we're excited to be able to use it for WebGL too.

I had a quick question: as far as you know, are there Unity Editor version minimums for Sentry Unity <> WebGL compatibility?

@vaind

vaind commented Jul 22, 2022

Copy link
Copy Markdown
Contributor Author

Hi @vaind ! Thank you for your work on WebGL support for this SDK. We're Sentry customers utilizing the tool on other platforms, so we're excited to be able to use it for WebGL too.

I had a quick question: as far as you know, are there Unity Editor version minimums for Sentry Unity <> WebGL compatibility?

Glad you find it useful. It should work on standard versions as for the rest of the SDK, i.e. 2019, 2020, 2021 at the moment. We're testing WebGL specifically in our integration test CI on those.

@galenmolk

Copy link
Copy Markdown

Hi @vaind ! Thank you for your work on WebGL support for this SDK. We're Sentry customers utilizing the tool on other platforms, so we're excited to be able to use it for WebGL too.
I had a quick question: as far as you know, are there Unity Editor version minimums for Sentry Unity <> WebGL compatibility?

Glad you find it useful. It should work on standard versions as for the rest of the SDK, i.e. 2019, 2020, 2021 at the moment. We're testing WebGL specifically in our integration test CI on those.

Thanks for getting back to me so fast. Sounds good!

@jfbloom22

Copy link
Copy Markdown

Awesome work! So glad to have WebGL dotnet support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attachment silently fails to serialize when using BackgroundWorker on WebGL Question/Suggestion: when/how to get WebGL working

7 participants