Skip to content

Conversation

yuehuang010
Copy link
Contributor

@yuehuang010 yuehuang010 commented Oct 28, 2021

Context

When ownerDocumentWithLocation.FullPath is null, then ElementLocation is always created. This is because ElementLocation.Empty.File is " " (empty not null).
This can occurs when a project is created from memory or loaded from a stream which loses all file information.

Changes Made

Add null check.

Testing

Standard unittest

Notes

Copy link
Member

@rokonec rokonec left a comment

Choose a reason for hiding this comment

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

Good job with finding this bug.
Please consider my recommendations.

@yuehuang010 yuehuang010 marked this pull request as ready for review October 29, 2021 00:36
@yuehuang010 yuehuang010 changed the title Check if doc is null before creating elementlocation Check if Documentis null before creating elementlocation object Oct 29, 2021
@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Oct 29, 2021
@rokonec rokonec merged commit f8c114a into dotnet:main Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants