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

System.FormatException: A duplicate key 'RoslynExtensionsOptions:EnableAnalyzersSupport' was found. #629

Closed
kabamjdenton opened this issue Jan 8, 2020 · 4 comments · Fixed by #645
Assignees

Comments

@kabamjdenton
Copy link

The latest update with the auto update for the omnisharp.json file breaks the project initialization if the project also includes custom paths for other analyzers. It ends up duplicating the json block containing the paths.

It looks like this:

{ "RoslynExtensionsOptions": { "enableAnalyzersSupport": true, "locationPaths": [ "/Users/jdenton/customanalyzerpath", "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/common", "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/analyzers", "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/refactorings", "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/fixes" ], "EnableAnalyzersSupport": true, "LocationPaths": [ "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/common", "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/analyzers", "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/refactorings", "/Users/jdenton/.vscode/extensions/josefpihrt-vscode.roslynator-2.3.0/roslyn/fixes" ] },

@josefpihrt
Copy link
Collaborator

@AdrianWilczynski Could you take a look at it?

@AdrianWilczynski
Copy link
Contributor

Sorry for that 😓

I think it happens because I only checked pascal cased properties. If you put your custom paths into RoslynExtensionsOptions:LocationPaths instead of locationPaths, it should work - not duplicate anything and preserve all paths. Same goes for enableAnalyzersSupport - it needs to be in pascal case or it's gonna get duplicated as well.

Omnisharp doesn't seem to care about casing though, so I'll try to get it fixed.

@kabamjdenton
Copy link
Author

Any updates on this?

@AdrianWilczynski
Copy link
Contributor

Sorry it's taking so long. It's the end of the semester for me so I have assignments and exams to deal with (2 to go 😅). It will hopefully be over next week and I'm going to fix it then.

In the meantime I think you could try putting everything into pascal cased properties.

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.

3 participants