"Go To Definition" times out on a complex metadata file
See original GitHub issueIssue Description
Cannot “Go To Definition” with anything that was imported from a package that isn’t from the default nuget source.
Steps to Reproduce
Try to “Go To Definition” on a method from an Object that was defined in a package that came from a source other that the default nuget’s.
Expected Behavior
To go to the definition
Actual Behavior
Claims “no definition found”
Logs
OmniSharp log
************ Response ************
{
“Request_seq”: 101,
“Command”: “/gotoDefinition”,
“Running”: true,
“Success”: false,
“Message”: “"System.OperationCanceledException: The operation was canceled.\n at System.Threading.CancellationToken.ThrowOperationCanceledException () [0x00010] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 \n at System.Threading.CancellationToken.ThrowIfCancellationRequested () [0x00008] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 \n at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.ApplyTriviaOperations (Microsoft.CodeAnalysis.Formatting.FormattingContext context, System.Threading.CancellationToken cancellationToken) [0x00004] in <98b6908531d840228bf235ca8d22fd88>:0 \n at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.Format (System.Threading.CancellationToken cancellationToken) [0x0008b] in <98b6908531d840228bf235ca8d22fd88>:0 \n at Microsoft.CodeAnalysis.CSharp.Formatting.CSharpSyntaxFormattingService.Format (Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions options, System.Collections.Generic.IEnumerable1[T] formattingRules, Microsoft.CodeAnalysis.SyntaxToken token1, Microsoft.CodeAnalysis.SyntaxToken token2, System.Threading.CancellationToken cancellationToken) [0x0000c] in <faea2fbe354e4ba6bda2599ef8169680>:0 \\n at Microsoft.CodeAnalysis.Formatting.AbstractSyntaxFormattingService.FormatIndividually (Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions options, System.Collections.Generic.IEnumerable
1[T] rules, System.Collections.Generic.IList1[T] spansToFormat, System.Threading.CancellationToken cancellationToken) [0x00036] in <98b6908531d840228bf235ca8d22fd88>:0 \\n at Microsoft.CodeAnalysis.Formatting.AbstractSyntaxFormattingService.Format (Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable
1[T] spans, System.Boolean shouldUseFormattingSpanCollapse, Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions options, System.Collections.Generic.IEnumerable1[T] rules, System.Threading.CancellationToken cancellationToken) [0x0004a] in <98b6908531d840228bf235ca8d22fd88>:0 \\n at Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattingResult (Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable
1[T] spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options, System.Collections.Generic.IEnumerable1[T] rules, System.Threading.CancellationToken cancellationToken) [0x0008e] in <98b6908531d840228bf235ca8d22fd88>:0 \\n at Microsoft.CodeAnalysis.Formatting.Formatter.Format (Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable
1[T] spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options, System.Collections.Generic.IEnumerable1[T] rules, System.Threading.CancellationToken cancellationToken) [0x00000] in <98b6908531d840228bf235ca8d22fd88>:0 \\n at Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync (Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable
1[T] spans, Microsoft.CodeAnalysis.Options.OptionSet options, System.Collections.Generic.IEnumerable1[T] rules, System.Threading.CancellationToken cancellationToken) [0x0014a] in <98b6908531d840228bf235ca8d22fd88>:0 \\n at Microsoft.CodeAnalysis.MetadataAsSource.AbstractMetadataAsSourceService.AddSourceToAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Compilation symbolCompilation, Microsoft.CodeAnalysis.ISymbol symbol, System.Threading.CancellationToken cancellationToken) [0x0049a] in <3e93b7a6b0cb4d6c978ff97c83568be8>:0 \\n at OmniSharp.Roslyn.MetadataExternalSourceService.GetAndAddExternalSymbolDocument (Microsoft.CodeAnalysis.Project project, Microsoft.CodeAnalysis.ISymbol symbol, System.Threading.CancellationToken cancellationToken) [0x00246] in <b86a8f7ee5524070a682f0426faddb57>:0 \\n at OmniSharp.Roslyn.CSharp.Services.Navigation.GotoDefinitionService.Handle (OmniSharp.Models.GotoDefinition.GotoDefinitionRequest request) [0x0037e] in <8ca5e445b15640a0986680e5a0180b25>:0 \\n at OmniSharp.Endpoint.EndpointHandler
2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \\n at OmniSharp.Endpoint.EndpointHandler
2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <add5f40a6e784fcca3e930b59965388b>:0 "”,
“Body”: null,
“Seq”: 5854,
“Type”: “response”
}
Environment information
VSCode version: 1.50.1 C# Extension: 1.23.5
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.403 Commit: 9e895200cdRuntime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /usr/share/dotnet/sdk/3.1.403/
Host (useful for support): Version: 3.1.9 Commit: 774fc3d6a9
.NET Core SDKs installed: 3.1.403 [/usr/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
csharp | ms-dotnettools | 1.23.5 |
mongodb-vscode | mongodb | 0.2.1 |
vscode-docker | ms-azuretools | 1.7.0 |
vscode-kubernetes-tools | ms-kubernetes-tools | 1.2.1 |
vscode-yaml | redhat | 0.12.0 |
vscodeintellicode | VisualStudioExptTeam | 1.2.10 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (5 by maintainers)
Top GitHub Comments
thanks, I tried it out, it’s very helpful.
As I suspected the functionality works - it just runs into a timeout (by default 2s) because the metadata file it needs to go to is really large. Unfortunately this timeout at the moment is not configurable.
What you can do, is you can enable decompilation support (you can find instructions here https://www.strathweb.com/2020/05/decompilation-support-in-omnisharp-and-c-extension-for-vs-code/). This has a higher timeout and should easily complete. As an added bonus you will get better quality behavior - instead of seeing just metadata, you will see decompiled code.
To avoid these problems for the future, we will increase or add an option to increase the go to definition timeout.
@filipw I have timed it, it was always 20secs up to 30 secs. I also changed
RoslynExtensionsOptions.DocumentAnalysisTimeoutMs
(if this is even the correct variable), without any changes Am I able to change the timeout?Also, here is the log: