diff --git a/src/tests/Interop/IDynamicInterfaceCastable/Program.cs b/src/tests/Interop/IDynamicInterfaceCastable/Program.cs index ccf91480faaa3f..73c84920352d15 100644 --- a/src/tests/Interop/IDynamicInterfaceCastable/Program.cs +++ b/src/tests/Interop/IDynamicInterfaceCastable/Program.cs @@ -393,38 +393,26 @@ public static void ValidateGenericInterface() Console.WriteLine(" -- Validate cast"); // ITestGeneric -> ITestGenericIntImpl - if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 - { - Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.NotNull(castableObj as ITestGeneric); - } + Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.NotNull(castableObj as ITestGeneric); ITestGeneric testInt = (ITestGeneric)castableObj; // ITestGeneric -> ITestGenericImpl - if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 - { - Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.NotNull(castableObj as ITestGeneric); - } + Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.NotNull(castableObj as ITestGeneric); ITestGeneric testStr = (ITestGeneric)castableObj; // Validate Variance // ITestGeneric -> ITestGenericImpl - if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 - { - Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.NotNull(castableObj as ITestGeneric); - } + Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.NotNull(castableObj as ITestGeneric); ITestGeneric testVar = (ITestGeneric)castableObj; - if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 - { - // ITestGeneric is not recognized - Assert.False(castableObj is ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via is"); - Assert.Null(castableObj as ITestGeneric); - var ex = Assert.Throws(() => { var _ = (ITestGeneric)castableObj; }); - Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric)), ex.Message); - } + // ITestGeneric is not recognized + Assert.False(castableObj is ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via is"); + Assert.Null(castableObj as ITestGeneric); + var ex = Assert.Throws(() => { var _ = (ITestGeneric)castableObj; }); + Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric)), ex.Message); int expectedInt = 42; string expectedStr = "str";