Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 21, 2022

Conversation

sharwell
Copy link
Member

@sharwell
Copy link
Member 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
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
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
Contributor

bernd5 commented Jan 24, 2022

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

@sharwell
Copy link
Member Author

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

@bernd5
Copy link
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