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

SA1412 "fix all" does not work properly on files that are closed #1169

Open
sharwell opened this issue Aug 9, 2015 · 1 comment
Open

SA1412 "fix all" does not work properly on files that are closed #1169

sharwell opened this issue Aug 9, 2015 · 1 comment

Comments

@sharwell
Copy link
Member

sharwell commented Aug 9, 2015

The "Fix all in project" operation for SA1412 is currently only applying changes to files that are open in the editor. Presumably this is caused by dotnet/roslyn#4262, where it thinks all the files on disk are UTF-8 without byte order mark, but all files open in the editor are Windows-1252 (the default system encoding).

When I opened any single file violating this rule and used File → Advanced Save Options... to explicitly change the file to UTF-8 without byte order mark, it allowed me to apply the fix all operation to the entire solution. This means all of the equivalence keys from the project were using "Windows-1252" if the file was open, and "utf-8" if the file was closed.

@sharwell
Copy link
Member Author

sharwell commented Aug 9, 2015

💭 It might be possible to fix this by passing the name of the detected encoding as an additional property of the diagnostic, and using that rather than probing the file again from within the code fix provider.

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

1 participant