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

Fixes NullReferenceException when trying to access InstanceInfo.InstanceAttributes #282

Merged

Conversation

lostmsu
Copy link
Contributor

@lostmsu lostmsu commented Oct 18, 2018

Subj.
When there are no instance attributes, InstanceAttributes should return null or an empty dictionary. In this change I choose to return null we agreed on an empty dictionary

@lostmsu lostmsu force-pushed the fixes/InstanceAttributesNull branch from b7ab1ce to fdc8eca Compare October 18, 2018 20:54
IReadOnlyDictionary<string, IVariableDefinition> IInstanceInfo.InstanceAttributes
=> InstanceAttributes.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as IVariableDefinition);
=> _instanceAttrs?.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as IVariableDefinition);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should return empty dictionary rather than null. Try _instanceAttrs.MaybeEnumerate().ToDictionary(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amended

@lostmsu lostmsu force-pushed the fixes/InstanceAttributesNull branch from fdc8eca to 7816414 Compare October 18, 2018 21:42
@MikhailArkhipov MikhailArkhipov merged commit 6d4659f into microsoft:master Oct 19, 2018
jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
…esNull

Fixes NullReferenceException when trying to access InstanceInfo.InstanceAttributes
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants