Repository navigation
Add BinaryFormatter to corefx - #10088
stephentoub wants to merge 2 commits into
Conversation
d06d207 to
5e0cfd8
Compare
| } | ||
| namespace System.Runtime.Serialization | ||
| { | ||
| [System.CLSCompliantAttribute(false)] |
There was a problem hiding this comment.
Are we not scrubbing these out?
There was a problem hiding this comment.
CLSCompliant? No. If something isn't compliant and isn't attributed to say so, it'll produce a build error.
|
how much should we be reviewing the binaryformatter itself - how much is essentially the desktoip code verbatim? |
|
|
||
| //If the id that we need to place is greater than our current length, and less | ||
| //than the maximum allowable size of the array. We need to double the size | ||
| //of the array. If the array has already reached it's maximum allowable size, |
There was a problem hiding this comment.
If the array has already reached it's maximum allowable size, [](start = 28, length = 62)
is there a test for this?
There was a problem hiding this comment.
is there a test for this?
You mean if we try to serialize two billion objects? No.
From a logic perspective, it's the desktop code. I had to supply replacements where there were dependencies that aren't exposed, remove code that wasn't relevant, plus a lot of style stuff, but for the most part it's the same code and doesn't need to be reviewed in depth... honestly there are parts I'm not entirely sure what they're doing ;) |
| [Serializable] | ||
| internal sealed class IntSizedArray : ICloneable | ||
| { | ||
| internal int[] objects = new int[16]; |
There was a problem hiding this comment.
objects [](start = 23, length = 7)
leading underscores?
There was a problem hiding this comment.
Yup, somehow missed these two.
|
Thank you for doing this, great stuff. |
|
|
| internal FormatterTypeStyle _FEtypeFormat; | ||
| internal FormatterAssemblyStyle _FEassemblyFormat; | ||
| internal TypeFilterLevel _FEsecurityLevel; | ||
| internal InternalSerializerTypeE _FEserializerTypeEnum; |
There was a problem hiding this comment.
The casing on the names here (and in NameInfo) seems off. In Desktop they had no underscore, presenting as property names. Now they are underscore-pascal; which I don't think is any part of our style rules. Bad CodeFormatter edit?
This ports BinaryFormatter from desktop, along with all of the supporting types and general Formatter-related types. I've added a bunch of tests, bringing code coverage up to ~80%, though there's still more that can/should be done. I did not port remoting-specific functionality, though there are still some remnants I've left as they were enabled in the runtime even when remoting wasn't compiled in, and it wasn't clear if they were serving additional purposes.
5e0cfd8 to
7896300
Compare
|
Thanks for all the feedback. I believe I've addressed everything. |
This ports BinaryFormatter from desktop, along with all of the supporting types and general Formatter-related types. I've added a bunch of tests, bringing code coverage up to ~80%, though there's still more that can/should be done. I did not port remoting-specific functionality, though there are still some remnants I've left as they were enabled in the runtime even when remoting wasn't compiled in, as it wasn't clear if they were serving additional purposes. I did a bunch of cleanup, but there's still more that can be done in the fullness of time.
I already made several changes to CoreCLR to enable this:
(This PR is currently going against master. If that turns out to be the wrong branch for it, I'll resubmit against the correct branch prior to merging.)
cc: @danmosemsft, @jkotas, @KrzysztofCwalina, @ianhays, @bartonjs
Fixes https://github.com/dotnet/corefx/issues/7938
Fixes https://github.com/dotnet/corefx/issues/9582