Skip to content

Language Server: System.NullReferenceException: Object reference not set to an instance of an object. #2523

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

Closed
RhyCynn opened this issue Sep 7, 2018 · 3 comments
Assignees
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@RhyCynn
Copy link

RhyCynn commented Sep 7, 2018

Environment data

  • VS Code version: 1.27.1 & 1.28.0-insider (clean installs)
  • Extension version (available under the Extensions sidebar): 2018.8.0
  • OS and version: Windows 10 Pro Version 10.0.17134.228
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7 64-bit (clean install)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): NA
  • Relevant/affected Python packages and their versions: None

Actual behavior

Output for Python in the Output panel opens with a "System.NullReferenceException" error after typing "from ." in an "__init__.py" file.

Expected behavior

No error

Steps to reproduce:

  1. Create an empty folder
  2. Open the folder with vscode or vscode-insider
  3. Create a new file "__init__.py"
  4. Start typing "from ."

The error occurs after typing the dot. The error does not occur with other file names (e.g. "some_file.py"). I cannot tell if this is related to a closed issue with a similar error.

Screenshots at the bottom.

Logs

Output for Python in the Output panel:
[Error - 8:33:17 AM] System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.PythonTools.Analysis.ModuleResolver.GetModuleFullName(String originatingModule, String relativePath)
at Microsoft.PythonTools.Analysis.ModuleResolver.ResolvePotentialModuleNames(String importingFromModuleName, String importingFromFilePath, String relativeModuleName, Boolean absoluteImports)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at Microsoft.PythonTools.Analysis.Analyzer.DDG.TryImportModule(String modName, Boolean forceAbsolute, ModuleReference& moduleRef, IReadOnlyList1& 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(Deque1 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()

Output from Console under the Developer Tools panel:
None

Screenshots

vscode
vscode_dot_test_ss

vscode-insider
vscode_insider_dot_test_ss

@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. needs verification labels Sep 7, 2018
@brettcannon
Copy link
Member

Can you verify this, @ericsnowcurrently ?

@MikhailArkhipov
Copy link

@MikhailArkhipov
Copy link

@brettcannon brettcannon reopened this Sep 17, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants