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

NRE from ToAbsolutePath via DefinitionSourceBase.TryFromVariable #1534

Closed
jakebailey opened this issue Sep 10, 2019 · 1 comment · Fixed by #1482
Closed

NRE from ToAbsolutePath via DefinitionSourceBase.TryFromVariable #1534

jakebailey opened this issue Sep 10, 2019 · 1 comment · Fixed by #1482
Assignees
Labels
bug Something isn't working

Comments

@jakebailey
Copy link
Member

   at Microsoft.Python.Core.UriExtensions.ToAbsolutePath(Uri uri) in E:\A\_work\3\s\src\Core\Impl\Extensions\UriExtensions.cs:line 22
   at Microsoft.Python.Analysis.Modules.PythonModule.get_Definition() in E:\A\_work\3\s\src\Analysis\Ast\Impl\Modules\PythonModule.cs:line 173
   at Microsoft.Python.LanguageServer.Sources.DefinitionSourceBase.TryFromVariable(String name, IDocumentAnalysis analysis, SourceLocation location, Node statement, ILocatedMember& definingMember) in E:\A\_work\3\s\src\LanguageServer\Impl\Sources\DefinitionSource.cs:line 209
   at Microsoft.Python.LanguageServer.Sources.DefinitionSourceBase.FindDefinition(IDocumentAnalysis analysis, SourceLocation location, ILocatedMember& definingMember) in E:\A\_work\3\s\src\LanguageServer\Impl\Sources\DefinitionSource.cs:line 105
   at Microsoft.Python.LanguageServer.Implementation.Server.GotoDefinition(TextDocumentPositionParams params, CancellationToken cancellationToken) in E:\A\_work\3\s\src\LanguageServer\Impl\Implementation\Server.Editor.cs:

Similar to #1018 but a different backtrace. This comes from a PythonModule with a null URI. The code in PythonModule is written to allow null URIs uri?.LocalPath, but the Definition property still constructs a LocationInfo unconditionally.

I almost think LocationInfo could do with some cleanup; it double-stores paths via URI and filepath, among some other weirdness with PythonModule.FilePath being inconsistent with LocationInfo being "absolute" in some places but not others...

@jakebailey jakebailey added the bug Something isn't working label Sep 10, 2019
@MikhailArkhipov MikhailArkhipov self-assigned this Sep 12, 2019
@MikhailArkhipov MikhailArkhipov added this to the September 2019.1 milestone Sep 12, 2019
@MikhailArkhipov
Copy link

Added to #1482

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

Successfully merging a pull request may close this issue.

2 participants