[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
I saw this attribute in the reflector for the base class libraries in .NET. Maybe immutable guarantees are supported internally?
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
I saw this attribute in the reflector for the base class libraries in .NET. Maybe immutable guarantees are supported internally?
It has nothing to do with immutability, check the MSDN documentation
Read up about it here and here.
The short summary is that its instructing the runtime to guarantee execution of finally blocks in the face of any async exceptions (like ThreadAbortException).
The standard CLR host will hold off aborting thread while finally blocks are executing.
However, when SQL Server hosts the CLR is may trigger rude aborts which can happen while the CLR is running finally clauses. In these kind of cases, CERs are used to ensure state does not corrupt.
There are certain requirement you must meet inside CERs (For example, you are not allowed to box stuff inside a CER).