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

Make BinFmt changewave dependent on BinFmt runtime enablement #9262

Merged

Conversation

JanKrivanek
Copy link
Member

@JanKrivanek JanKrivanek commented Sep 25, 2023

Fixes #9258

Summary

Opting out of 17.8 features (via changewaves env variable) while EnableUnsafeBinaryFormatterSerialization is not allowed by the runtime can lead to MSBuild crashing ungracefully.

This is because BinaryFormatter serialization usage in core now leads to runtime failures (as of 8.0) unless explicitly opted-in by user. So MSBuild moved to alternative (secure) serialization. MSBuild normally allows users to opt out of the last batch of changes - with changewaves. In this specific case it can mean shooting self into foot without realizing.

Resolution: Ignoring the opt-out of the new secure serialization unless the BinaryFormatter is explicitly allowed by user in runtime (by editing MSBuild.runtimeconfig.json in the SDK).

Customer Impact

If users have encountered a problem in the latest MSBuild and are working around it by enabling a changewave (for instance, working around the potential deployment blocker #9250), some categories of build failure manifest as an MSBuild crash rather than a failed build with a descriptive error.

Changes Made

Allow flipping to the legacy serialization only if the BinFmt is allowed in runtime (or we are running on .NET Framework).
For exception serialization - it actually should be just internal technical detail without user behavior change - so not allowing to change this with changewave

Regression?

Yes, introduced in #8917.

Testing

Manual (mentioned in the item)

Risk

Low (adding boolean check populated from AppContext switch)

@rainersigwald rainersigwald added this to the VS 17.8 milestone Sep 25, 2023
src/Build/BackEnd/Node/OutOfProcNode.cs Show resolved Hide resolved
src/Framework/Traits.cs Show resolved Hide resolved
documentation/wiki/ChangeWaves.md Outdated Show resolved Hide resolved
@JanKrivanek JanKrivanek changed the base branch from main to vs17.8 September 25, 2023 20:27
@ghost
Copy link

ghost commented Sep 26, 2023

Hello! I noticed that you're targeting one of our servicing branches. Please consider updating the version.

@JanKrivanek
Copy link
Member Author

Marking as do-not-merge - waiting for tactics decision

Opting out of 17.8 features (via changewaves env variable) while
`EnableUnsafeBinaryFormatterSerialization` is not allowed by the runtime
can lead to MSBuild crashing ungracefully.

This is because BinaryFormatter serialization usage in core now leads to
runtime failures (as of 8.0) unless explicitly opted-in by user. So
MSBuild moved to alternative (secure) serialization. MSBuild normally
allows users to opt out of the last batch of changes - with changewaves.
In this specific case it can mean shooting self into foot without
realizing.

Resolution: Ignoring the opt-out of the new secure serialization unless
the BinaryFormatter is explicitly allowed by user in runtime (by editing
`MSBuild.runtimeconfig.json` in the SDK).
@rainersigwald rainersigwald merged commit 585e097 into dotnet:vs17.8 Sep 26, 2023
8 checks passed
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.

Setting changewave 17.8 causes crashes on .NET 8
4 participants