dotnet / dotnet/roslyn

Fix AbstractCreateServicesOnTextViewConnection to not create VisualStudioWorkspace

Open
#78,355 3 comments 0 reactions 1 assignee Assigned to @jasonmalinowski View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Right now we have an AbstractCreateServicesOnTextViewConnection which exists to trigger loading some parts of Roslyn for the first time a file is opened. For reasons that aren't clear to me, rather than just triggering on the opening of a text view, it's also using MEF to register a document opened handler against the VisualStudioWorkspace. There's a few problems I see with this code:

1. If you're just opening a loose C# file, there's no reason to be asking for a VisualStudioWorkspace on the UI thread during MEF creation.
2. This code seems suspicious to be registering for that event, since it seems like that event might have already happened for the first file being opened. So is this only running for the _second_ open?
3. It's not clear to me why this code even cares about which workspace might have this registered.

(Filed per @ToddGrun's request [here](https://github.com/dotnet/roslyn/pull/78134/files/45c094fbd919b6ff7099e8e7f2c728bff31c1d28#r2057207939).)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.