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

Do not apply Fix All operations to generated code #33515

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Feb 20, 2019

Fixes #33507

Customer scenario

A customer applies a Fix All in Project or Fix All in Solution operation for Remove Unnecessary Usings, and generated source files (e.g. RESX generated files or WinForms designer code) is changed.

Bugs this fixes

#33507

Workarounds, if any

Apply fixes to documents individually.

Risk

This is generally a measure our how central the affected code is to adjacent
scenarios and thus how likely your fix is to destabilize a broader area of code

Performance impact

Negligible improvement. Less work is done in a case where would should not be done.

Is this a regression from a previous update?

Yes, this is a regression from 15.0.

Root cause analysis

There were previously no tests for this feature behavior. Tests covering numerous edge cases of this feature behavior have been added.

How was the bug found?

Internal report (dogfood).

Test documentation updated?

No.

@sharwell sharwell added this to the 16.0.P4 milestone Feb 20, 2019
@sharwell sharwell requested a review from a team as a code owner February 20, 2019 14:13
Copy link
Contributor

@mavasani mavasani left a comment

Choose a reason for hiding this comment

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

Pending more clarification on this being a regression and design discussion whether this is the desired behavior.

@mavasani
Copy link
Contributor

I was able to find the commit that regressed from attached issue, and it was news to me that we had switched FixAll to skip generated files by default even before that commit. In that sense, your PR just restores the functionality, so I will remove the block. I would still be keen to hear how others feel about us offering a FixAll in document in generated files that fixes nothing.

@sharwell
Copy link
Member Author

I would still be keen to hear how others feel about us offering a FixAll in document in generated files that fixes nothing.

I wanted to change the behavior so Fix All operations would work in generated code (#26591), but we need to ensure that, at minimum, changes are not made to generated files when the code fix is initiated in non-generated code.

Copy link
Contributor

@mavasani mavasani left a comment

Choose a reason for hiding this comment

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

The product change and new added tests look fine to me. However, the changes to unskip existing flaky integration tests that are not related to the issue being fixed here should be moved to a separate PR, which shows these integration tests pass consistently for multiple runs. Once that change is done, I can remove the block on this PR.

@sharwell sharwell force-pushed the no-fixing-generated branch from 2179a34 to 13cdc70 Compare February 20, 2019 16:53
@sharwell

This comment has been minimized.

Copy link
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.

We should really add some additional comments around the assertion that fix alls in a generated document are offered but don't do anything. As @mavasani is calling out, that experience is 100% broken and doesn't seem to be right to be asserting in a test without a tracking bug and/or large comment saying "we know this is broken, if you fix the behavior go ahead and fix the test".

@sharwell sharwell force-pushed the no-fixing-generated branch from 13cdc70 to caedd4a Compare February 20, 2019 19:17
@sharwell
Copy link
Member Author

We should really add some additional comments around the assertion that fix alls in a generated document are offered but don't do anything.

There are four conditions covered by the tests. Two are tests of behavior with respect to intentional design, and two are tests to detect deviations from the current implemented behavior. All four are now documented for clarity.

Assert.Equal(generatedSource, VisualStudio.Editor.GetText());

// Verify that a Fix All in Document in the generated file still does nothing.
// ⚠ This is a statement of the current behavior, and not a claim regarding correctness of the design.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this worthy of filing a tracking design issue or do we want to wait on customer feedback on this known broken behavior before spending any cycles on it?

Copy link
Member

Choose a reason for hiding this comment

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

And how hard is this to just fix? 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this worthy of filing a tracking design issue or do we want to wait on customer feedback on this known broken behavior before spending any cycles on it?

#2753

@jasonmalinowski jasonmalinowski dismissed their stale review February 20, 2019 20:14

Comments were added.

@sharwell sharwell merged commit 2644e05 into dotnet:dev16.0 Feb 21, 2019
@sharwell sharwell deleted the no-fixing-generated branch February 21, 2019 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants