sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Remove 'Platform' from scope

Open bitsandfoxes opened this issue 2 years ago • 4 comments

Problem Statement

SentryEvents get the Platform property already set in the internal Constructor https://github.com/getsentry/sentry-dotnet/blob/def623108063996cd86facb3bef43998cb2b8867/src/Sentry/SentryEvent.cs#L205 and the scope does not override it when it gets applied https://github.com/getsentry/sentry-dotnet/blob/def623108063996cd86facb3bef43998cb2b8867/src/Sentry/Scope.cs#L363 Does this mean setting the Platform when configuring the scope doesn't do anything?

Solution Brainstorm

We might as well remove the 'Platform' from the scope.

bitsandfoxes avatar Apr 25 '22 15:04 bitsandfoxes

platform should be always csharp (even if code was written in VB or F#) so makes sense to get rid of it

bruno-garcia avatar Apr 25 '22 15:04 bruno-garcia

platform should be always csharp

Yeah, probably it should have been called dotnet, but effectively it's the same for this purpose.

Though after reading the spec for stack traces, I believe we still need to let platform be set on a stack trace/frame so that we can override it if we bundle native SDKs in the future.

mattjohnsonpint avatar May 02 '22 14:05 mattjohnsonpint

We were wrong about this. The platform name won't always be "csharp". With the new Android support, if an event is generated from the embedded Android SDK, its platform will be "java". This would be evident on events exposed in a BeforeSend delegate. We shouldn't obsolete the property or remove it, as that will erroneously change the platform from "java" to "csharp" when roundtripping.

I'll revert the change.

mattjohnsonpint avatar Jun 09 '22 23:06 mattjohnsonpint

The protocol should allow different values to match the use case Matt described. But I believe there's still no need for Platform on the Scope though. So we could remove it from the scope.

bruno-garcia avatar Jun 14 '22 21:06 bruno-garcia