I'm investigating a stack trace, and I came accross this output:
Server stack trace:
...
at MyProject.Data.Notifications.NotificationCache.InitialisedCache() in NotificationCache.cs: line 72
at System.Lazy`1.CreateValue()
Exception rethrown at [0]:
at System.Lazy`1.get_Value()
at MyProject.Data.Notifications.NotificationCache.AddItemToCache(NotificationDto dto) in NotificationCache.cs: line 82
bla bla bla
Could somebody please explain what the Exception rethrown at [0]:
means and show some simple scenario how to replicate it?
I tried to replicate it via try/catch/throw, try/catch ex/throw ex etc but I could not.
Lazy<T>.CreateValue
calls Exception.PrepForRemoting()
, which is where the "Exception rethrown at [0]" bit gets added. This is a bit of an odd design choice on the author's part, but presumably he was using it as a way to get the "split" stack trace that would allow you to see both the code that caused the exception and the code that called it, despite the fact that the former is invoked via a delegate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With