Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix: SettingsProperty constructor ignores serializeAs parameter if it is not SettingsSerializeAs.Binary - #106295

#106295
Merged
buyaa-n merged 2 commits into
dotnet:maindotnet/runtime:mainfrom
buyaa-n:set-serializeasbuyaa-n/runtime:set-serializeasCopy head branch name to clipboard
Aug 13, 2024
Merged

Fix: SettingsProperty constructor ignores serializeAs parameter if it is not SettingsSerializeAs.Binary#106295
buyaa-n merged 2 commits into
dotnet:maindotnet/runtime:mainfrom
buyaa-n:set-serializeasbuyaa-n/runtime:set-serializeasCopy head branch name to clipboard

Conversation

@buyaa-n

@buyaa-n buyaa-n commented Aug 12, 2024

Copy link
Copy Markdown
Contributor

As mentioned in the issue the SettingsProperty constructor ignores serializeAs parameter if it is not SettingsSerializeAs.Binary, the regression caused by #50531 which allows BinaryFormatter serialization only when an AppContext switch: System.Configuration.ConfigurationManager.EnableUnsafeBinaryFormatterInPropertyValueSerialization is set, and throws otherwise.

The current fix is setting the SerializeAs property with the serializeAs parameter when it is not SettingsSerializeAs.Binary, though we might want to remove the AppContext switch logic and throw for SettingsSerializeAs.Binary as now the BinaryFormatter is removed and accessing the property values throws PlatformNotSupportedException on serialization even if the switch is on. The related test SerializeAndDeserializeWithSettingsSerializeAsBinary now throws PNSE on VS, skipped when run from command line.

Fixes #104732

@buyaa-n
buyaa-n merged commit eb9c01f into dotnet:main Aug 13, 2024
@buyaa-n
buyaa-n deleted the set-serializeas branch August 13, 2024 20:47
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SettingsProperty constructor ignores serializeAs parameter if it is not SettingsSerializeAs.Binary

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.