Open HughWarrington opened 8 months ago
Assigning to @getsentry/support for routing ⏲️
I guess this page would need to be updated too since it says the same thing.
On further reading, I think there is a workaround here. That works for me.
I think the docs should say something like "If you are configuring Sentry via code and you want to read the DSN from the environment, you must explicitly set options.Dsn = ""
; once you have done this, the DSN will be read from the SENTRY_DSN environment variable. If that variable is unset or empty, Sentry will silently do nothing."
Core or SDK?
Core Sentry product
Which part? Which one?
.NET SDK 4.1.2
Description
This says
I have found this not to be the case.
I copied the code example on that page, and it works fine.
If I set
SENTRY_DSN
variable in my environment, and remove the explicitoptions.Dsn = ...
from the code, it still works fine, using the DSN from the env var.If I remove the explicit
options.Dsn = ...
from the code and do not set any environment variable, I get an unhandled ArgumentNullException and my application crashes at startup. It does not fall back to the 'just do nothing' behaviour that is documented.I'm not sure if this is a documentation problem, or a bug in the SDK. I see someone has reported a bug here and there is a possible fix here, but it sounds like the fix might already be in the version I was using?
Suggested Solution
It would suit me best if the code behaves exactly as documented. Failing that, the docs should match the code behaviour so I can work out what to do in my situation.