-
Notifications
You must be signed in to change notification settings - Fork 374
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
Force EnableUnsafeBinaryFormatterSerialization using SetSwitch - BinaryFormatter Issue #1349
Conversation
What exactly is the benefit compared to the auto-loaded |
The This mean if I create a package with the dependencies Here is my package the uses that. https://www.nuget.org/packages/ricaun.Nuke#dependencies-body-tab Now I could add the The benefits would be using the |
This looks like the proper solution (especially for projects which using/extending Nuke.*) |
0719711
to
6fe1e3b
Compare
At the moment I gonna use this in my package. By default when the DLL is load the module switch the |
6d02194
to
4bfee84
Compare
85998da
to
01b2b6e
Compare
Sorry for necro posting, but setting
Is not enough, at least for the net9 SDK as the code for binary formatter is missing there. You also need to include the package <ItemGroup>
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="9.0.0" />
</ItemGroup> |
@ScarletKuro adding |
Yes.
MSFT talked about the removal of BinaryFormatter from .NET 9 a long time ago and providing compatibility package. |
Hello everyone,
This PR forces to
EnableUnsafeBinaryFormatterSerialization
in runtime instead of adding the configuration in the csproj.This is done by using the code below before using the
BinaryFormatter
. (Reference: pythonnet/pythonnet#2282)I add a simple test in the Nuke.Tooling.Tests and changes to NET 8.0 to make sure the
BinaryFormatter
gonna work without anyEnableUnsafeBinaryFormatterSerialization
in the csproj.This gonna make sure the
BinaryFormatter
gonna works regardless if has or hasn't the configuration in the csproj.And just to remind that the
BinaryFormatter
gonna be removed in the next .NET Core (.NET 9.0 - dotnet/announcements#293)I confirm that the pull-request: