-
Notifications
You must be signed in to change notification settings - Fork 826
Set serializable bit for all serializable types #4211
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dotnet-bot Test Ubuntu14.04 Release_fcs Build please |
dsyme
approved these changes
Jan 18, 2018
LGTM :) |
@dotnet-bot test Ubuntu14.04 Release_fcs Build pls |
Thank you! |
@eiriktsarpalis, thank you for reporting the issue. |
forki
pushed a commit
to forki/visualfsharp
that referenced
this pull request
Jan 20, 2018
* Add option to toggle unused declarations analyzer (dotnet#4074) * Add option to toggle unused declarations analyzer * Better name and handle registering code fixes. This will ensure that if someone uses warnon:1182, we won't suggest fixes if they've turned off the feature. * Revert dotnet#1650 (and dotnet#3366) (dotnet#4173) * Fix error logging in brace matching code (dotnet#4140) * Remove error logger pushing code * Update service.fs * Fix dotnet#4200: Vsix: fix empty "New file" window for web projects (dotnet#4202) * LOC CHECKIN | visualfsharp - master | 20180112 (dotnet#4194) * Fixed FCS netcore tests (dotnet#4180) * Remove ambiguous resolution error FS0332 (dotnet#4170) * Add IsInteractive to parsing options for script load closures (dotnet#4169) * Add IsInteractive to FSharpParsingOptions * Add test * Set serializable bit for all serializable types (dotnet#4211) * Minor fix (dotnet#4195) on string 58. * Symbols API: add Index to active pattern case, Name to pattern group (dotnet#4222) * Symbols API: add Index to active pattern case, Name to pattern group * Symbols API: add active pattern case use tests * don't rebuild (dotnet#4230) * Optimize in FCS * Transport tcConfig * Cleanup * Replace more ILAsm in Exprs * More ILAsm replacements * update resource name * Added some tests
KevinRansom
pushed a commit
that referenced
this pull request
Feb 17, 2018
* Optimize in FCS * Transport tcConfig * Cleanup * Replace more ILAsm in Exprs * More ILAsm replacements * update resource name * Added some tests (#40) * Add option to toggle unused declarations analyzer (#4074) * Add option to toggle unused declarations analyzer * Better name and handle registering code fixes. This will ensure that if someone uses warnon:1182, we won't suggest fixes if they've turned off the feature. * Revert #1650 (and #3366) (#4173) * Fix error logging in brace matching code (#4140) * Remove error logger pushing code * Update service.fs * Fix #4200: Vsix: fix empty "New file" window for web projects (#4202) * LOC CHECKIN | visualfsharp - master | 20180112 (#4194) * Fixed FCS netcore tests (#4180) * Remove ambiguous resolution error FS0332 (#4170) * Add IsInteractive to parsing options for script load closures (#4169) * Add IsInteractive to FSharpParsingOptions * Add test * Set serializable bit for all serializable types (#4211) * Minor fix (#4195) on string 58. * Symbols API: add Index to active pattern case, Name to pattern group (#4222) * Symbols API: add Index to active pattern case, Name to pattern group * Symbols API: add active pattern case use tests * don't rebuild (#4230) * Optimize in FCS * Transport tcConfig * Cleanup * Replace more ILAsm in Exprs * More ILAsm replacements * update resource name * Added some tests * test conditions update * test update * test condition update * test update * review update * added checked operators * fixed dual conversions * review fixes * more targeted replacements * adapt to latest * added more tests * added more tests * review fixes * fixed warnings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #4207
C# uses a pseudo custom attribute serializableattribute to tell the compiler to set the serializable bit for managed types.
F# doesn't ...
By default F# marks managed types as serializable unless the type is decorated with SerializeableAuto(false) attribute.
The F# compiler used the presence of serializable attribute in the targetframework to determine whether there was any point setting the serializable bit. Given that the Managed assemblies are now usable across multiple platforms that may or may not support serialization. This PR modifies the compiler to always set the serialization bit, regardless of the compilation target profile.
With this change it should be possible to serialize / de-serialize libraries F# types compiled targeting netstandard 1.6 when used with an app targeting netstandard 2.0 + or net45+
A consequence of this change is that FSharp.Core for netstandard1.6 built with an updated compiler will obviously contain serializable types.
The change consists of a few small changes ..
Where serializable was determined by the presence of the serializable attribute in the target framework they now just use true.
The decision to set the serializable bit is now solely based on the absence of the AutoSerializationAttribute with the false parameter.
The code that emits serialization helpers are emitted based on the presences of SerializationInfo and SerializationContext. They are present in netstandard1.0, netcoreapp1.0, net45 and all subsequent frameworks.