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

[LSP] Semantic tokens: Document null when first opening a Razor file #54547

Open
allisonchou opened this issue Jul 1, 2021 · 2 comments
Open
Assignees
Labels
Area-IDE Concept-Continuous Improvement Investigation Required LSP issues related to the roslyn language server protocol implementation Retriage
Milestone

Comments

@allisonchou
Copy link
Contributor

When a Razor file is opened, Roslyn at first is unable to find the Razor document, i.e. context.Document is null. However, the problem eventually resolves itself after a period of time. We should determine the core issue and implement a long-term solution.

@allisonchou allisonchou added Area-IDE LSP issues related to the roslyn language server protocol implementation labels Jul 1, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Jul 1, 2021
@jinujoseph jinujoseph added Concept-Continuous Improvement and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 9, 2021
@jinujoseph jinujoseph added this to the 17.0 milestone Jul 9, 2021
@dibarbet
Copy link
Member

dibarbet commented Jul 20, 2021

@allisonchou I just hit this issue (in SemanticTokensHandler({"Document is null. - line 49"}) and I happened to be under the debugger. I found out that that the request context's solution does have the document that the request URI is for. However, it appears as though the document properties service is null, this line

var documentPropertiesService = document.Services.GetService<DocumentPropertiesService>();

In the following screenshot you can see that the documentPropertiesService is null, and in the immediate window the difference in querying the solution with and without the client name.
image

As a result, the handler throws because that method found no document with a matching client name.

@jinujoseph jinujoseph modified the milestones: 17.0, 17.1 Sep 13, 2021
@allisonchou allisonchou modified the milestones: 17.1, 17.2 Jan 7, 2022
@jinujoseph jinujoseph modified the milestones: 17.2, 17.3 Apr 18, 2022
@allisonchou allisonchou modified the milestones: 17.3, 17.4 Sep 7, 2022
@allisonchou allisonchou removed their assignment Sep 7, 2022
@allisonchou allisonchou self-assigned this Sep 7, 2022
@allisonchou
Copy link
Contributor Author

@dibarbet have you seen this one recently? I haven't seen it in a while so I'm wondering if it might be resolved now.

@arkalyanms arkalyanms modified the milestones: 17.4, 17.6 P3 Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Concept-Continuous Improvement Investigation Required LSP issues related to the roslyn language server protocol implementation Retriage
Projects
None yet
Development

No branches or pull requests

4 participants