Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for CERs #14424

Closed
Kukkimonsuta opened this issue Apr 8, 2015 · 4 comments
Closed

Support for CERs #14424

Kukkimonsuta opened this issue Apr 8, 2015 · 4 comments
Assignees
Labels
enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@Kukkimonsuta
Copy link

Split from #14419

Are CERs going to be supported or is there viable alternative?

Recorded uses in (3rd party) libraries:

@sharwell
Copy link
Member

sharwell commented Apr 8, 2015

The ReliabilityContract attributes could probably be removed without any other changes when targeting a framework that doesn't support them.

I would think CriticalFinalizerObject already exists since it's the base class of SafeHandle. However, if it doesn't the use of it in LibGit2Sharp could probably be rewritten using CriticalHandle instead. This would actually apply to all builds and not just be a special consideration for CoreCLR.

@joshfree
Copy link
Member

@jkotas can you comment on CERs

@jkotas
Copy link
Member

jkotas commented Oct 13, 2015

CERs were primarily invented for SQL CLR, to ensure that user code cannot leak or otherwise damage the SQL process. The runtime was required to recover from OOM or thread abort in any spot.

We gave up on providing this level of robustness for .NET Core runtime and framework because of it is incredibly expensive to code and test for:

  • Thread abort is not supported in .NET Core.
  • OOM is on fail-fast plan: When the process hits OOM or similar exception in a bad spot, it will be terminated. It is consistent with the cloud programming patterns: When designing for cloud, one should assume that the process can be killed any time without warning, etc.

Porting guidance:

  • CERs should be stripped when porting to .NET Core: CriticalFinalizerObject replaced with regular Object, CER attributes removed, etc.
  • Places in the program where the cleanup is required to happen – and the program cannot safely continue if it does not - should be either left as unhandled exception that terminates the process, or wrapped with try { ... } catch { Environment.FailFast(...); }.

If CERs are frequent problem to deal with for porting large amounts of code, we can consider creating CER compat pack for CoreCLR with dummy implementation.

@Kukkimonsuta
Copy link
Author

Thank you for the explanation, I believe there is nothing to add and this issue can be closed.

@jkotas jkotas closed this as completed Oct 13, 2015
ethomson referenced this issue in libgit2/libgit2sharp Jun 24, 2017
.NET Core no longer supports CriticalFinalizerObject.  We now get the
strictest finalization guarantees simply inheriting Object.
See https://github.com/dotnet/corefx/issues/1345
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-rtm milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests

6 participants