-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow MSBuild to use BinaryFormatter #33227
Allow MSBuild to use BinaryFormatter #33227
Conversation
With EnableUnsafeBinaryFormatterSerialization=false, MSBuild can crash instead of passing along an error, dotnet/msbuild#8786. Temporarily opt back into the old behavior while fixing this in MSBuild.
Crashes caused by the BinaryFormatter changes have been problematic for ASP.NET, so let's get an SDK out that fixes them since dotnet/msbuild#8779 has been a bit more difficult than we expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ship this!
As soon as my questions are irrelevant - I have no objections
<ReplaceFileContents | ||
InputFiles="@(ToolRuntimeConfigPath)" | ||
DestinationFiles="@(ToolRuntimeConfigPath)" | ||
ReplacementPatterns="$(DisabledBinaryFormatterPattern)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm failing to find where this is being populated by the original value that we are replacing - is the key allways expected to be present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the process in this repo for things is pretty convoluted! The gist is that there's a redist.csproj
that is basically an empty project targeted at the latest runtime, and its output config files get used as the prototype for the tool executables like MSBuild.
I don't know for sure that the setting is guaranteed to be there and explicitly set to false forever, but it is right now, which seems good enough to me since we hopefully fix the underlying reason with your MSBuild PR soon and then revert this tweak.
@@ -438,6 +438,9 @@ | |||
<PropertyGroup> | |||
<ReplacementPattern>"version": ".*"</ReplacementPattern> | |||
<ReplacementString>"version": "$(MicrosoftNETCoreAppRuntimePackageVersion)"</ReplacementString> | |||
|
|||
<DisabledBinaryFormatterPattern>"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false</DisabledBinaryFormatterPattern> | |||
<EnableBinaryFormatterString>"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true</EnableBinaryFormatterString> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do true and false need to be quoted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not in the current JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct - true/false are literals in JSON and don't need quote-wrapping
I'm not quite sure if there's something special about the runtimeconfig.json logic here, but in theory all you need to do is put |
@GrabYourPitchforks this is the moral equivalent of that. Things that ship as tools in the SDK are more convoluted because they're retargeted to the runtime that the SDK will ship with, and one side effect of that was inheriting the latest/greatest .NET 8 rules. |
I should also point out that the SDK's runtimeconfig.json including an explicit false value by default is an error. See also: #32969 Hopefully that will also make life a little less painful for you once that is addressed. |
This reverts commit 5f90e87.
With EnableUnsafeBinaryFormatterSerialization=false, MSBuild can crash
instead of passing along an error, dotnet/msbuild#8786. Temporarily
opt back into the old behavior while fixing this in MSBuild.