|
|
|
Community Member
|
|
I'm playing around with Day 1
http://www.sharpcrafters.com/blog/post/Day-1-e28093-OnExceptionAspect.aspx
Is there a way to be able to access class objects from the class throwing the error in OnException?
While the stacktrace is handy, I really need to be able to log other pieces of information to help track the error.
Conisder:
Class Foo Public User As String Public PhoneNumber As String Public Function Bar() As Boolean Dim c As Collection 'intentionally not set to an object to cause an error below c.Add(PhoneNumber) Return True End Function End Class
While using PostSharp would give me the stacktrace in OnException, I really need access to User and PhoneNumber to log those into the my message.
Any suggestions?
|
|
|
|
|
Gael Fraiteur
SharpCrafters
|
|
Sure, you can use (in C# syntax):
string phone = ((Foo) args.Instance).PhoneNumber
|
|
|
|
|
Community Member
|
|
|
|
|