Skip to content

Remove potential partial snapshot in codefixservice#59586

Merged
CyrusNajmabadi merged 5 commits intodotnet:mainfrom
CyrusNajmabadi:partialSnapshot
Feb 17, 2022
Merged

Remove potential partial snapshot in codefixservice#59586
CyrusNajmabadi merged 5 commits intodotnet:mainfrom
CyrusNajmabadi:partialSnapshot

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Followup to #59582

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner February 16, 2022 20:30
@ghost ghost added the Area-IDE label Feb 16, 2022
@CyrusNajmabadi CyrusNajmabadi marked this pull request as draft February 16, 2022 20:30
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review February 16, 2022 22:40
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@jasonmalinowski @mavasani this is ready to review.

// Note: it feels very strange that we could ever not find a fixer in our list. However, this
// occurs in testing scenarios. I'm not sure if the tests represent a bogus potential input, or if
// this is something that can actually occur in practice and we want to keep working.
return null;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mavasani for thoughts on this. Specifically, if i throw here, tests in CodeFixService tests fail. but i think they're likely constructing this service wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for example it does:

            var fixService = new CodeFixService(
                diagnosticService, logger, fixers, SpecializedCollections.EmptyEnumerable<Lazy<IConfigurationFixProvider, CodeChangeProviderMetadata>>());

So we have a list of fixers, but no metadata about htem. i can't tell if htis is a reasonable or rational think that coudl actually happen in practice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you recall which tests were failing? From what I vaguely recall, we had some scenario where if a code fixer throws some exception during creation due to some missing types or something, we wouldn't be able to create an instance of the fixer, and had to handle this error case with nulls. I am wondering if the failures you saw were coming from tests explicitly validating exception during fixer creation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, it was tests in CodeFixServiceTets. THere we manually instnatiated some test-only CodeFixProviders, then instantiated the CodeFixService. But we passed along an empty metadata-array, presumably because we didn't care in those tests and the code was resilient to not having it. But i can't tell if that's a real scenario taht occurs in practice.

Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

That lazy that this is getting rid of seemed hugely sketchy, in that it assumed that when it's realized all the fixers must have been realized; this is a lot more explicit that it's safe to skip the uncreated lazies since we couldn't have gotten the fixer any other way.

I agree with you that "return null" looks fishy for those tests, but would defer to @mavasani for what to do there.

@CyrusNajmabadi CyrusNajmabadi merged commit 46beb84 into dotnet:main Feb 17, 2022
@ghost ghost added this to the Next milestone Feb 17, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the partialSnapshot branch February 17, 2022 02:22
@RikkiGibson RikkiGibson modified the milestones: Next, 17.2.P2 Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants