Skip to content

Conversation

@chsienki
Copy link
Member

@chsienki chsienki commented Nov 4, 2025

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.

@dotnet-policy-service dotnet-policy-service bot added VSCode Needs API Review Needs to be reviewed by the API review council labels Nov 4, 2025
@dotnet-policy-service
Copy link
Contributor

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.

/// <param name="baseDirectory">Absolute path to the base directory used for file paths of generated files.</param>
/// <exception cref="ArgumentException"><paramref name="baseDirectory"/> is not an absolute path.</exception>
public GeneratorDriverOptions(IncrementalGeneratorOutputKind disabledOutputs = IncrementalGeneratorOutputKind.None, bool trackIncrementalGeneratorSteps = false, string? baseDirectory = null)
public GeneratorDriverOptions(IncrementalGeneratorOutputKind disabledOutputs = IncrementalGeneratorOutputKind.None, bool trackIncrementalGeneratorSteps = false, string? baseDirectory = null, string? projectName = null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@333fred Do we need to go thru an API review meeting for this, or is it ok to just do it via mail?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think an email is fine.

additionalTexts,
generatedFilesBaseDirectory);
generatedFilesBaseDirectory,
$"{projectState.Name} ({projectState.Id})");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also be passing a project name, or some name, when doing this on the command line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good idea.

Pass in assembly name as tracking name from the command line compiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Feature - Source Generators Source Generators Needs API Review Needs to be reviewed by the API review council VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants