Skip to content

Conversation

@jjonescz jjonescz marked this pull request as ready for review November 5, 2025 13:24
@jjonescz jjonescz requested a review from a team as a code owner November 5, 2025 13:24
@jjonescz jjonescz requested review from 333fred and JoeRobich November 5, 2025 13:25

// 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")]
Copy link
Member

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>())
Copy link
Member

@jasonmalinowski jasonmalinowski Nov 6, 2025

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.

Copy link
Member Author

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?

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 this pull request may close these issues.

2 participants