Skip to content

Conversation

@stuartmorgan-g
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g commented Feb 22, 2022

Visual Studio 2022 17.1.0 ships a version of CMake whose generator
doesn't handle custom build commands correctly: instead of generating
one command per config that uses the correct $<CONFIG> value, it
generates multiple copies per configuration, one with each value of
$<CONFIG>, and only one of them is actually used. In practice, due to
the way VS resolves the incorrect duplication, it's always Release for a
flutter project, which causes the call to assemble to use the wrong
mode for debug builds, preventing them from launching.

This works around the generation bug, as a temporary measure until a
fixed version of Visual Studio is released, by rewriting the generated
project file to have the correct configuration value in each call.

This limits the workaround to just 17.1.0, as 17.1.1 should contain
a fix.

Fixes #97086

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Visual Studio 2022 17.1.0 ships a version of CMake whose generator
doesn't handle custom build commands correctly: instead of generating
one command per config that uses the correct `$<CONFIG>` value, it
generates multiple copies per configuration, one with each value of
`$<CONFIG>`, and only one of them is actually used. In practice, due to
the way VS resolves the incorrect duplication, it's always Release for a
flutter project, which causes the call to `assemble` to use the wrong
mode for debug builds, preventing them from launching.

This works around the generation bug, as a temporary measure until a
fixed version of Visual Studio is released, by rewriting the generated
project file to have the correct configuration value in each call.

To avoid this workaround potentially causing issues in the future, this
limits the workaround to just 17.1.x. If a newer version of VS is
shipped that doesn't contain a fix, the constraints will need to be
updated.

Fixes flutter#97086
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 22, 2022
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan-g
Copy link
Contributor Author

I've changed the check to exactly 17.1.0, since we now have confirmation that the fix should be in 17.1.1.

@cbracken I'll leave it up to you whether you want to go forward with landing this, or just wait until 17.1.1 ships.

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

lgtm for the change. I think we should land it given that it'll take some time for the fix to roll out and some further time for users to all pick this up -- e.g. I can imagine strict corporate update policies in some companies.

We should add a TODO here to strip this back out after some time limit. Maybe when we drop support for VS 2022.

@stuartmorgan-g
Copy link
Contributor Author

TODO added.

@fluttergithubbot fluttergithubbot merged commit 80660b2 into flutter:master Feb 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 28, 2022
itsjustkevin added a commit that referenced this pull request Mar 2, 2022
* Work around VS CMake generation bug (#98945)

* 'add branch flutter-2.8-candidate.16 to enabled_branches in .ci.yaml'

* 'Update Engine revision to bd539267b42051b0da3d16ffa8f48949dce8aa8f for stable release 2.10.3'

* remove branch ref

* remove consumer deps test

Co-authored-by: stuartmorgan <[email protected]>
Co-authored-by: Christopher Fujino <[email protected]>
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
IvanLipotan pushed a commit to IvanLipotan/flutter that referenced this pull request Mar 8, 2022
…er#99337)

* Work around VS CMake generation bug (flutter#98945)

* 'add branch flutter-2.8-candidate.16 to enabled_branches in .ci.yaml'

* 'Update Engine revision to bd539267b42051b0da3d16ffa8f48949dce8aa8f for stable release 2.10.3'

* remove branch ref

* remove consumer deps test

Co-authored-by: stuartmorgan <[email protected]>
Co-authored-by: Christopher Fujino <[email protected]>
@Melisaates Melisaates mentioned this pull request Aug 7, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail to launch app in debug mode on windows: "Can't load AOT data" with VS 2022 17.1.0

6 participants