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:
- 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.
- 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?
- It's not clear to me why this code even cares about which workspace might have this registered.
(Filed per @ToddGrun's request here.)