-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Track GeneratedFilesOutputDirectory in the IDE #75311
Conversation
6b0ff3f
to
4e5a45d
Compare
@dotnet/roslyn-ide @dotnet/roslyn-compiler @RikkiGibson @CyrusNajmabadi ptal |
367b288
to
1446cce
Compare
1b135b1
to
ac3feef
Compare
It's unclear to me why we're taking this approach in this PR, especially given this comment:
What if we just...didn't do that, and used the source-generator relative path for the metadata name being generated in either case? Would that be much simpler, and also avoid having to create several public APIs in the process? (I recognize I'm out of the loop here, but it'd be nice if we can write down somewhere what alternate approaches were considered here.) |
@RikkiGibson To comment on that. The change he's made in the compiler was mainly for interceptors which also use the file path: #71879 Using full paths for generated files solves other issues. See #51998. I don't see any drawback. |
The latest design of interceptors, which we are pushing all generators to move to, doesn't actually use the file path. It uses the content checksum, and a file name for error reporting. re: generated files having full paths in general: Behavior of code differs depending on file path in a number of scenarios. It seems like a good thing to always use the same full paths that "would be used when emitting the files to disk". It seems like it is a general preference that we have the ability to take those files emitted to disk, add them to compilation, then remove the associated generators, and get an equivalent result from compilation. |
API review feedback incorporated. |
src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/SourceGeneration/GeneratorDriverOptions.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/SourceGeneration/GeneratorDriverTests.cs
Outdated
Show resolved
Hide resolved
src/Features/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems reasonable. a s long as both APIs were approved, i'm ok with this.
Flows
CompilerGeneratedFilesOutputPath
msbuild property to compiler driver through Solution snapshot.The compiler constructs the full path of a source generated file from the value of
CompilerGeneratedFilesOutputPath
msbuild property, if set, or from output path otherwise. This path is then used to generate metadata name of file-scoped types.The IDE currently uses relative paths for source generated files. This causes compiler crashes during EnC since the metadata names generated by delta emit differ from those generated by the compiler during build. This change updates the IDE to use full paths for source generated files in the same way as the compiler does.
Fixes #51998, #72331
Public API:
TODO: