Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Merge serialization changes to 2.0.0 #12020

Merged

Conversation

krwq
Copy link
Member

@krwq krwq commented May 31, 2017

Pending validation:

  • CoreFX 2.0.0 build with this changes picked up

running through CI to see failures early.

cc: @danmosemsft @ViktorHofer @morganbr

morganbr and others added 5 commits May 31, 2017 13:09
Removes SerializableAttribute from CoreCLR types not intended to be serializable as well as adding special handling to MulticastDelegate to prevent serializing delegates (which can't be correctly serialized cross platform/runtime).
Changes to throw PlatformNotSupportedException from ISerializable.GetObjectData and serialization constructors on non-Serializable types. Also removes private serialization constructors and some unneeded code that was used to support serializing non-serializable types. A few tests testing GetObjectData implementations are also removed. For Exception types, we call base instead of throwing from GetObjectData to be consistent with the many Exceptions that don't override GetObjectData
Throws PlatformNotSupportedException from IDeserializationCallback and IObjectReference implementations on types that are no longer serializable.
…ased serialization (dotnet#11910)

* Variables renamed for reflection based serialization

* Make EqualityComparers serialize like desktop

* add missing interfaces

* TimeZone serializable added

* Internal hashtable serializable

* Removed TimeZone as serializable type

* Remove Lazy<T>'s [Serializable] attribute for 2.0

For performance, Lazy was completely rewritten for .NET Core 2.0 and has an entirely different format than desktop; trying to get it to match the desktop serialization format would require either reverting or providing a complicated custom serialization/deserialization implementation to try to match.  Lazy can also wrap an Exception that occurred from trying to instantiate the object, and the only exception types that are serializable as of now in core are the base Exception and AggregateException.  As such, we're cutting it from the list of supported types in 2.0.  An easy workaround is simply to do what the implementation does: serialize lazy.Value instead of lazy.

* tiny fixes to equalitycomparer.cs
Internal hashtable serialization attribute removed
@morganbr
Copy link

We might still need #12010

CC @atsushikan

@krwq
Copy link
Member Author

krwq commented May 31, 2017

@dotnet-bot test Windows_NT x64 CoreCLR Perf Tests Correctness please

Agent went offline during the build
ERROR: Connection was broken: java.io.IOException: Connection aborted: org.jenkinsci.remoting.nio.NioChannelHub$MonoNioTransport@23b2c473[name=win2012-e97810]

@krwq
Copy link
Member Author

krwq commented May 31, 2017

@morganbr let's merge this without Ati's change and include it with TimeZoneInfo changes

@danmoseley
Copy link
Member

I would like to merge what we are testing in CoreFX right now - which does not include Ati's change.

@morganbr
Copy link

@krwq is #11535 already in 2.0 or does it need to be included in this change as well?

@krwq
Copy link
Member Author

krwq commented May 31, 2017

@morganbr seems to be already in (everything before ~5/15 should be in)

@danmoseley
Copy link
Member

Obviously, please don't merge this without shiproom approval. (And testing your CoreFX PR with it of course)

@krwq
Copy link
Member Author

krwq commented May 31, 2017

@danmosemsft FYI it's green, please merge once shiproom approves

@krwq
Copy link
Member Author

krwq commented Jun 1, 2017

@danmosemsft this is working locally with CoreFX pending changes

@ViktorHofer
Copy link
Member

We should now also include the TimeZoneInfo fix: f32ce49

@danmoseley
Copy link
Member

@ViktorHofer if that has been validated with corefx test please go ahead and update the 2.0 port PRs worth the fix and the text fix.

@ghost
Copy link

ghost commented Jun 1, 2017

If you revert the changes to Assembly.cs, Module.cs and ParameterInfo.cs (i.e. exclude them from the "changeset"), you actually have the part of #12010 that should be in 2.0. I think makes a little more sense than a second Shiproom request to undo something you're changing as part of this Shiproom request.

@danmoseley
Copy link
Member

@atsushikan one would think, but it's essential I get this in today, and arguably that would reset testing. We can follow up right away with your change.

@krwq
Copy link
Member Author

krwq commented Jun 1, 2017

FAILED   - JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b47975/b47975/b47975.sh
               BEGIN EXECUTION
               /home/coreclr/bin/tests/Windows_NT.x64.Release/Tests/coreoverlay/corerun b47975.exe
               ./b47975.sh: line 240:   705 Segmentation fault      (core dumped) $_DebuggerFullPath "$CORE_ROOT/corerun" $ExePath $CLRTestExecutionArguments
               Expected: 100
               Actual: 139
               END EXECUTION - FAILED

doesn't look related to our changes

@danmoseley
Copy link
Member

@krwq since we didn't change the runtime, and that test 47975 does not appear to exercise our code, I think this is safe to ignore.

@danmoseley
Copy link
Member

@dotnet-bot test Tizen armel Cross Release Build (running again since we have some time)

@danmoseley danmoseley added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Jun 1, 2017
@ViktorHofer ViktorHofer merged commit a493839 into dotnet:release/2.0.0 Jun 1, 2017
@ViktorHofer ViktorHofer removed the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Jun 1, 2017
danmoseley pushed a commit that referenced this pull request Jun 14, 2017
Fix https://github.com/dotnet/corefx/issues/20574

The decision to make the runtime's implementation of
Reflection objects non-serializable went too far
and changed the behaviors of methods inherited by
all Reflection implementors. In particular, by
changing ParameterInfo.GetRealObject() to throw PNSE,
all third-party implementations of ParameterInfo become
undeserializable, not just the runtime's implementation.
The intended change was to make the runtime's implementation
non-serializable which is already accomplished by removing
[Serializable] from RuntimeParameterInfo.

The methods on the abstract base classes for Reflection
are "apis" to all Reflection implementors and their long-standing
behaviors should not change based on decisions made
by the runtime's particular implementation.

This commit rolls back those changes that were introduced
as part of #12020.
@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants