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'.
The System.Data.OperationAbortException-class (I'm assuming you mean this one, as you didn't fully qualify it in your question). has no public constructor and is sealed. These are strong hints that the framework designers didn't want you to use that exception for your own purposes. Presumably, because some inner workings of the framework would get confused if you did.
You should use a different exception for your purposes. From the message text you pass the following existing exceptions come to mind:
When selecting an existing exception from the .NET framework, make sure you not just select it by the name of the class alone. Make sure you read the respective MSDN page to understand the (original) intend for the exception. The respective documentation always starts with the words "The exception that is throw ...". If you find that text to match your intend, reuse the exception from the framework (or derive from it for finer control when eventually catching the exception).
Or create your own exception type, if you must.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With