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

Feature 'Navigate to' is currently unavailable due to an internal error #54464

Closed
Youssef1313 opened this issue Jun 29, 2021 · 16 comments
Closed
Assignees
Labels
Milestone

Comments

@Youssef1313
Copy link
Member

Version Used:

main

StackTrace:

StreamJsonRpc.RemoteInvocationException: Invalid URI: The format of the URI could not be determined.
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__19.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Workspaces\Remote\Core\BrokeredServiceConnection.cs:line 242
RPC server exception:
StreamJsonRpc.RemoteInvocationException: Invalid URI: The format of the URI could not be determined.
      at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteCallback`1.<InvokeAsync>d__2.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Workspaces\Remote\Core\RemoteCallback.cs:line 37
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteNavigateToSearchService.<>c__DisplayClass3_0.<<GetCallback>b__0>d.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Workspaces\Remote\ServiceHub\Services\NavigateToSearch\RemoteNavigateToSearchService.cs:line 35
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<AddResultIfMatchAsync>d__20.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Features\Core\Portable\NavigateTo\AbstractNavigateToSearchService.InProcess.cs:line 223
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<ProcessIndexAsync>d__19.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Features\Core\Portable\NavigateTo\AbstractNavigateToSearchService.InProcess.cs:line 184
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<ProcessDocumentAsync>d__16.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Features\Core\Portable\NavigateTo\AbstractNavigateToSearchService.InProcess.cs:line 111
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<ProcessDocumentsAsync>d__15.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Features\Core\Portable\NavigateTo\AbstractNavigateToSearchService.InProcess.cs:line 102
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<FindSearchResultsAsync>d__14.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Features\Core\Portable\NavigateTo\AbstractNavigateToSearchService.InProcess.cs:line 83
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteNavigateToSearchService.<>c__DisplayClass6_0.<<SearchFullyLoadedProjectAsync>b__0>d.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Workspaces\Remote\ServiceHub\Services\NavigateToSearch\RemoteNavigateToSearchService.cs:line 88
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.<RunServiceImplAsync>d__14.MoveNext() in C:\Users\PC\Desktop\Roslyn\src\Workspaces\Remote\ServiceHub\Services\BrokeredServiceBase.cs:line 91

cc @CyrusNajmabadi

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 29, 2021
@Youssef1313
Copy link
Member Author

This stack trace is from main, which includes #53839. But I don't see any additional information compared with #53813.

@Youssef1313
Copy link
Member Author

Video_2021-06-29_163702.mp4

A 100% repro for me on Roslyn solution. I think the solution must be fully loaded + wait for a while after typing.

@jinujoseph jinujoseph added Bug IDE-Navigation Navigation and search 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
@CyrusNajmabadi
Copy link
Member

@AArnott do you know what can cause

StreamJsonRpc.RemoteInvocationException: Invalid URI: The format of the URI could not be determined.

@AArnott
Copy link
Contributor

AArnott commented Jul 9, 2021

StreamJsonRpc never does anything with URIs at all, unless it's as part of deserializing data in the message into your method arguments or return value. The error message you see there would have been copied from the original exception, which may have been thrown from user code (yours) rather than the library's. When StreamJsonRpc serializes exceptions, the error packet (and the RemoteInvocationException) should retain the original exception type and callstack if you look at that exception's properties.

@CyrusNajmabadi
Copy link
Member

the error packet (and the RemoteInvocationException) should retain the original exception type and callstack if you look at that exception's properties.

Is it possible for StreamJSONRpc to report this information as well in the stack produced? If we don't have a dump, it seems like it will be hard to get the underlying exception info. Thanks!

@AArnott
Copy link
Contributor

AArnott commented Jul 10, 2021

It does, if you activate ISerializable exception serialization. See this doc.

@CyrusNajmabadi
Copy link
Member

We already added support for that here: #53839

:-)

Any other ideas?

@AArnott
Copy link
Contributor

AArnott commented Jul 11, 2021

Is the entire callstack in the issue description representing client-side frames then? Or are some of them from the server? If none from the server, then I guess simulate an exception of that type in one of your RPC server methods to see whether/where the server frames show up on the client.

@CyrusNajmabadi
Copy link
Member

So we haven't gotten anymore reports of this, so i'm goin gto close this out for now.

@Youssef1313
Copy link
Member Author

@CyrusNajmabadi FYI, I just hit this in Preview 3.1 few days ago.

@Youssef1313
Copy link
Member Author

@CyrusNajmabadi I just hit this again in Preview 4.

StreamJsonRpc.RemoteInvocationException: Invalid URI: The format of the URI could not be determined.
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
RPC server exception:
StreamJsonRpc.RemoteInvocationException: Invalid URI: The format of the URI could not be determined.
      at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteCallback`1.<InvokeAsync>d__2.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteNavigateToSearchService.<>c__DisplayClass3_0.<<GetCallback>b__0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<AddResultIfMatchAsync>d__20.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<ProcessIndexAsync>d__19.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<ProcessDocumentAsync>d__16.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<ProcessDocumentsAsync>d__15.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<FindSearchResultsAsync>d__14.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteNavigateToSearchService.<>c__DisplayClass6_0.<<SearchFullyLoadedProjectAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.<RunServiceImplAsync>d__14.MoveNext()

@CyrusNajmabadi
Copy link
Member

Oh. This isn't even navigate-to proper. This is LSP-search. @dibarbet @davidwengier does LSP do anything with URIs? I seem to recall there was some sort of conversion between paths/uris for the lsp protocol, but i'm not exactly sure how it works. It certainly seems like during the reporting of a nav-to entry that our LSP server is doing something here that is busted.

@CyrusNajmabadi
Copy link
Member

This seems promising:

            private async Task ReportSymbolInformationAsync(INavigateToSearchResult result, CancellationToken cancellationToken)
            {
                var location = await ProtocolConversions.TextSpanToLocationAsync(
                    result.NavigableItem.Document, result.NavigableItem.SourceSpan, result.NavigableItem.IsStale, cancellationToken).ConfigureAwait(false);
                Contract.ThrowIfNull(location);

This ends up calling into helpers which make the URI. Note that it feels like this system assumes that all docs will have an absolute file path that can be convered to a URI. however, i'm not sure if this is true. @jasonmalinowski may know of cases (dynamic files?) where the filepath is not an absolute uri.

@AArnott
Copy link
Contributor

AArnott commented Sep 24, 2021

I filed microsoft/vs-streamjsonrpc#720 to track improving 2 link exception propagation.

@dibarbet
Copy link
Member

Oh. This isn't even navigate-to proper. This is LSP-search. @dibarbet @davidwengier does LSP do anything with URIs? I seem to recall there was some sort of conversion between paths/uris for the lsp protocol, but i'm not exactly sure how it works. It certainly seems like during the reporting of a nav-to entry that our LSP server is doing something here that is busted.

II think you covered it in your PR - we convert between file paths and URIs (when we get a request we convert to file path, when we respond to a request, we convert to URI).

Note that the stack traces here look to be coming from out of proc, but all the LSP file path conversion should be happening in-proc.

@CyrusNajmabadi
Copy link
Member

Note that the stack traces here look to be coming from out of proc,

This is due to how the rpc system is reporting errors that happen on the host unfortunately.

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

No branches or pull requests

5 participants