Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
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

Description

@jakebailey
   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...

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions