Skip to content

Commit e690777

Browse files
Enable IDynamicInterfaceCastable tests disabled on fixed bug (#108376)
These had to be excluded in #108235 but #108328 fixed them in the meantime. One of these PRs might be serviced for .NET 9 and the other may not, so I'm just reenabling this in a separate PR to make backports easier.
1 parent eb78413 commit e690777

File tree

1 file changed

+11
-23
lines changed
  • src/tests/Interop/IDynamicInterfaceCastable

1 file changed

+11
-23
lines changed

src/tests/Interop/IDynamicInterfaceCastable/Program.cs

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -393,38 +393,26 @@ public static void ValidateGenericInterface()
393393
Console.WriteLine(" -- Validate cast");
394394

395395
// ITestGeneric<int, int> -> ITestGenericIntImpl
396-
if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229
397-
{
398-
Assert.True(castableObj is ITestGeneric<int, int>, $"Should be castable to {nameof(ITestGeneric<int, int>)} via is");
399-
Assert.NotNull(castableObj as ITestGeneric<int, int>);
400-
}
396+
Assert.True(castableObj is ITestGeneric<int, int>, $"Should be castable to {nameof(ITestGeneric<int, int>)} via is");
397+
Assert.NotNull(castableObj as ITestGeneric<int, int>);
401398
ITestGeneric<int, int> testInt = (ITestGeneric<int, int>)castableObj;
402399

403400
// ITestGeneric<string, string> -> ITestGenericImpl<string, string>
404-
if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229
405-
{
406-
Assert.True(castableObj is ITestGeneric<string, string>, $"Should be castable to {nameof(ITestGeneric<string, string>)} via is");
407-
Assert.NotNull(castableObj as ITestGeneric<string, string>);
408-
}
401+
Assert.True(castableObj is ITestGeneric<string, string>, $"Should be castable to {nameof(ITestGeneric<string, string>)} via is");
402+
Assert.NotNull(castableObj as ITestGeneric<string, string>);
409403
ITestGeneric<string, string> testStr = (ITestGeneric<string, string>)castableObj;
410404

411405
// Validate Variance
412406
// ITestGeneric<string, object> -> ITestGenericImpl<object, string>
413-
if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229
414-
{
415-
Assert.True(castableObj is ITestGeneric<string, object>, $"Should be castable to {nameof(ITestGeneric<string, object>)} via is");
416-
Assert.NotNull(castableObj as ITestGeneric<string, object>);
417-
}
407+
Assert.True(castableObj is ITestGeneric<string, object>, $"Should be castable to {nameof(ITestGeneric<string, object>)} via is");
408+
Assert.NotNull(castableObj as ITestGeneric<string, object>);
418409
ITestGeneric<string, object> testVar = (ITestGeneric<string, object>)castableObj;
419410

420-
if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229
421-
{
422-
// ITestGeneric<bool, bool> is not recognized
423-
Assert.False(castableObj is ITestGeneric<bool, bool>, $"Should not be castable to {nameof(ITestGeneric<bool, bool>)} via is");
424-
Assert.Null(castableObj as ITestGeneric<bool, bool>);
425-
var ex = Assert.Throws<DynamicInterfaceCastableException>(() => { var _ = (ITestGeneric<bool, bool>)castableObj; });
426-
Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric<bool, bool>)), ex.Message);
427-
}
411+
// ITestGeneric<bool, bool> is not recognized
412+
Assert.False(castableObj is ITestGeneric<bool, bool>, $"Should not be castable to {nameof(ITestGeneric<bool, bool>)} via is");
413+
Assert.Null(castableObj as ITestGeneric<bool, bool>);
414+
var ex = Assert.Throws<DynamicInterfaceCastableException>(() => { var _ = (ITestGeneric<bool, bool>)castableObj; });
415+
Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric<bool, bool>)), ex.Message);
428416

429417
int expectedInt = 42;
430418
string expectedStr = "str";

0 commit comments

Comments
 (0)