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

Always try to register the EditorConfigDocumentOptionsProvider #40513

Merged

Conversation

JoeRobich
Copy link
Member

Updates the Workspace to try to register the EditorConfigDocumentOptionsProvider.

@JoeRobich JoeRobich requested a review from a team as a code owner December 19, 2019 22:25
@@ -74,6 +76,19 @@ protected Workspace(HostServices host, string? workspaceKind)

// initialize with empty solution
_latestSolution = CreateSolution(SolutionId.CreateNewId());

_taskQueue.ScheduleTask(() => TryRegisterDocumentOptionsProvider(), nameof(TryRegisterDocumentOptionsProvider));
Copy link
Member

Choose a reason for hiding this comment

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

  1. why on a task? are there race conditions here?
  2. what general value is this change trying to provide? What's wrong with MEF here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Talked to @jasonmalinowski offline and he helped me get to the root of the issue. Will update in a bit. Thanks for taking a look!

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. Thanks!

@sharwell
Copy link
Member

sharwell commented Jan 8, 2020

@JoeRobich let me know when this is ready for review

@JoeRobich
Copy link
Member Author

@sharwell I'm ready for feedback. Please take a look.

@JoeRobich JoeRobich closed this Jan 17, 2020
@JoeRobich JoeRobich reopened this Jan 17, 2020
@mavasani
Copy link
Contributor

Tagging @sharwell - I believe this fixes the issue we discussed offline.

@JoeRobich this change is required to enable .editorconfig based testing for CodeStyle layer.

@JoeRobich JoeRobich closed this Feb 20, 2020
@JoeRobich JoeRobich reopened this Feb 20, 2020
mavasani added a commit to mavasani/roslyn that referenced this pull request Feb 20, 2020
mavasani added a commit to mavasani/roslyn that referenced this pull request Feb 20, 2020
Extracted out of dotnet#41363 so it only contains the following changes:

1. Port analyzer/fixer/test files for ConvertSwitchStatementToExpression to shared layer
2. Options related namespace changes (see comment dotnet#41363 (comment) for details)
3. MEF based language service discovery in CodeStyle layer. dotnet#41462 tracks replacing this with a non-MEF based approach.
4. Minimal resx/xlf file changes - few were needed as the resources used by analyzer/fixer were moved to shared resx file.
5. Enable .editorconfig based unit test support for CodeStyle layer. NOTE: First commit dotnet@b006324 just ports changes from dotnet#40513 which are required to enable this support. This commit should become redundant once that PR is merged in.
@JoeRobich
Copy link
Member Author

@mavasani @sharwell I'm not sure what it is about my changes but the debug integration tests always timeout. I closed and reopened last night hoping that forcing it to update would get a passing build.

@mavasani
Copy link
Contributor

@JoeRobich The published artifacts have devenv.dmp and servicehub.dmp, which indicate following assert is being hit during cleanup: http://sourceroslyn.io/#Microsoft.CodeAnalysis.Workspaces/Shared/TestHooks/AsynchronousOperationListener.cs,118

@JoeRobich
Copy link
Member Author

PR #41477 would remove the use of GetService<IErrorLoggerService>

mavasani added a commit to mavasani/roslyn that referenced this pull request Feb 20, 2020
}

public IDocumentOptionsProvider? TryCreate(Workspace workspace)
public static IDocumentOptionsProvider? TryCreate(Workspace workspace)
{
if (!ShouldUseNativeEditorConfigSupport(workspace))
Copy link
Contributor

@mavasani mavasani Mar 2, 2020

Choose a reason for hiding this comment

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

@JoeRobich I was able to verify the integration test failures from this PR locally, and the root cause seems to be this code path (from workspace constructor) can be invoked from a background thread, but fetching options can force loading of option persisters, which seem to require UI thread on creation. I moved this specific check ShouldUseNativeEditorConfigSupport from here down into GetOptionsForDocumentAsync below and then the tests pass locally. I think the correct long term solution here would be to remove the UI thread requirement from option persisters during their construction OR add functionality in GlobalOptionsService to be able to force UI thread before loading persisters. For now, this change should unblock us.

Copy link
Contributor

Choose a reason for hiding this comment

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

By the way, do we still need to support legacy editorconfig provider? I would be fine with us deleting it completely as well. Tagging @jasonmalinowski

@JoeRobich JoeRobich merged commit 5e2bd9e into dotnet:master Mar 2, 2020
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.

4 participants