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

Source Generators: Documents with generated content doesn't permit code fix execution #49533

Closed
AArnott opened this issue Nov 21, 2020 · 6 comments · Fixed by #58363
Closed

Comments

@AArnott
Copy link
Contributor

AArnott commented Nov 21, 2020

Version Used: VS 16.9 (30718.196.main)

Steps to Reproduce:

When using the Microsoft.CodeAnalysis.PublicApiAnalyzers analyzer in a project in combination with a source generator that produces public members, we get RS0016 warnings about public API that "is not part of the declared API."
Normally I'd fix this by navigating to that symbol and using a Code Fix provided by the PublicApiAnalyzers to add the necessary lines to the PublicAPI.Unshipped.txt file.

Expected Behavior:

The code fix is offered and can be executed.

Actual Behavior:

But (presumably because the generated code document is readonly) the code fixes are not available. While that may make sense from a "you can't change this doc anyway" perspective, it makes adding new lines to PublicAPI.Unshipped.txt very tedious.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 21, 2020
@CyrusNajmabadi
Copy link
Member

This shoudl likely go to https://github.com/DotNetAnalyzers/PublicApiAnalyzer. They will need to be updated to analyze these files.

@AArnott
Copy link
Contributor Author

AArnott commented Nov 21, 2020

@CyrusNajmabadi they do analyze the files. That's not the problem. The problem is roslyn won't show me code fixes in the generated file so I can fix those diagnostics.

@CyrusNajmabadi
Copy link
Member

Ah, gotcha. Yeah, that makes sense.

@jasonmalinowski
Copy link
Member

Yeah, this is due to the work that generated files still open in as Miscellaneous Files. Once that's fixed we expect this to work.

@jasonmalinowski jasonmalinowski removed the untriaged Issues and PRs which have not yet been triaged by a lead label Dec 1, 2020
@jasonmalinowski jasonmalinowski self-assigned this Dec 1, 2020
@jasonmalinowski jasonmalinowski added this to the 16.9 milestone Dec 1, 2020
@jinujoseph jinujoseph added the Bug label Dec 15, 2020
@jasonmalinowski jasonmalinowski modified the milestones: 16.9, 16.10 Jan 15, 2021
@jasonmalinowski
Copy link
Member

Closing this in favor of primary tracking bug #50676.

@jasonmalinowski
Copy link
Member

Reopening since this one is going to require some more work than is being tracked by the original bug.

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

Successfully merging a pull request may close this issue.

6 participants