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

LSIF tool has uncaught exception when Uri is relative path #59692

Closed
noellelc opened this issue Feb 22, 2022 · 6 comments · Fixed by #59891
Closed

LSIF tool has uncaught exception when Uri is relative path #59692

noellelc opened this issue Feb 22, 2022 · 6 comments · Fixed by #59891
Assignees

Comments

@noellelc
Copy link

Version Used: 4.0.0-3.21372.2

Steps to Reproduce:

  1. Run LSIF tool on certain projects
  2. Tool succeeds across several documents within a project
  3. Tool throws an unhandled exception:
Unhandled exception: System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: This operation is not supported for a relative URI.
  at System.Uri.get_AbsoluteUri()
  at Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Writing.LsifConverter.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) in /_/src/Features/Lsif/Generator/Writing/LsifConverter.cs:line 33
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
  at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
  at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
  at Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Writing.LineModeLsifJsonWriter.WriteAll(List`1 elements) in /_/src/Features/Lsif/Generator/Writing/LineModeLsifJsonWriter.cs:line 49
  at Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Writing.BatchingLsifJsonWriter.FlushToUnderlyingAndEmpty() in /_/src/Features/Lsif/Generator/Writing/BatchingLsifJsonWriter.cs:line 80
  at Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Generator.<>c__DisplayClass12_0.<GenerateForCompilation>b__0(SyntaxTree syntaxTree) in /_/src/Features/Lsif/Generator/Generator.cs:line 89
  at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
  at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
  at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )

Expected Behavior:
Tool still runs sucessfully if document uris are relative paths.

Actual Behavior:
I'm not sure if this is the root cause, but it appears at this point in the Generator tool, a relative or absolute uri is expected for document, but here, an absolute uri is expected but uncaught if the uri is not absolute.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 22, 2022
@jinujoseph jinujoseph added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 2, 2022
@jinujoseph jinujoseph added this to the 17.3 milestone Mar 2, 2022
@jasonmalinowski
Copy link
Member

@noellelc Hmm, so for source generated files where we don't have a full path, what would you like us to do? I can do file://<relative path> but not sure if you want us to do something else there?

jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this issue Mar 2, 2022
We correctly handled them in the core generation code, but failed as
we were actually serializing out JSON.

Fixes dotnet#59692
@jasonmalinowski jasonmalinowski modified the milestones: 17.3, 17.2 Mar 2, 2022
@tmat
Copy link
Member

tmat commented Mar 2, 2022

#51998 and #51773.

@noellelc
Copy link
Author

noellelc commented Mar 3, 2022

It looks like in your PR @jasonmalinowski you're just going to leave it as a relative path, which works for us!

@jasonmalinowski
Copy link
Member

@noellelc All right, we'll go with that for now!

@jasonmalinowski
Copy link
Member

@noellelc And I guess to clarify it's just a relative path. Not even a file:// prefix; that OK?

@noellelc
Copy link
Author

noellelc commented Mar 4, 2022

Yes--we have checks that allow for a relative uri. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants