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

System.NullReferenceException: Object reference not set to an instance of an object #175

Closed
Lexicality opened this issue Sep 30, 2018 · 6 comments
Labels
duplicate This issue or pull request already exists

Comments

@Lexicality
Copy link

When my project starts I get this in the output window

Starting Microsoft Python language server.
Initializing for c:\Users\lexro\projects\partner-stats\.venv\Scripts\python.exe
Loading files from c:\Users\lexro\projects\partner-stats
Parsing document file:///c:/Users/lexro/projects/partner-stats/setup.py
Parse complete for file:///c:/Users/lexro/projects/partner-stats/setup.py at version -1
Analysis queued for file:///c:/Users/lexro/projects/partner-stats/setup.py
Waiting for parsing to complete.
Parsing complete. Waiting for analysis entries to enqueue.
##########Linting Output - mypy##########
##########Linting Output - flake8##########
Enqueue complete. Waiting for analysis to complete.
[Error - 12:15:03 AM] System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter.ImportModule(String name)
   at Microsoft.PythonTools.Analysis.ModuleTable.TryImport(String name, ModuleReference& res)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.TryImportModule(String modName, Boolean forceAbsolute, ModuleReference& moduleRef, IReadOnlyList`1& remainingParts)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(FromImportStatement node)
   at Microsoft.PythonTools.Parsing.Ast.FromImportStatement.Walk(PythonWalker walker)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(SuiteStatement node)
   at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(PythonWalker walker)
   at Microsoft.PythonTools.Parsing.Ast.PythonAst.Walk(PythonWalker walker)
   at Microsoft.PythonTools.Analysis.AnalysisUnit.AnalyzeWorker(DDG ddg, CancellationToken cancel)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Analyze(Deque`1 queue, CancellationToken cancel, Action`1 reportQueueSize, Int32 reportQueueInterval)
   at Microsoft.PythonTools.Analysis.PythonAnalyzer.AnalyzeQueuedEntries(CancellationToken cancel)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.GroupAnalysis.Analyze(CancellationToken cancel)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.HandleAnalyzable(IAnalyzable item, AnalysisPriority priority, CancellationToken cancellationToken)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.ConsumerLoop()

Then I get this error once for every file in the project:

Parsing document file:///c:/Users/lexro/projects/partner-stats/src/partner_stats/es_helper.py
Parse complete for file:///c:/Users/lexro/projects/partner-stats/src/partner_stats/es_helper.py at version -1
Analysis queued for file:///c:/Users/lexro/projects/partner-stats/src/partner_stats/es_helper.py
Waiting for parsing to complete.
Parsing complete. Waiting for analysis entries to enqueue.
[Error - 12:15:04 AM] System.ObjectDisposedException: PriorityProducerConsumer`1 instance is disposed
Object name: 'PriorityProducerConsumer`1'.
   at Microsoft.PythonTools.Analysis.Infrastructure.DisposeToken.ThrowIfDisposed()
   at Microsoft.PythonTools.Analysis.Infrastructure.PriorityProducerConsumer`1.Produce(T value, Int32 priority)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.Enqueue(IAnalyzable item, AnalysisPriority priority)
   at Microsoft.Python.LanguageServer.Implementation.Server.OnDocumentChangeProcessingCompleteAsync(IDocument doc, VersionCookie vc, Boolean enqueueForAnalysis, AnalysisPriority priority, IDisposable disposeWhenEnqueued)
Enqueue complete. Waiting for analysis to complete.

after which I get something along the lines of this error every time I hover over something

Waiting for parsing to complete.
Parsing complete. Waiting for analysis entries to enqueue.
Enqueue complete. Waiting for analysis to complete.
[Error - 12:15:05 AM] Request textDocument/documentSymbol failed.
  Message: PriorityProducerConsumer`1 instance is disposed
Object name: 'PriorityProducerConsumer`1'.
  Code: -32000 
[object Object]

This is with the loglevel set to trace.
I'm using Python 3.6.5 under a virtualenv on x64 Windows 10 Pro v1803, with the latest version of the language server that the non-insiders build of vscode (1.27.2) dowloads.

@MikhailArkhipov
Copy link

#68
#72

Fixed in upcoming release

@MikhailArkhipov MikhailArkhipov added the duplicate This issue or pull request already exists label Oct 1, 2018
@Lexicality
Copy link
Author

Ah, sorry.

@Lexicality
Copy link
Author

Is there somewhere I can subscribe to in order to know when releases happen?

@MikhailArkhipov
Copy link

@Lexicality - we are changing the extension so it will download new bits automatically. However, if you are on a stable train, you may not see updates as often as on beta or daily trains. See microsoft/vscode-python#2676 and microsoft/vscode-python#2580

@Lexicality
Copy link
Author

I can't see any references to trains, but it downloadedPython-Language-Server-win-x86.beta.nupkg which implies beta I guess?
Also, I have had to fall back to Jedi so I can work, will the language server update itself when not enabled?

@MikhailArkhipov
Copy link

MikhailArkhipov commented Oct 1, 2018

Yes, there are 'stable' (ie release), 'beta' (insiders) and 'daily'. I believe current beta is reported as 0.1.37 or so. I don't think you see them yet, this is for the upcoming release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants