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

NullReferenceException in ModuleResolver.GetModuleFullName #72

Closed
MikhailArkhipov opened this issue Sep 7, 2018 · 2 comments
Closed
Assignees
Labels
bug Something isn't working priority:P1
Milestone

Comments

@MikhailArkhipov
Copy link

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

@itssimon
Copy link

Encountering the same error here on MacOS

@MikhailArkhipov MikhailArkhipov added this to the Sep 2018 milestone Sep 12, 2018
@MikhailArkhipov MikhailArkhipov changed the title NullReferenceException: Object reference not set to an instance of an object NullReferenceException in ModuleResolver.GetModuleFullName Sep 12, 2018
@MikhailArkhipov MikhailArkhipov self-assigned this Sep 12, 2018
@fenchu
Copy link

fenchu commented Oct 2, 2018

The temopral fix is to uninstall python extension, close vsc, restart vsc and install python.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working priority:P1
Projects
None yet
Development

No branches or pull requests

3 participants