Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Revert "Explicitly enable BF for WinForms and WPF in Microsoft.NET.Sdk.targets" #49562

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Jun 26, 2025

Reverts #33004

This was a workaround for #32969 which was fixed in 8.0 (at least the BinaryFormatter portion). The workaround was intended to be removed once that underlying issue was fixed.

Downloaded 8.0.0, checked the framework runtimeconfigs, and verified that running WinForms app without BinaryFormatter explicitly enabled in its runtime config works with 8.0.

cc @GrabYourPitchforks

@Copilot Copilot AI review requested due to automatic review settings June 26, 2025 02:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reverts a previous workaround that explicitly enabled EnableUnsafeBinaryFormatterSerialization for WinForms and WPF projects once the underlying runtime issue was fixed in .NET 8.0.

  • Removed the override that defaulted EnableUnsafeBinaryFormatterSerialization to true for projects requiring BinaryFormatter.
  • Relies on .NET 8.0 runtime’s built-in handling instead of the workaround.
Comments suppressed due to low confidence (1)

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets:196

  • This revert removes the explicit enabling of BinaryFormatter for project types requiring it, but there are no tests verifying the default behavior before and after .NET 8.0. Consider adding or updating unit tests to cover scenarios for TargetFrameworkVersion <8.0 and >=8.0 to ensure the EnableUnsafeBinaryFormatterSerialization property behaves as expected.
    <!-- controls runtime behavior (AppContext & trimming) -->

@elinor-fung elinor-fung changed the title Revert "[port to main] Explicitly enable BF for WinForms and WPF in Microsoft.NET.Sdk.targets" Revert "Explicitly enable BF for WinForms and WPF in Microsoft.NET.Sdk.targets" Jun 26, 2025
@elinor-fung elinor-fung requested a review from a team June 30, 2025 18:52
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.

2 participants