Disable and (re-)enable Sentry after Startup in .NET MAUI #3325
Unanswered
FlavioGoncalves-Cayas
asked this question in
Q&A
Replies: 1 comment 4 replies
-
I can't see a way to do this currently. Brainstorming on how this might be done, is there any way to Configure Lifecycle Events for MAUI outside of the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi folks,
due to data privacy concerns we want to give the use the option to turn off sentry at runtime.
As far as I understand there are generally three options to do that:
IDisposable
returned duringInit
SentrySdk.Close()
In .NET MAUI option 1 is not feasible when using the recommended approach to configure Sentry with
UseSentry()
.Option 2 can be done effortlessly, but the problem I see is when we want to reenable Sentry. Then we will have to call
Init()
. However, callingInit()
manually orUseSentry()
is not the same in a MAUI app, becauseUseSentry()
does more than just initialize Sentry. It also registers event handlers for lifecycle, navigation, page events and more, so that they can be reported to Sentry. Since all of that logic is internal it is also not possible to do that outside ofUseSentry()
.Third option also requires a new call to
Init()
.I also tried implementing the
SetBeforeSend
andSetBeforeSendTransaction
and drop all events in case the user disabled sentry, but even then crashes, ANR events and general information like the information found in Release Details seems to still be transmitted, which is not desirable.Am I missing an obvious API to turn all data transmission off, or is this an oversight especially in regards to the MAUI integration?
@bitsandfoxes @jamescrosswell mentioning you for visibility.
Beta Was this translation helpful? Give feedback.
All reactions