How do I catch FaultException for any Exception derived TDetail?
I tried catch( FaultException<Exception> ) {} but that does not seem to work.
Edit
The purpose is to gain access to the Detail property.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
FaultException<>inherits fromFaultException. So change your code to:=== Edit ===
If you need
FaultException<T>.Detail, you’ve a couple of options but none of them are friendly. The best solution is to catch each individual type you want to catch:I advise you do it like that. Otherwise, you’re going to dip into reflection.
Reflection is slow, but since exceptions are supposed to be rare… again, I advise breaking them out as you are able to.