diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index d1c926967ab0..81a584898293 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -466,6 +466,9 @@ --> <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --disable-opt unusedtypechecks + + <_ExtraTrimmerArgs Condition="'$(_BundlerDebug)' != 'true' And '$(MtouchInterpreter)' == '' And '$(_RunAotCompiler)' == 'true' And '$(_PlatformName)' != 'macOS'">$(_ExtraTrimmerArgs) --enable-opt sealer + false diff --git a/tests/linker/ios/link all/SealerTest.cs b/tests/linker/ios/link all/SealerTest.cs index 1ebe75909078..329beb67c3dd 100644 --- a/tests/linker/ios/link all/SealerTest.cs +++ b/tests/linker/ios/link all/SealerTest.cs @@ -36,9 +36,17 @@ public class Subclass : Base, Interface { [Preserve (AllMembers = true)] public class SealerTest { -#if !DEBUG && NET - [Ignore ("https://github.com/xamarin/xamarin-macios/issues/9573")] +#if NET + [SetUp] + public void SetUp () + { + // XML serialization mechanism is controlled by RuntimeFeature.IsDynamicCodeSupported + // which will be true for simulator / JIT builds + // so the optimization is disabled unless AOT is used + TestRuntime.AssertDevice (); + } #endif + [Test] public void Sealed () { @@ -62,9 +70,6 @@ public void Sealed () #endif } -#if !DEBUG && NET - [Ignore ("https://github.com/xamarin/xamarin-macios/issues/9573")] -#endif [Test] public void Final () { @@ -81,13 +86,10 @@ public void Final () // but it can be optimized / sealed as nothing else is (or can) overrides it Assert.True (a.IsFinal, "A"); Assert.True (b.IsFinal, "B"); - Assert.True (c.IsFinal, "C"); + Assert.False (c.IsFinal, "C"); // devirtualized #endif } -#if !DEBUG && NET - [Ignore ("https://github.com/xamarin/xamarin-macios/issues/9573")] -#endif [Test] public void Virtual () { diff --git a/tools/linker/MonoTouch.Tuner/SealerSubStep.cs b/tools/linker/MonoTouch.Tuner/SealerSubStep.cs index 51dc844b5233..645c94d1b7f1 100644 --- a/tools/linker/MonoTouch.Tuner/SealerSubStep.cs +++ b/tools/linker/MonoTouch.Tuner/SealerSubStep.cs @@ -102,6 +102,7 @@ protected override void Process (TypeDefinition type) // look if this method is an override to existing _marked_ methods if (!AreMarked (bases)) { method.IsVirtual = false; + method.IsFinal = false; // since it's not virtual anymore #if DEBUG Console.WriteLine ("Devirtualize {0} ({1})", method, ++devirtualize); #endif