-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
BinaryFormatter Deprecation #6215
Comments
I'm working on getting rid of BinaryTranslator.TranslateDotNet. I'm writing custom manual serialization for various args which will be more efficient. |
@rokonec 👆 |
@KirillOsenkov are those new 'custom manual serialization' be still supported by ITranslator? Also, how are you planning to deal with serialization of Exceptions? |
I’ll send a PR in the next day or two, for now I started with ProjectEvaluationStarted and ProjectEvaluationFinished, which currently go through TranslateDotNet. I haven’t looked at the other cases yet. |
Should not have closed this because of BinaryTranslator.TranslateDotNet |
I think I've at least moved all *BuildEventArgs classes off of using TranslateDotNet. So if you place a breakpoint and run a build, it shouldn't be hit for BuildEventArgs serialization. If I missed a kind, let me know. I think TelemetryEventArgs potentially, but I don't know what that's for so I might have left it out. But yes, there could be other types other than BuildEventArgs, so I didn't look into those. |
I'm getting this when building a project with errors from the command line when using a recent version of .NET 8 (8.0.100-preview.5.23266.8):
|
@rolfbjarne very interesting! Can you share a repro? We didn't expect any .NET Core codepaths to hit this but we were clearly wrong. |
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="''">
</PropertyGroup>
</Project> $ dotnet --version
8.0.100-preview.5.23266.8
$ MSBUILDNOINPROCNODE=1 dotnet build MySimpleApp.csproj
MSBuild version 17.7.0-preview-23260-01+7f4bef8b4 for .NET
/Users/rolf/work/maccore/mono-master/xamarin-macios/tests/dotnet/MySimpleApp/macOS/MySimpleApp.csproj(6,17): error MSB4113: Specified condition "''" evaluates to "" instead of a boolean.
MSBUILD : error MSB4166: Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in "/var/folders/43/h027tm1n101cdrq2_b6n9n2m0000gn/T/MSBuildTemprolf/" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
MSBUILD : error MSB4166: /var/folders/43/h027tm1n101cdrq2_b6n9n2m0000gn/T/MSBuildTemprolf/MSBuild_pid-5527_75432f69f6fa4357a1cb60532f101677.failure.txt:
MSBUILD : error MSB4166: UNHANDLED EXCEPTIONS FROM PROCESS 5527:
MSBUILD : error MSB4166: =====================
MSBUILD : error MSB4166: 5/18/2023 6:00:21 PM
MSBUILD : error MSB4166: System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information.
MSBUILD : error MSB4166: at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
MSBUILD : error MSB4166: at Microsoft.Build.Execution.BuildResult.Microsoft.Build.BackEnd.ITranslatable.Translate(ITranslator translator)
MSBUILD : error MSB4166: at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)
MSBUILD : error MSB4166: ===================
MSBUILD : error MSB4166:
MSBUILD : error MSB4166:
Build FAILED. Note that when I ran into this originally, I didn't have |
Oh wow, that is DEFINITELY not a case I expected to fail here. Yikes. Thanks!
I bet it's "multiproc build where the error originated in one of the worker processes". |
related: dotnet/runtime#43482 |
Turn on warning in GenerateResource when building from the SDK: |
Hi, we (MAUI team) are getting our build failing when bumping to 8.0.100-preview.6.23310.1 Here's the PR : https://github.com/dotnet/maui/pull/15504/files build: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7910174&view=results |
JanKrivanek has a PR open here that should resolve this issue when it goes in. |
What's the timeline to fix this? ~50% of our builds are now failing due to this. |
FYI: dotnet/sdk#33227 (once merged, this should provide a workaround for the meantime) |
Removing the BinFmt opt-in in sdk: dotnet/sdk#34402 |
Motivativation
Moving away from BinaryFormatter is a long running coordinated dotnet effort, all first party code should be migrated away during .NET 8 timeframe
Context
MSBuild is using BinaryFormatter in couple places as a fallback mechanism for de/serialization of more complex types (AppDomainSetup, Exceptions, ValueTypes etc.) as well as for de/serialization of custom, pluggable data (BuildEventArgs, Embedded resources)
Scope
NET 8 - need to remove or developer-condition MSBuild usages of BinaryFormatter
post NET 8 #
The text was updated successfully, but these errors were encountered: