Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

"Object reference not set to an instance of an object" when trying Go To Symbol in Workspace #378

Closed
ogrisel opened this issue Nov 9, 2018 · 8 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ogrisel
Copy link

ogrisel commented Nov 9, 2018

This is a follow up on #137 that was closed prior to version 0.1.60.0.

Here is the full error message with the new version:

Starting Microsoft Python language server.
Microsoft Python Language Server version 0.1.60.0
Initializing for /opt/venvs/py37/bin/python
[Error - 12:01:32 PM] Request workspace/symbol failed.
  Message: Object reference not set to an instance of an object.
  Code: -32000 
   at Microsoft.Python.LanguageServer.Implementation.Server.<>c__DisplayClass133_0.<GetModuleVariables>b__4(ILocationInfo l)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.Python.LanguageServer.Implementation.Server.<>c__DisplayClass133_0.<GetModuleVariables>b__2(IMemberResult m)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.EnumerablePartition`1.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Python.LanguageServer.Implementation.Server.GetModuleVariablesAsync(ProjectEntry entry, GetMemberOptions opts, String prefix, Int32 timeout, CancellationToken token)
   at Microsoft.Python.LanguageServer.Implementation.Server.WorkspaceSymbols(WorkspaceSymbolParams params, CancellationToken cancellationToken)
   at Microsoft.Python.LanguageServer.Implementation.LanguageServer.WorkspaceSymbols(JToken token, CancellationToken cancellationToken)
@jakebailey
Copy link
Member

I know that the scikit-learn project is pretty large and PLS takes a while to go through it, but are you doing this Ctrl+T and # after it's finished, or near the beginning of the analysis?

I think I have an idea of the problem, but haven't been able to reproduce it with scikit-learn using what you had reported in the VSC extension repo.

@ogrisel
Copy link
Author

ogrisel commented Nov 10, 2018

I did ctrl-t while it was indexing I think (100% cpu). I did ctrl-t at the end as well and it did not work either.

Does VS Code symbol navigation work for you on the scikit-learn source folder with the MS language server? I have never see it work so far.

@ogrisel
Copy link
Author

ogrisel commented Nov 10, 2018

I think I could not see the error output without waiting for 10+ minutes though (if I recall correctly).

@jakebailey
Copy link
Member

The current implementation waits for the entire analysis to complete before allowing these sorts of lookups to happen (for better or worse). But, even when I remove those checks and allow queries through when it's still working, I wasn't able to get the issue to happen, and I'll get search results (though it's slow to finish, maybe 10 seconds to find "kmeans").

I'm still looking for ways this nullref is happening, though. I may just have to "fix" it for now by ignoring nulls until we can actually catch the null while debugging.

@ogrisel
Copy link
Author

ogrisel commented Nov 10, 2018

I tried a fresh clone of scikit-learn in my /tmp folder, I opened a python file to trigger the python specific things for that project, then waited 15 minutes or more (checking in htop from time to time when the Microsoft.Python.LanguageServer process would stop using 100% of one of my CPUs).

When done I pressed ctrl-T only once (without typing anything else) and got the error message I already reported earlier (and no results in the navigation menu).

I am running Linux, maybe this is a Linux specific bug?

@jakebailey
Copy link
Member

I'll give it a go on my Arch machine with the instructions you've given and see how it goes.

@jakebailey jakebailey self-assigned this Nov 10, 2018
@jakebailey jakebailey added the bug Something isn't working label Nov 10, 2018
@jakebailey jakebailey added this to the Nov 2018.2 milestone Nov 10, 2018
@jakebailey
Copy link
Member

Aha, yes, after letting it run to completion (I opened sklearn/neighbors/classification.py) and hitting Ctrl+T, it throws that exception, and no further symbol requests work either (which is surprising itself).

I'll look into it, but might only be able to actually figure it out on Monday when I have VS in front of me.

@ogrisel
Copy link
Author

ogrisel commented Nov 10, 2018

Glad you could reproduce it. Thanks.

@gramster gramster removed this from the Nov 2018.2 milestone Nov 15, 2018
@MikhailArkhipov MikhailArkhipov added this to the Nov 2018.2 milestone Nov 19, 2018
@jakebailey jakebailey changed the title "Object reference not set to an instance of an object" when trying Go To Symbol in Workspace on the scikit-learn source folder "Object reference not set to an instance of an object" when trying Go To Symbol in Workspace Nov 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants