vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Longstanding Intellisense bug

Open jrieken opened this issue 10 years ago • 98 comments

From @Figbash on April 29, 2016 17:30

Will somebody please give this bug some attention? There are many of us that haven't been able to move from version 0.10.3 in December. I would very much like to run an up to date version of VSCode.

https://github.com/OmniSharp/omnisharp-roslyn/issues/371 https://github.com/OmniSharp/omnisharp-vscode/issues/6

Copied from original issue: Microsoft/vscode#5993

jrieken avatar May 02 '16 07:05 jrieken

This bug is still in the latest release. Any updates?

VinditCo avatar May 06 '16 11:05 VinditCo

Sorry to chase @jrieken, but do you guys have any kind of ETA on this? Is there anything we can do to help diagnose the issue? Cheers

VinditCo avatar May 11 '16 09:05 VinditCo

I am also experiencing painfully slow, if non existent intellisense support on VS Code running in a Ubuntu VM.

The project having issues is just a blank .NET Console application - typing "args." does nothing, and hitting ctrl+space pops open the "Loading..." and sometimes it loads.

Attached is my VSCode output.

omnisharp.txt

misnor avatar May 11 '16 19:05 misnor

@DustinCampbell will know

jrieken avatar May 12 '16 07:05 jrieken

Honestly I have given up on this being looked at, I even emailed dustin directly offering to help figure it out and got no response. There doesn't seem to be any interest in making C# functional again ever since this was split into a separate plugin :( It's very frustrating, as it worked so perfectly before that.

@VinditCo My gut feeling is that it has something to do with either precompiled DLL plugins or just very large projects, as it doesn't seem to occur on any of my simpler projects. I have been trying to narrow it down so at least we could pull offending files out of the solution to allow us to work, but I have not had any luck. I will let you know if I ever find anything that helps.

ghost avatar May 12 '16 20:05 ghost

@Figbash -- don't give up hope! I actually never received your email.

The OmniSharp log you provided indicated that you're using a project.json-based project. Is this a project targeting ASP .NET RC1 (e.g. DNX), or a newer .NET CLI project?

DustinCampbell avatar May 12 '16 20:05 DustinCampbell

@DustinCampbell thanks for getting back to us! I'm running Unity 5.3.4p5 - how would I check if it's using a json-based project?

VinditCo avatar May 12 '16 20:05 VinditCo

@DustinCampbell I apologize for venting, I sent the email a couple weeks ago. I am running Unity as well and believe the problem generally affects Unity projects (I'm thinking misnor has a different issue). Unity targets Mono that is equivalent to .NET 2.

The startup log in version .10.3 of VSCode always shows: [INFORMATION:OmniSharp.Dnx.DnxPaths] Using runtime '/Users/raymondbritton/.dnx/runtimes/dnx-mono.1.0.0-beta4'. [INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Scanning 'AJMobile_Trunk' for DNX projects [INFORMATION:OmniSharp.Dnx.DnxProjectSystem] No project.json based projects found

The solution file/csproj files seem to be an XML format for visual studio 12 rather than JSON. I have uploaded the solution from my broken project: Assembly.zip The solution files are generated by Unity.

ghost avatar May 12 '16 20:05 ghost

Sorry, I was looking at the OmniSharp log that @misnor posted -- that one is project.json-based. I'll take a look at the project you provided.

DustinCampbell avatar May 12 '16 20:05 DustinCampbell

I'm not entirely sure if the output log is even related, I often get the same issue without the log appearing. For instance I have just used command click on to jump around some files in VSCode 1.1.0-insider, and did not receive any logs in output. The first few jumps were quick, but the third one brings up the "Loading..." tooltip for around 6 seconds before working again, and there was nothing in the output besides: [INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /v2/getcodeactions: 200 627ms

I did get this in the output a little before the slowdown: [INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Detecting CSX files in '/Users/raymondbritton/Desktop/AJMobile_Trunk'. [INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Could not find any CSX files [INFORMATION:OmniSharp.Startup] Solution has finished loading [ERROR:Microsoft.AspNet.Diagnostics.ErrorHandlerMiddleware] An unhandled exception has occurred: Diagnostic must have span '[1505..1505)' Parameter name: diagnostics System.ArgumentException: Diagnostic must have span '[1505..1505)' Parameter name: diagnostics at Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.VerifyDiagnosticsArgument (ImmutableArray1 diagnostics, TextSpan span) [0x00000] in <filename unknown>:0 at Microsoft.CodeAnalysis.CodeFixes.CodeFixContext..ctor (Microsoft.CodeAnalysis.Document document, TextSpan span, ImmutableArray1 diagnostics, System.Action2 registerCodeFix, Boolean verifyArguments, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 at Microsoft.CodeAnalysis.CodeFixes.CodeFixContext..ctor (Microsoft.CodeAnalysis.Document document, TextSpan span, ImmutableArray1 diagnostics, System.Action2 registerCodeFix, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CodeActionHelper+<GetCodeFixContext>d__2.MoveNext () [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter1[System.Nullable1[Microsoft.CodeAnalysis.CodeFixes.CodeFixContext]].GetResult () [0x00000] in <filename unknown>:0 at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CodeActionHelper+<GetActions>d__0.MoveNext () [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter1[System.Collections.Generic.IEnumerable1[Microsoft.CodeAnalysis.CodeActions.CodeAction]].GetResult () [0x00000] in <filename unknown>:0 at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.GetCodeActionsService+<Handle>d__4.MoveNext () [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter1[OmniSharp.Models.V2.GetCodeActionsResponse].GetResult () [0x00000] in :0 at OmniSharp.Middleware.Endpoint.EndpointHandler2+<HandleSingleRequest>d__18[OmniSharp.Models.V2.GetCodeActionsRequest,OmniSharp.Models.V2.GetCodeActionsResponse].MoveNext () [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter1[System.Object].GetResult () [0x00000] in :0 at OmniSharp.Middleware.Endpoint.EndpointHandler2+<Process>d__16[OmniSharp.Models.V2.GetCodeActionsRequest,OmniSharp.Models.V2.GetCodeActionsResponse].MoveNext () [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter1[System.Object].GetResult () [0x00000] in :0 at OmniSharp.Middleware.EndpointMiddleware+d__7.MoveNext () [0x00000] in :0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in :0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in :0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in :0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in :0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in :0 at Microsoft.AspNet.Diagnostics.ErrorHandlerMiddleware+d__4.MoveNext () [0x00000] in :0

ghost avatar May 12 '16 20:05 ghost

Hmmm... Could you try this? Grab the latest omnisharp.linux-mono.tar.gz from https://github.com/OmniSharp/omnisharp-roslyn/releases/tag/v1.9-alpha13 and untar it to a directory. Then, set the "csharp.omnisharp" preference in VS Code to point to "/directory/you/just/created/OmniSharp.exe". Restart VS Code and see if this addresses the issue.

DustinCampbell avatar May 12 '16 20:05 DustinCampbell

I am running OSX BTW. Attempting to do what you said shows: /Users/raymondbritton/Desktop/omnisharp-linux-mono/OmniSharp.exe: cannot execute binary file

ghost avatar May 12 '16 21:05 ghost

:grumble: ok. Give me a day or two to get set up to try and repro. If you have anymore you could share to reproduce the problem that'd be helpful.

DustinCampbell avatar May 12 '16 21:05 DustinCampbell

Note that I've never actually installed Unity before so this is new territory for me :blush:

DustinCampbell avatar May 12 '16 21:05 DustinCampbell

Ok, thank you. I cannot share the project unfortunately as it is my companies and is enormous, perhaps @VinditCo has something shareable? If it would help figure it out I would be willing to screen share.

I have gotten the alpha to start using a bash script with mono OmniSharp.exe, but it gives me: [INFO] Starting OmniSharp at '/Users/raymondbritton/Desktop/AJMobile_Trunk/AJMobile_Trunk.sln'... [INFO] Started OmniSharp from '/Users/raymondbritton/Desktop/omnisharp-linux-mono/omnisharp' with process id 17707... OmniSharp: info: OmniSharp.Startup[0] Omnisharp server running on port '2000' at location '/Users/raymondbritton/Desktop/AJMobile_Trunk' on host -1. info: OmniSharp.DotNet.DotNetProjectSystem[0] Initializing in /Users/raymondbritton/Desktop/AJMobile_Trunk info: OmniSharp.DotNet.DotNetProjectSystem[0] Auto package restore: True fail: OmniSharp.Startup[0] The project system 'DotNetProjectSystem' threw exception during initialization. Failed to initialize Microsoft.DotNet.ProjectModel.WorkspaceContext at /Users/raymondbritton/Desktop/AJMobile_Trunk. at OmniSharp.DotNet.DotNetProjectSystem.Initalize (IConfiguration configuration) [0x00000] in :0 at OmniSharp.Startup.Configure (IApplicationBuilder app, IServiceProvider serviceProvider, IOmnisharpEnvironment env, ILoggerFactory loggerFactory, ISharedTextWriter writer, IOmnisharpAssemblyLoader loader, IOptions`1 optionsAccessor) [0x00000] in :0 info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Detecting projects in '/Users/raymondbritton/Desktop/AJMobile_Trunk/AJMobile_Trunk.sln'. info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project from '/Users/raymondbritton/Desktop/AJMobile_Trunk/Assembly-CSharp-firstpass.csproj'. info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project from '/Users/raymondbritton/Desktop/AJMobile_Trunk/Assembly-CSharp.csproj'. info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project from '/Users/raymondbritton/Desktop/AJMobile_Trunk/Assembly-CSharp-Editor-firstpass.csproj'. info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project from '/Users/raymondbritton/Desktop/AJMobile_Trunk/Assembly-CSharp-Editor.csproj'. info: OmniSharp.ScriptCs.ScriptCsProjectSystem[0] Detecting CSX files in '/Users/raymondbritton/Desktop/AJMobile_Trunk'. info: OmniSharp.ScriptCs.ScriptCsProjectSystem[0] Could not find any CSX files info: OmniSharp.Startup[0] Configuration finished. [ERROR] Error: Failed to start OmniSharp

If you have any ideas on that exception I can try again.

ghost avatar May 12 '16 21:05 ghost

OK. I'm also adding @troydai, who might have some ideas as well. It seems suspicious that the DotNetProjectSystem is throwing. Do you have project.json files in your project at all?

DustinCampbell avatar May 12 '16 21:05 DustinCampbell

I can walk you through Unity: Install Unity Free, tell it to include the demo project Open the demo project in Unity Grab https://github.com/dotBunny/VSCode and put it under the demo project dir /Assets/Editor In Unity open Assets menu, Open C# Project In Code This will generate the solution and open it in Code. Then just try using it a little bit and the issue will either be very apparent or the demo project won't have the issue, hopefully the former :)

I don't see any project.json files in the project.

ghost avatar May 12 '16 21:05 ghost

I'm also on OSX and don't have any project.json files. Sadly I also cant post a copy of the project. Are there any logs you'd like me to post?

VinditCo avatar May 13 '16 11:05 VinditCo

I am trying to reproduce this on a smaller project but I'm not having any luck. It definitely seems to have something to do with project size or complexity...

ghost avatar May 17 '16 17:05 ghost

Good to know. I'm still looking at this. Thanks for the update!

DustinCampbell avatar May 17 '16 18:05 DustinCampbell