-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add SDK analyzer assembly redirector #80969
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| // Internal for testing. | ||
| [SuppressMessage("RoslynDiagnosticsReliability", "RS0034: Exported parts should have a public constructor marked with 'ImportingConstructorAttribute'", | ||
| Justification = "This is an internal constructor exposed for testing and delegated to by the public importing constructor")] |
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.
If we're not actually using the MEF component for testing, the better pattern might be to break the stuff needed for testing out to a separate class and then test that directly.
| [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] | ||
| public SdkAnalyzerAssemblyRedirector(SVsServiceProvider serviceProvider) : this( | ||
| Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"CommonExtensions\Microsoft\DotNet")), | ||
| serviceProvider.GetServiceOnMainThread<SVsActivityLog, IVsActivityLog>()) |
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.
Eek this is a deadlock waiting to happen. Since this isn't cross-repo anymore, can we adjust the interface to follow VS threading rules? Especially since this just appears for logging, we could easily fetch it asynchronously and write out the log once we get the service.
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.
follow VS threading rules?
What are those? Would using this overload from RoslynServiceExtensions be correct?
public static TInterface GetService<TService, TInterface>(
this IServiceProvider serviceProvider,
JoinableTaskFactory joinableTaskFactory)we could easily fetch it asynchronously and write out the log once we get the service.
So I would need to create a producer/consumer pattern basically?
Moved here from the SDK per David Kean's request (to avoid another assembly load). Originally lived here:
Validation: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/684831