Skip to content

Add EmitDifferenceOptions #78035

@tmat

Description

@tmat

Background and Motivation

Hot Reload: The IDE needs to configure the compiler to emit different code based on the capabilities of the runtime.

Proposed API

namespace Microsoft.CodeAnalysis.Emit;

class Compilation
{
  public EmitDifferenceResult EmitDifference(
      EmitBaseline baseline,
      IEnumerable<SemanticEdit> edits,
      Func<ISymbol, bool> isAddedSymbol,
      Stream metadataStream,
      Stream ilStream,
      Stream pdbStream,
+     EmitDifferenceOptions options,
      CancellationToken cancellationToken);
}

+public readonly struct EmitDifferenceOptions
+{
+    public static readonly EmitDifferenceOptions Default;
+
+    /// <summary>
+    /// True to emit FieldRva table entries. The runtime must support this feature.
+    /// </summary>
+    public bool EmitFieldRva { get; init; }
+
+    public EmitDifferenceOptions();
}

Usage Examples

Alternative Designs

Risks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.Feature Requestapi-approvedAPI was approved in API review, it can be implemented

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions