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

CaptureException returns empty SentryId but exception is sent to Sentry

Open georgiosd opened this issue 3 years ago • 7 comments

Package

Sentry.AspNetCore

.NET Flavor

.NET Core

.NET Version

6.0.5

OS

Linux

SDK Version

3.16.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

No local repro

Expected Result

SentryId should not be 00000000000000000000000000000000

Actual Result

SentryId is 00000000000000000000000000000000

georgiosd avatar May 15 '22 08:05 georgiosd

CaptureException will return an empty id if SentrySdk.Init has not been called.

SimonCropp avatar May 26 '22 10:05 SimonCropp

sorry i just re read the title "but exception is sent to Sentry ". can you share a minimal repro of this?

SimonCropp avatar May 26 '22 22:05 SimonCropp

@SimonCropp I'm going to try but it's unlikely to not work in a minimal repro. In fact it's intermittent even now :-\

georgiosd avatar Jun 08 '22 17:06 georgiosd

could you try enabling Diagnostic Logger https://docs.sentry.io/platforms/dotnet/configuration/diagnostic-logger/ see FileAppenderDiagnosticLogger in that page as an example and persist error and above.

if you need a help writing a custom DiagnosticLogger that targets serilog/nlog/log4net etc let me know

SimonCropp avatar Aug 04 '22 10:08 SimonCropp

also, if you are occasionally getting it on your local dev machine when debugging, can u try enabling "break on all exceptions"

SimonCropp avatar Aug 04 '22 10:08 SimonCropp

In many cases you may have other logging enabled, and can just set options.Debug = true and send us any relevant output.

There shouldn't be any case where SentryId.Empty (all zeros) gets sent to Sentry. We should add a guard for this.

mattjohnsonpint avatar Aug 04 '22 14:08 mattjohnsonpint

Given this was reported for version 3.16.0, it's possible we may have already fixed this, but still I think we should guard somewhere.

mattjohnsonpint avatar Aug 04 '22 14:08 mattjohnsonpint

Sorry for the quiet - I'm hammered right now but will retry to do the above steps before end of August.

georgiosd avatar Aug 17 '22 07:08 georgiosd

I'm only seeing this on older builds so I'll presume it's fixed! but like @mattjohnsonpint said, it would be a good idea to guard against it.

georgiosd avatar Sep 01 '22 06:09 georgiosd

@SimonCropp please add some tests to ensure we don't encounter this again. (or see if we already have them. )

thanks

mattjohnsonpint avatar Sep 29 '22 23:09 mattjohnsonpint

Closing, since we believe the bug is fixed already. But we'll still proceed with adding some more tests and safeguards.

mattjohnsonpint avatar Oct 06 '22 22:10 mattjohnsonpint

@mattjohnsonpint I'm seeing this again for the first time since you closed the issue.

Can we debug it collaboratively somehow?

georgiosd avatar Nov 12 '22 19:11 georgiosd

Can you please post a debug log or other code/output showing the failure?

mattjohnsonpint avatar Nov 13 '22 17:11 mattjohnsonpint

If you would like to collaborate, please join our Discord server. https://discord.com/invite/Ww9hbqr

We use the #dotnet channel, or you can DM me there @mattjohnsonpint. Thanks.

mattjohnsonpint avatar Nov 13 '22 18:11 mattjohnsonpint

I only have the 0000000000... sentry id in the database to show right now.

I am travelling but I'll ping you as soon as I get back.

Meantime, CaptureException is thread-safe right?

On Sun, 13 Nov 2022 at 18:05, Matt Johnson-Pint @.***> wrote:

If you would like to collaborate, please join our Discord server. https://discord.com/invite/Ww9hbqr

We use the #dotnet channel, or you can DM me there @mattjohnsonpint. Thanks.

— Reply to this email directly, view it on GitHub https://github.com/getsentry/sentry-dotnet/issues/1657#issuecomment-1312788058, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMYG5QMGZQY677EFCQNZNTWIEUWXANCNFSM5V6XVRJQ . You are receiving this because you authored the thread.Message ID: @.***>

georgiosd avatar Nov 14 '22 06:11 georgiosd

CaptureException is thread-safe right?

Yes.

mattjohnsonpint avatar Nov 14 '22 07:11 mattjohnsonpint

Stopped seeing this again after I got back 🤷

I'll ping you on discord if I see it again!

georgiosd avatar Dec 19 '22 12:12 georgiosd