How do I get access to the extended properties of an exception?
This works very well to add extended properties to a LogEntry object:
Dim dictionary As New Dictionary(Of String, Object)()
Dim provider As DebugInformationProvider = New DebugInformationProvider
Dim logEntry As LogEntry = New LogEntry()
logEntry.Message = "Logged with context specific information"
logEntry.ExtendedProperties = dictionary
But I want to do the exact same thing for my exception, below:
Throw New Exception("my test exception")
Catch ex As Exception
Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex, "Log Only Policy")
If (rethrow) Then
**In the end I want to pump out the full stack trace when an exception is thrown. Any articles or work around for this?
You can create a new exception, make the actual excecption an inner exception - and then attach your Dictionary<> to the .Data property of your new created exception, and use that in the method.