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

Project contains numerous invalid exports of ILanguageService #1437

Closed
sharwell opened this issue Apr 10, 2024 · 5 comments · Fixed by #1442
Closed

Project contains numerous invalid exports of ILanguageService #1437

sharwell opened this issue Apr 10, 2024 · 5 comments · Fixed by #1442
Labels

Comments

@sharwell
Copy link
Member

ILanguageService needs to be exported using ExportLanguageServiceAttribute.

Here is one example:

These exports are breaking Visual Studio in 17.10 Preview 3 and newer, where additional validation is applied to ILanguageService and ILanguageServiceFactory exports.

@josefpihrt
Copy link
Collaborator

@sharwell Is this how it should be?

[ExportLanguageService(typeof(ILanguageService), LanguageNames.CSharp)]
[ExportMetadata("Language", LanguageNames.CSharp)]
[ExportMetadata("ServiceType", "Roslynator.CodeMetrics.ICodeMetricsService")]
internal class CSharpCodeMetricsService : CodeMetricsService

@sharwell
Copy link
Member Author

@josefpihrt The ExportMetadata lines can be removed. You just need this:

[ExportLanguageService(typeof(ICodeMetricsService), LanguageNames.CSharp)]

@josefpihrt
Copy link
Collaborator

@sharwell Thanks!

@josefpihrt
Copy link
Collaborator

Fix has been released.

@josefpihrt josefpihrt added the Bug label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants