-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Follow up to universal System.Linq.Expressions #62229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tagging subscribers to this area: @cston Issue DetailsMost of this is test changes so that we run more tests when the expression IL compiler is disabled. There is one product change that we don't need to take, but felt like an improvement. I'll put comments inline in a bit.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've validated that we run the same number of tests in default CoreCLR configuration.
I've also validated that the test fully passes when I artificially disable IL expression compiler on CoreCLR.
@@ -109,7 +109,7 @@ private static bool IsByRef(DynamicMetaObject mo) | |||
|
|||
private static Type MakeNewCustomDelegate(Type[] types) | |||
{ | |||
if (LambdaExpression.CanCompileToIL) | |||
if (RuntimeFeature.IsDynamicCodeSupported) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRODUCT CHANGE: the existing setting was mechanically propagated from FEATURE_COMPILE, but I think here we should be more nuanced between "IL expression compiler is disabled" and "the platform supports reflection emit".
This codepath is not related to compiling IL expressions and we can allow it if emit is otherwise supported. It doesn't feel like it should be lumped into IL expression compiler not being enabled.
If we don't take this change, we need to disable a couple more tests on IL compiler being unavailable.
@@ -54,7 +54,7 @@ public static IEnumerable<object[]> ObjectArguments() | |||
yield return new[] {new object()}; | |||
} | |||
|
|||
[ActiveIssue("https://github.com/dotnet/runtime/issues/55070", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))] | |||
[ActiveIssue("https://github.com/dotnet/runtime/issues/55070", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is passing with CoreCLR and IL compiler disabled, so whatever this is, it's iDevice-specific. This test was disabled in #54970 and not part of the mechanical refactoring.
@@ -335,8 +331,7 @@ private class ManyOverloads | |||
int arg10) => 11; | |||
} | |||
|
|||
// We're not testing compilation, but we do need Reflection.Emit for the test | |||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotLinqExpressionsBuiltWithIsInterpretingOnly))] | |||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was probably hitting some .NET Native specific issues with dynamic keyword. I don't see it using Ref.Emit anywhere so leaving like this.
@@ -380,8 +375,7 @@ public static IEnumerable<object[]> SameNameObjectPairs() | |||
return testObjects.SelectMany(i => testObjects.Select(j => new[] { i, j })); | |||
} | |||
|
|||
// We're not testing compilation, but we do need Reflection.Emit for the test | |||
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotLinqExpressionsBuiltWithIsInterpretingOnly))] | |||
[Theory] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also don't see anything ref.emitting. Was probably some .NET Native issue related to dynamic.
@@ -464,15 +464,15 @@ public void IndexedPropertyVarArgs() | |||
AssertExtensions.Throws<ArgumentException>("propertyName", () => Expression.Property(instance, "Item", Expression.Constant(0), Expression.Constant(0), Expression.Constant(0))); | |||
} | |||
|
|||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotLinqExpressionsBuiltWithIsInterpretingOnly))] | |||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see ref emitting here and it passes with IL expression compiler disabled, so leaving like this.
// IsNotLinqExpressionsBuiltWithIsInterpretingOnly is not directly required, | ||
// but this functionality relies on private reflection and that would not work with AOT | ||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotLinqExpressionsBuiltWithIsInterpretingOnly))] | ||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original motivation sounds .NET Native related.
@@ -70,7 +70,8 @@ public void CreateByRefAliasingInterpreted() | |||
CreateByRefAliasing(useInterpreter: true); | |||
} | |||
|
|||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotLinqExpressionsBuiltWithIsInterpretingOnly))] | |||
[ActiveIssue("https://github.com/dotnet/runtime/issues/19286", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched this one to ActiveIssue - the preceding test has the motivation for this.
@cston do you have any objection to the change in DelegateHelpers.cs? The behavior change is basically:
Basically, it either makes things work, which sounds like a good thing, or just throws PNSE from a different place. |
Most of this is test changes so that we run more tests when the expression IL compiler is disabled. There is one product change that we don't need to take, but felt like an improvement. I'll put comments inline in a bit.