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

No documentation on difference between RegisterSourceOutput and RegisterImplementationSourceOutput #57963

Open
YairHalberstadt opened this issue Nov 24, 2021 · 5 comments

Comments

@YairHalberstadt
Copy link
Contributor

They have exactly the same API, no doc comments, no documentation at all anywhere, and the name hardly gives it away.

https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md is out of date.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 24, 2021
@pCYSl5EDgo
Copy link

Read Issue #54723

@jaredpar jaredpar added Bug New Feature - Source Generators Source Generators and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 7, 2022
@jaredpar
Copy link
Member

jaredpar commented Jan 7, 2022

@chsienki FYI

@lsoft
Copy link

lsoft commented Jun 15, 2022

Hello! Incremental generators are mature now. It's time to share a complete documentation about the subject! :)

@aseanwatson
Copy link

@chsienki,

Should this be closed?

Your change #58344 added the following text:

RegisterImplementationSourceOutput works in the same way as
RegisterSourceOutput but declares that the source produced has no semantic
impact on user code from the point of view of code analysis. This allows a host
such as the IDE, to chose not to run these outputs as a performance
optimization. A host that produces executable code will always run these
outputs.

I'll note that I found this issue because these pages on learn.microsoft.com don't describe the differences:

And

@ivandrofly
Copy link

In another word use RegisterImplementationSourceOutput to generate codes that will be accessed during run-time (using reflection)

Use RegisterSourceOutput: to generate code that you want to have access directly from the IDE (Visual Studio, Rider...) intellisense.

Example

Let say you are generating a c# record public record Person(string Name)
From the project that is using the generator you want the Name property from the record Person to be available directly in you IDE (Visual Studio, Rider, Vs Code...) so in this case use RegisterSourceOutput

Anything else use RegisterImplementationSourceOutput... for example in mappers

Links where you can learn more about this
https://www.thinktecture.com/net/roslyn-source-generators-introduction/
#54723
#66885

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants