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

Add an API that lets consumers wait on language service to be up-to-date with a given project version #3425

Open
davkean opened this issue Mar 28, 2018 · 23 comments
Assignees
Labels
Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc Parity-Legacy-API Missing or behavior differences in APIs from the legacy project system. Parity-Legacy-Feature Missing features from the legacy project system. Triage-Approved Reviewed and prioritized
Milestone

Comments

@davkean
Copy link
Member

davkean commented Mar 28, 2018

We need an API that lets consumers wait on the language service to be up-to-date with a given project version, similar to IProjectTreeService.PublishTree:

Task PublishLatestAsync(
  CancellationToken cancellationToken = default(CancellationToken));

Task PublishAsync(
  IImmutableDictionary<NamedIdentity, IProjectVersionRequirement> minimumRequiredDataSourceVersions,
  CancellationToken cancellationToken = default(CancellationToken));

This lets services such as CodeModel provider to block this before returning a CodeModel item, or the renamer to block on this attempting to rename. Also lets us block VS integration tests on this work before attempting to test state.

Without this, it's impossible to know when ProjectItem.CodeModel is going to return a result.

@davkean davkean self-assigned this Mar 28, 2018
@davkean davkean added Discussion/Question A discussion or question about the project that will not be treated as a bug or feature request. Feature Request Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc Parity-Legacy-API Missing or behavior differences in APIs from the legacy project system. and removed Discussion/Question A discussion or question about the project that will not be treated as a bug or feature request. labels Mar 28, 2018
@davkean davkean added this to the 15.8 milestone Mar 28, 2018
@AbhitejJohn
Copy link
Contributor

Happy to test this out when we have one.

@AbhitejJohn
Copy link
Contributor

@davkean : Did we get a chance to schedule this work in yet...

@davkean
Copy link
Member Author

davkean commented May 3, 2018

We're doing this as part of the language service hookup rewrite in 15.8. First part is in review, but we've only started on 15.8 this week. We're at least a sprint away from it.

@japj
Copy link

japj commented Oct 11, 2018

Any update on this? It seems this is a blocking issue for
https://developercommunity.visualstudio.com/content/problem/145930/create-unit-test-context-menu-missing-net-core-pro.html

@Pilchie
Copy link
Member

Pilchie commented Oct 12, 2018

Note also that as part of this work we should use this API to push information to the VS Platform's new Operation Progress API so that we can track the async initialization.

@davkean davkean modified the milestones: 15.9, 16.0 Oct 30, 2018
davkean added a commit to davkean/project-system that referenced this issue Nov 14, 2018
This fixes a deadlock when the UI thread is blocked on Loaded, such as during PrioritizedProjectLoad. This occured because MultiLifetimeComponent.Loaded was backed by a TaskCompletionSource that did not have a JoinableTask relationship to the code that completed it (MultiLifetimeComponent.LoadAsync).

I sat down with Andrew Arnott came up with a design that creates the relationship. I've used the name Publish (mimicing ITreeService, etc) as this method is basically the precursor to dotnet#3425.
davkean added a commit to davkean/project-system that referenced this issue Nov 14, 2018
This fixes a deadlock when the UI thread is blocked on Loaded, such as during PrioritizedProjectLoad. This occured because MultiLifetimeComponent.Loaded was backed by a TaskCompletionSource that did not have a JoinableTask relationship to the code that completed it (MultiLifetimeComponent.LoadAsync).

I sat down with Andrew Arnott came up with a design that creates the relationship. I've used the name Publish (mimicing ITreeService, etc) as this method is basically the precursor to dotnet#3425.
@jjmew jjmew modified the milestones: 16.0, 16.1 Dec 17, 2018
@kristianjaeger
Copy link

@davkean Any updates on this? Thank you.

@AliBayatGH
Copy link

It is December 30, 2018, and we are still on 15.9.4 with no create unit testing on .NET Core projects.

@duaneking
Copy link

Any updates?

davkean added a commit to davkean/project-system that referenced this issue Jun 24, 2020
We can be pushed the same value of ConfiguredProjectVersion when other input data source versions change, don't fail in this case. We should be tracking those versions, but I'll leave that for dotnet#3425.
davkean added a commit to davkean/project-system that referenced this issue Jun 24, 2020
Fixes: dotnet#6121

We can be pushed the same value of ConfiguredProjectVersion when other input data source versions change. Don't fail in this case. We should be tracking those versions, but I'll leave that for dotnet#3425.
@jjmew jjmew modified the milestones: 16.7, 16.x Jun 26, 2020
@drewnoakes drewnoakes modified the milestones: 16.x, 17.x Oct 6, 2021
@ocallesp ocallesp assigned ocallesp and unassigned davkean Oct 20, 2022
@ocallesp ocallesp assigned drewnoakes and unassigned ocallesp Nov 16, 2022
@tanveerbadar
Copy link

Running VS 17.4 preview right now, still nothing after more than 4 years.

You folks do awesome work, but a timeline would be good.

@drewnoakes
Copy link
Member

@tanveerbadar can you share the scenario for which you need this API?

@kristianjaeger
Copy link

@drewnoakes I had to reread this issue since it's been so long but I believe this is related to having the create unit tests option for .NET Core or these days .NET 7 projects I suppose. :). Thanks.

@drewnoakes
Copy link
Member

@drewnoakes I had to reread this issue since it's been so long but I believe this is related to having the create unit tests option for .NET Core or these days .NET 7 projects I suppose. :). Thanks.

My reading of the linked ticket suggests that the unit testing team was able to address that without needing the API described here does that not match your experience?

@kristianjaeger
Copy link

Thanks @drewnoakes . This issue is so old I had not revisited it recently. That's great if the unit testing team fixed that issue with the 'create unit tests' option! That's mostly what I was interested in not sure about others here. Thanks.

@PeterMacej
Copy link

My problem was with ProjectItem.FileCodeModel being null after loading a project with my VS extension. This was reported in #2544. My dirty hack was to wait some time to make sure the FileCodeModel is initialized.

@drewnoakes
Copy link
Member

@PeterMacej that makes sense. This is something I hope to implement before long as it would be useful in several places. The challenge is doing it in a way that won't lead to hangs when, for example, configurations are switched.

@tanveerbadar
Copy link

@tanveerbadar can you share the scenario for which you need this API?

There was some issue (which I can't recall) about creating unit tests in VS which linked to this and cited it as the blocking reason.

@drewnoakes
Copy link
Member

@tanveerbadar that issue is no longer blocked on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc Parity-Legacy-API Missing or behavior differences in APIs from the legacy project system. Parity-Legacy-Feature Missing features from the legacy project system. Triage-Approved Reviewed and prioritized
Projects
None yet
Development

No branches or pull requests