Skip to content
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

NRE from ToAbsolutePath via DefinitionSourceBase.TryFromVariable #1534

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

Comments

@jakebailey
Copy link
Member

commented Sep 10, 2019

   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 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

This comment has been minimized.

Copy link
Member

commented Sep 12, 2019

Added to #1482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.