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

EnC API for method instrumentation #66770

Open
tmat opened this issue Feb 9, 2023 · 1 comment
Open

EnC API for method instrumentation #66770

tmat opened this issue Feb 9, 2023 · 1 comment
Assignees
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 Interactive-Debugging Interactive-EnC
Milestone

Comments

@tmat
Copy link
Member

tmat commented Feb 9, 2023

Background and Motivation

Enables instrumentation of methods using EnC updates.

See #66768

Proposed API

namespace Microsoft.CodeAnalysis.Emit;

+ public readonly struct MethodInstrumentation
+ {
+     /// <summary>
+     /// Kinds of instrumentation to apply to the entire method body.
+     /// </summary>
+     public ImmutableArray<InstrumentationKind> Kinds { get; init; }
+ }

public enum InstrumentationKind
{
     None = 0,
     TestCoverage = 1,

+    /// <summary>
+    /// Instruments the code to trace local variable writes.
+    /// </summary>
+    LocalStateTracing = 2,
}

public readonly struct SemanticEdit
{
+    /// <summary>
+    ///  Instrumentation update to be applied to a method.
+    /// <see cref="OldSymbol"/> and <see cref="NewSymbol"/> must be non-null <see cref="IMethodSymbol"/>s.
+    /// <see cref="Kind"/> must be <see cref="SemanticEditKind.Update"/>.
+    /// </summary>
+    public MethodInstrumentation Instrumentation { get; }

-    public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func<SyntaxNode, SyntaxNode?>? syntaxMap, bool preserveLocalVariables)

+    public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func<SyntaxNode, SyntaxNode?>? syntaxMap = null, bool preserveLocalVariables = false, MethodInstrumentation instrumentation = default)
}
@tmat tmat added Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request labels Feb 9, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 9, 2023
@tmat tmat added blocking API needs to reviewed with priority to unblock work api-ready-for-review API is ready for review, it is NOT ready for implementation Interactive-Debugging Area-Compilers and removed Area-Interactive labels Feb 9, 2023
@333fred
Copy link
Member

333fred commented Feb 22, 2023

API Review

  • The removal needs to be just removing the default parameters and adding EditorBrowsable.Never, like we do for the rest of our compat shims
  • Otherwise, looks good.

Approved.

@333fred 333fred 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 Feb 22, 2023
@arunchndr arunchndr removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 15, 2023
@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 Interactive-Debugging Interactive-EnC
Projects
None yet
Development

No branches or pull requests

5 participants