diff options
author | Sven Boemer <sbomer@gmail.com> | 2021-04-16 23:35:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 23:35:40 +0300 |
commit | b3725edf83c88fb712a239433f3143a4654c87b0 (patch) | |
tree | 10954bb35c50ebd9dd95679705167b25e7f585ca /test/Mono.Linker.Tests | |
parent | 1ed6f39a6e716b42fa5e478dcfd30a59f1c8f25e (diff) |
Preserve types for serialization (#1932)
* Preserve types for XML serializer
* Move TypePreserve.All
* Add doc about serialization handling
* Adjust comments
* Remove dataflow type discovery
* Add more tests, update doc
* Add logic for DataContractSerializer
* Remove IsActiveFor check
* Fix comments
* Update docs
* PR feedback
- Remove redundant usings
- Make MarkSubStepsDispatcher non-abstract, make ctor public
- PreserveSerialization -> PreserveSerializationSubStep
- SerializationHelper -> SerializationMarker
* Update heuristics to be less conservative
Instead of trying to conservatively match the xamarin-android behavior,
this now does something more "correct" without building in too much
serializer-specific logic. Specifically:
- Don't preserve methods
- Don't preserve static members
- Don't preserve private members
* Only scan types that are already marked
* Fix test
* Activate serialization logic only for ctor calls
With this change the serialization heuristics will mark types only if
there was a call to a relevant serialization constructor.
* PR feedback
Update docs
* PR feedback
Change flag to --disable-serialization-discovery, and add a test
to check that disabling works as expected.
* Add missing changes
* Update docs/serialization.md
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
* Update docs/serialization.md
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
* Update src/linker/Linker.Steps/DiscoverSerializationHandler.cs
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
* Update src/linker/Linker.Steps/DiscoverSerializationHandler.cs
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
* PR feedback
To ensure private attributed members get marked, this changes the "root"
tracking to track members rather than types. Marking a root member for
serialization will now ensure that the member and its type
(for fields/properties) also get marked recursively.
Similar behavior applies for static members, methods, and events.
Also address other feedback:
- Update docs to describe .ctor-based activation
- Clarify kept vs considered root
- RecursiveType -> SerializedRecursiveType
- Add comment about array type handling
* Handle DataContractJsonSerializer
* Mention DataContractJsonSerializer in docs
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
Diffstat (limited to 'test/Mono.Linker.Tests')
-rw-r--r-- | test/Mono.Linker.Tests/TestCases/TestDatabase.cs | 5 | ||||
-rw-r--r-- | test/Mono.Linker.Tests/TestCases/TestSuites.cs | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs index c4d06e598..73e5ed671 100644 --- a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs +++ b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs @@ -166,6 +166,11 @@ namespace Mono.Linker.Tests.TestCases return NUnitCasesBySuiteName ("Sealer"); } + public static IEnumerable<TestCaseData> SerializationTests () + { + return NUnitCasesBySuiteName ("Serialization"); + } + public static IEnumerable<TestCaseData> SubstitutionsTests () { return NUnitCasesBySuiteName ("Substitutions"); diff --git a/test/Mono.Linker.Tests/TestCases/TestSuites.cs b/test/Mono.Linker.Tests/TestCases/TestSuites.cs index 6edb4ac4b..ae2d45090 100644 --- a/test/Mono.Linker.Tests/TestCases/TestSuites.cs +++ b/test/Mono.Linker.Tests/TestCases/TestSuites.cs @@ -217,6 +217,12 @@ namespace Mono.Linker.Tests.TestCases Run (testCase); } + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.SerializationTests))] + public void SerializationTests (TestCase testCase) + { + Run (testCase); + } + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.ExtensibilityTests))] public void ExtensibilityTests (TestCase testCase) |