Skip to content

Workaround breaking change to allow LSP integration tests to run on 16.10p1#52456

Merged
dibarbet merged 3 commits intodotnet:main-vs-depsfrom
dibarbet:workaround_16_10_p1_lsp
Apr 7, 2021
Merged

Workaround breaking change to allow LSP integration tests to run on 16.10p1#52456
dibarbet merged 3 commits intodotnet:main-vs-depsfrom
dibarbet:workaround_16_10_p1_lsp

Conversation

@dibarbet
Copy link
Copy Markdown
Member

@dibarbet dibarbet commented Apr 7, 2021

See #52454

The loghub types moved in 16.10p2 to different assemblies and namespaces (the old assembly was removed). We reacted to this change in main-vs-deps, but this caused the LSP integration tests to fail server activation. The main-vs-deps code could not find the new types in 16.10p1 since 16.10p1 is still on the old assembly.

Workaround by not creating the LSP logger when the new types are missing. This should be removed when the integration test queue updates to 16.10p2.

@dibarbet dibarbet requested a review from a team as a code owner April 7, 2021 01:45
@ghost ghost added the Area-IDE label Apr 7, 2021
@dibarbet dibarbet added Area-Infrastructure LSP issues related to the roslyn language server protocol implementation labels Apr 7, 2021
// To allow LSP integration tests to run on 16.10 preview 1, we only setup the loghub
// logger if the MS.VS.Utilities assembly contains the LogHub types.
// FeatureFlags.IFeatureFlags is a known type in the MS.VS.Utilities assembly.
var traceConfigurationType = typeof(FeatureFlags.IFeatureFlags).Assembly.GetType("Microsoft.VisualStudio.LogHub.TraceConfiguration", throwOnError: false);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this check is tracked by #52454

var traceConfigurationType = typeof(FeatureFlags.IFeatureFlags).Assembly.GetType("Microsoft.VisualStudio.LogHub.TraceConfiguration", throwOnError: false);
if (traceConfigurationType != null)
{
logger = await CreateLoggerAsync(asyncServiceProvider, serverTypeName, clientName, jsonRpc, cancellationToken).ConfigureAwait(false);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does CreateLoggerAsync need to be marked as no-inline to avoid causing any type load issues? Or is LogHubLspLogger defined somewhere else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm not sure! LogHubLspLogger is our own (not problematic) logger type so everything that is a problem is entirely contained within CreateLoggerAsync if that makes a difference

@dibarbet dibarbet requested a review from jasonmalinowski April 7, 2021 17:50
// Make sure this isn't inlined so these types are only loaded
// after the type check in CreateAsync.
// Removal tracked by https://github.com/dotnet/roslyn/issues/52454
[MethodImpl(MethodImplOptions.NoInlining)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I'll say: the CLR has a bunch of rules about what it does and doesn't inline, so I presume this won't inline no matter what. But better to be explicit, and the NoInlining pattern is common enough around dealing with potentially missing types that it makes it a bit more clear what we're doing.

@dibarbet dibarbet merged commit fd9b249 into dotnet:main-vs-deps Apr 7, 2021
@ghost ghost added this to the Next milestone Apr 7, 2021
@dibarbet dibarbet deleted the workaround_16_10_p1_lsp branch April 7, 2021 18:12
@dibarbet dibarbet modified the milestones: Next, 16.10.P3 Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Area-Infrastructure LSP issues related to the roslyn language server protocol implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants