Skip to content

Defer part rejection exception in VSTypeScriptFormattingService to time of construction#58940

Merged
sharwell merged 3 commits into
dotnet:mainfrom
sharwell:language-services
Jan 21, 2022
Merged

Defer part rejection exception in VSTypeScriptFormattingService to time of construction#58940
sharwell merged 3 commits into
dotnet:mainfrom
sharwell:language-services

Conversation

@sharwell
Copy link
Copy Markdown
Contributor

@sharwell
Copy link
Copy Markdown
Contributor Author

@jasonmalinowski Based on the comments from @zkat , I plan to keep this pull request in its current form and marking it as auto-merge.

Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

Let's switch to the AllowDefault pattern since we already have other PRs in flight expecting that.

…quire it in the constructor

This change defers the MEF part creation exception in MEF 2 scenarios
from the call to GetExports to the call (if any) to Lazy<>.Value. Rather
than reject the part from the catalog entirely, this change allows the
part to be included as long as it is not accessed.
@sharwell sharwell changed the title Export VSTypeScriptFormattingService using a factory instead of directly Defer part rejection exception in VSTypeScriptFormattingService to time of construction Jan 21, 2022
Comment on lines +25 to +26
public VSTypeScriptFormattingService([Import(AllowDefault = true)] IVSTypeScriptFormattingServiceImplementation impl)
=> _impl = impl ?? throw new ArgumentNullException(nameof(impl));
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.

This probably deserves a comment here explaining why we are doing AllowDefault but then still blocking it. Feel free to add as a follow-up since CI is green.

@sharwell sharwell merged commit d1339be into dotnet:main Jan 21, 2022
@ghost ghost added this to the Next milestone Jan 21, 2022
@sharwell sharwell deleted the language-services branch January 24, 2022 19:11
@bernd5
Copy link
Copy Markdown
Contributor

bernd5 commented Jan 24, 2022

https://sharplab.io seems to fail even after this merge, see.: ashmind/SharpLab#922

@sharwell
Copy link
Copy Markdown
Contributor Author

@bernd5 That issue was filed before this change was merged. Do you have information about the failure which still occurs?

@bernd5
Copy link
Copy Markdown
Contributor

bernd5 commented Jan 24, 2022

@sharwell: Oh, I have mixed up a commit.
SharpLab seems to be still one commit behind - so it might work soon 🙂.

@RikkiGibson RikkiGibson modified the milestones: Next, 17.2.P1 Feb 4, 2022
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.

5 participants