Consider marking HandleProcessCorruptedStateExceptionsAttribute as obsolete/hidden #31157
Labels
api-suggestion
Early API idea and discussion, it is NOT ready for implementation
area-System.Runtime
Milestone
System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute
is an attribute used to enable handling of corrupted state exception (e.g.AccessViolationException
) from the managed code, introduced in .NET Framework 4.0. This allows the consumers to deal withAccessViolationException
s with thetry-catch
/try-finally
clause and either swallow or log the exception instead ofFailFast
ing. However, I personally have not seen legitimate use of the attribute but to work around crashes caused by flaky libraries or unsafe codes, and swallowing exceptions in such case can introduce a security risk.Furthermore, there was a decision to disable the handling mechanisms of corrupted state exceptions in .NET Core.
Given that this attribute does not work anymore on .NET Core & it is inherently dangerous to use this attribute to handle such exceptions in the first place, I think the attribute should be obsoleted or hidden from the IDE to discourage the use of it. At the moment, it does not appear that this incompatibility is not so widely known (Searching on Bing/Google or looking at MS docs barely give any information about the state of the attribute on .NET Core). I believe that either of those options would effectively discourage the use of the type.
The text was updated successfully, but these errors were encountered: