roslyn
roslyn copied to clipboard
Track the project name for a generator driver and report it via ETW
When there are multiple projects building in parallel (such as in a VS solution) the current generator telemetry doesn't allow you to know from which project each invocation of the generator is coming from.
This adds an optional value to the generator options where a caller can add a project name. It populates that from the tooling to pass in the project name + id.
This PR modifies public API files. Please follow the instructions at https://github.com/dotnet/roslyn/blob/main/docs/contributing/API%20Review%20Process.md for ensuring all public APIs are reviewed before merging.
API Review
- We're not sure if
projectNameis sufficient, or appropriate for the compiler layer to handle- Does ETW support passing a dictionary
- Even if it doesn't, there's nothing saying this needs to go to ETW. It could go to some other logging framework.
- What about a dictionary of properties?
- We don't want a general series of properties, as this is the general generator options. Needs to be specific.
IdentificationProperties: used by the generator driver to identify itself in logging frameworks.
Conclusion: API Approved:
- public GeneratorDriverOptions(IncrementalGeneratorOutputKind disabledOutputs = IncrementalGeneratorOutputKind.None, bool trackIncrementalGeneratorSteps = false, string? baseDirectory = null)
+ public GeneratorDriverOptions(IncrementalGeneratorOutputKind disabledOutputs = IncrementalGeneratorOutputKind.None, bool trackIncrementalGeneratorSteps = false, string? baseDirectory = null, ImmutableDictionary<string, string?>? identificationProperties = null)