From 28d54d0a302f41cac777a6111fe3519d97d77b00 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Tue, 28 Jan 2025 13:39:03 +0100 Subject: [PATCH 1/2] Update information for MSB3825 --- .../binaryformatter-migration-guide/winforms-applications.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md b/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md index 9fd09fc8d2b8a..4c4cb246e9633 100644 --- a/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md +++ b/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md @@ -76,7 +76,7 @@ Types that had been previously serialized into resource files via [BinaryFormatt ##### Generating resource files via msbuild -When generating resource files via msbuild, you may encounter an `MSB3825` error which specifies that your binary formatted resources may be deserialized using [BinaryFormatter] during runtime. As stated above, these resources will not deserialize using [BinaryFormatter] and this warning can be turned off by setting the property `GenerateResourceWarnOnBinaryFormatterUse` to `false`. In rare cases that deserialization cannot occur without [BinaryFormatter], it can be added back with an unsupported compatibility package. See [BinaryFormatter migration guide: Compatibility Package](compatibility-package.md) for details. Note that an additional step of setting `System.Resources.Extensions.UseBinaryFormatter` app context switch to `true` is required to use [BinaryFormatter] for resources. +When generating resource files via msbuild, you may encounter an `MSB3825` error which specifies that your binary formatted resources may be deserialized using [BinaryFormatter] during runtime. The warning is being removed from builds targetting NET9 and higher, however the warning removal is still not complete in all releases of NET9. It should be only of concern when targeting NET8 and lower - as as stated above, these resources will not deserialize using [BinaryFormatter] during runtime in NET9 and above. This warning can be turned off by setting the property `GenerateResourceWarnOnBinaryFormatterUse` to `false`. In rare cases that deserialization cannot occur without [BinaryFormatter], it can be added back with an unsupported compatibility package. See [BinaryFormatter migration guide: Compatibility Package](compatibility-package.md) for details. Note that an additional step of setting `System.Resources.Extensions.UseBinaryFormatter` app context switch to `true` is required to use [BinaryFormatter] for resources. ## Migrate away from BinaryFormatter From 2b6c8b00d9a70e6dc468bae9e4d5e2f2b4d939e6 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Fri, 21 Feb 2025 13:38:12 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../binaryformatter-migration-guide/winforms-applications.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md b/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md index 4c4cb246e9633..45894b73fa07f 100644 --- a/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md +++ b/docs/standard/serialization/binaryformatter-migration-guide/winforms-applications.md @@ -74,9 +74,9 @@ If these statements are true, the Designer determines if that property's type ha Types that had been previously serialized into resource files via [BinaryFormatter] will continue to deserialize as expected without the need for [BinaryFormatter] as the content of ResX files are considered trusted data. In the rare case that deserialization cannot occur without [BinaryFormatter], it can be added back with an unsupported compatibility package. See [BinaryFormatter migration guide: Compatibility Package](compatibility-package.md) for details. Note that an extra step of setting `System.Resources.Extensions.UseBinaryFormatter` app context switch to `true` is required to use [BinaryFormatter] for resources. -##### Generating resource files via msbuild +##### Generating resource files via MSBuild -When generating resource files via msbuild, you may encounter an `MSB3825` error which specifies that your binary formatted resources may be deserialized using [BinaryFormatter] during runtime. The warning is being removed from builds targetting NET9 and higher, however the warning removal is still not complete in all releases of NET9. It should be only of concern when targeting NET8 and lower - as as stated above, these resources will not deserialize using [BinaryFormatter] during runtime in NET9 and above. This warning can be turned off by setting the property `GenerateResourceWarnOnBinaryFormatterUse` to `false`. In rare cases that deserialization cannot occur without [BinaryFormatter], it can be added back with an unsupported compatibility package. See [BinaryFormatter migration guide: Compatibility Package](compatibility-package.md) for details. Note that an additional step of setting `System.Resources.Extensions.UseBinaryFormatter` app context switch to `true` is required to use [BinaryFormatter] for resources. +When you generate resource files via MSBuild, you might encounter an `MSB3825` error. This error specifies that your binary-formatted resources might be deserialized using [BinaryFormatter] during run time. The warning is being removed from builds targeting .NET 9 and later, however the removal is not yet complete in all releases of .NET 9. The warning should be only of concern when targeting .NET 8 and lower. As stated earlier, these resources will not deserialize using [BinaryFormatter] during run time in .NET 9 and later versions. You can turn the warning off by setting the property `GenerateResourceWarnOnBinaryFormatterUse` to `false`. In rare cases that deserialization cannot occur without [BinaryFormatter], it can be added back with an unsupported compatibility package. For more information, see [BinaryFormatter migration guide: Compatibility package](compatibility-package.md). Note that an additional step of setting the `System.Resources.Extensions.UseBinaryFormatter` app context switch to `true` is required to use [BinaryFormatter] for resources. ## Migrate away from BinaryFormatter