-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sentry.Serilog throws if a DSN is not passed even though SentrySdk should already be initialized #2866
Comments
Should be an easy fix with SentrySdk.IsEnabled before throwing. We should also add to the 4.0 changelog at the top on breaking changes. That if the SDK is disabled and |
Do note that passing an empty string to if (!string.IsNullOrWhiteSpace(dsn))
{
sentrySerilogOptions.Dsn = dsn;
} |
Relates to: |
@kanadaj I think in this scenario, where you have already initialized Sentry via the generic host (and a call to
That way, even though you're not supplying a DSN, it won't try to use that (null) value to initialise the SDK. I've made a change so that you can now also provide the disabled DSN and it won't throw... but in that scenario you'd be initializing Sentry with a DisabledHub and nothing would get sent through to Sentry (which I don't think is what you want). I've also created another ticket to see if we can get smart about how we set the default value of |
Package
Sentry
.NET Flavor
.NET
.NET Version
8.0.0
OS
Any (not platform specific)
SDK Version
4.0.0-beta.1
Self-Hosted Sentry Version
No response
Steps to Reproduce
builder.Services.CongureLogging()
.WriteTo.Sentry()
with no argumentsExpected Result
The Serilog
.WriteTo.Sentry()
call shouldn't throw if SentrySdk is already initialized in the HostBuilder with.UseSentry()
Actual Result
Throws during startup with
ArgumentNullException
The text was updated successfully, but these errors were encountered: