Click here to Skip to main content
15,915,076 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a situation where we catch an exception, then create a new Exception( passing in the original exception, adding a string for our uses.
This new Exception is throwing off our exception pointers we get from Marshal.GetExceptionPointers.

If I call GetExceptionPointers directly after the initial catch, then we are fine. But if called from a later point then we get the new ep's from the new Exception.
So we are trying to determine if there is a way to grab the exception pointers from the original exception which we have passed through to the new one, possibly in the inner exception???
Most googling on this topic reveals null exceptions and the Marshal.GetExceptionPointers that we already know of.

Thank you so much for any help in advance. And please let me know if I need to add any detail?
Posted
Comments
Andreas Gieriet 10-Sep-14 14:18pm    
What exactly do you try to solve with exception pointers in C#? I never worked with exception pointers, but looking up the respective MSDN pages, it's entirely C++, not C#.

With C# exceptions, you can transport any information from the C# universe (maybe under certain circumstances with some restrictions on serializing capability). The only thing to know is that the call stack of a wrapping exception is a new one. But you can always extract the call stack from the inner exception and "merge" with the outer stack if needed in your application.

From that point of view, you could define your wrapper exception and store your exception pointer there (assuming the lifetime of that pointer lasts long enough).

But again: It's not clear what basic problem you try to solve. Maybe, there is a simpler solution than relaying on exception pointers.

Cheers
Andi
LLAKW 10-Sep-14 14:33pm    
Thank you for the comment.
EP's are mostly in the C++ world, though we can get them in C# for the purposes of writing out a minidump. We can then load that minidump file into our environment and debug which if done properly, will break at the exact exception caught on the system.
So machine A down the hall crashes and we have the minidump file. We load the file on our system and start debugging and we can immediately see the problem. I hope that helps for the why. And the exception pointers have to be there in the minidump call in order for this to work.
Thank you once again.
Andreas Gieriet 10-Sep-14 15:29pm    
Can you treat the exception pointer data as blob in the C# world and at the point where you want to do some action on the blob, add some logic to evaluate that blob?
Andi
LLAKW 10-Sep-14 16:45pm    
Thank you for the response and question. Only answer I have so far is, not that I am aware of. I am looking to see if someone knows of something like that, that can be done. I have not been able to so far.
kbrandwijk 10-Sep-14 21:34pm    
Have you consider looking into Microsoft Monitoring Agent to gather Intellitrace data from a production environment, which serves the same purpose: being able to 'replay' in Visual Studio? http://msdn.microsoft.com/en-us/library/hh398365.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900