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

Module cancellation and stack probing instrumentations #71961

Open
tmat opened this issue Feb 5, 2024 · 3 comments
Open

Module cancellation and stack probing instrumentations #71961

tmat opened this issue Feb 5, 2024 · 3 comments
Labels
api-approved API was approved in API review, it can be implemented blocking API needs to reviewed with priority to unblock work Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request
Milestone

Comments

@tmat
Copy link
Member

tmat commented Feb 5, 2024

Background and Motivation

The goal of the stack probing instrumentation is to protect a host process executing user-specified C# code from accidental mistakes that cause unrecoverable stack overflow.

Details: #71896

Proposed API

namespace Microsoft.CodeAnalysis.Emit
{
   public enum InstrumentationKind
    {
        None = 0,
        TestCoverage = 1,

+       /// <summary>
+       /// Instruments all methods, local functions and lambdas in the code with calls to <see cref="RuntimeHelpers.EnsureSufficientExecutionStack"/>,
+       /// to guard against accidental stack overflow.
+       /// </summary>
+       StackOverflowProbing = 2,

+       /// <summary>
+       /// Instruments code with calls to <see cref="CancellationToken.ThrowIfCancellationRequested"/> on a module-level defined 
+       /// <see cref="CancellationToken"/> to enable cancellation of code that hasn't necessarily been written as cancellable.
+       /// </summary>
+       /// <remarks>
+       /// The <see cref="CancellationToken"/> is emitted to a static field <code>&lt;PrivateImplementationDetails&gt;.ModuleCancellationToken</code>.
+       /// </remarks>
+       ModuleCancellation = 3
    }
}
@tmat tmat added Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request labels Feb 5, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Feb 5, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@333fred 333fred added the api-ready-for-review API is ready for review, it is NOT ready for implementation label Feb 22, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@tmat tmat added the blocking API needs to reviewed with priority to unblock work label Feb 29, 2024
@chsienki chsienki added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for review, it is NOT ready for implementation labels Mar 14, 2024
@chsienki
Copy link
Contributor

Api review: approved

@arunchndr arunchndr removed the untriaged Issues and PRs which have not yet been triaged by a lead label Nov 6, 2024
@arunchndr arunchndr added this to the Backlog milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-approved API was approved in API review, it can be implemented blocking API needs to reviewed with priority to unblock work Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request
Projects
None yet
Development

No branches or pull requests

4 participants