We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there,
another small report with testcase. Throws a System.InvalidProgramException : Common Language Runtime detected an invalid program.
System.InvalidProgramException : Common Language Runtime detected an invalid program
public struct SampleType { public bool? Value { get; init; } public SampleType(bool? value) { Value = value; } public static implicit operator bool?(SampleType left) => (left.Value is not null && left.Value is bool b) ? b : null; public static explicit operator bool(SampleType left) => left.Value is not null && left.Value is bool b && b; } [Fact] public void Operator_Implicit_Fast() { var attributeType = typeof(SampleType); var ctorMethodInfo = attributeType.GetConstructors()[0]; var newExpression = Expression.New(ctorMethodInfo, [Expression.Constant(null, typeof(bool?))]); var conversion1 = Expression.Convert(newExpression, typeof(bool)); var conversion2 = Expression.Convert(newExpression, typeof(bool?)); var lambda1 = Expression.Lambda<Func<bool>>(conversion1); var lambda2 = Expression.Lambda<Func<bool?>>(conversion2); var sample1 = lambda1.Compile()(); // <- OK var sample2 = lambda2.Compile()(); // <- OK var sample_fast1 = lambda1.CompileFast()(); // <- OK var sample_fast2 = lambda2.CompileFast()(); // <- throws exception }
The text was updated successfully, but these errors were encountered:
It makes no difference if its implicit operator or explicit operator
implicit operator
explicit operator
Sorry, something went wrong.
@Xemrox Hi, thanks for the reporting. I will check.
added test to reproduce #451
d3052aa
dadhi
No branches or pull requests
Hi there,
another small report with testcase. Throws a
System.InvalidProgramException : Common Language Runtime detected an invalid program
.The text was updated successfully, but these errors were encountered: