How I can to create OperationAbortedException? This code does not work:
var ex = new OperationAbortedException("Cannot update event comment");
ERROR: Cannot access private constructor ‘OperationAbortedException’.
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.
If you are talking about the
System.Data.OperationAbortedExceptionthen no, you can not construct an instance directly, there are no public consrtuctors.If you really wanted to, you could use reflection with the method described in this answer, but I reccomend that you do not. It would be a corruption of the framework’s design.
Here is the code you could use but, please don’t.
You’d have to work out which private constructor to use, if there is more than one, and which properties should be set to what. There is no garauntee that this behaviour would persist in later framework versions.