benaadams / Ben.Demystifier

High performance understanding for stack traces (Make error logs more productive)
Apache License 2.0
2.74k stars 118 forks source link

'AccessViolationException' thrown for 'EnhancedStackTrace.Current().ToString()' on NET Core 3.1 #212

Closed julealgon closed 1 year ago

julealgon commented 1 year ago

We've been using EnhancedStackTrace.Current().ToString() in a custom Serilog exception enricher for several years without issue.

Over the past couple days, we started observing a few "random" AccessViolationException's that would immediately crash our API and cause it to restart. The problem started after migrating said API from .NET 4.7.2 to .NET Core 3.1.

We don't know what exactly is causing this exception to only trigger for some stacktraces and do not have a repro scenario that we can share.

This is an absolutely critical issue so we are temporarily discontinuing the use of this library until it is fixed.

julealgon commented 1 year ago

I've now confirmed it also affects the Demistify method (which we also use in a different place):

image

benaadams commented 1 year ago

Perhaps is this? https://github.com/dotnet/runtime/issues/64657

julealgon commented 1 year ago

Perhaps is this? dotnet/runtime#64657

That looks like a very different scenario to me.

Honestly, now that I look at this, I should've come back here to close this issue. We've confirmed that the problem is not at all related to the Demystifier library since it was also throwing when just accessing the standard StackTrace property.

The only thing I can say for now is that migrating to .NET6 immediately solved the problem, and that this is likely the path we'll end up taking since .NET Core 3.1 is out of support anyways.