-
-
Notifications
You must be signed in to change notification settings - Fork 379
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
Add support of .net 7.0 #270
Comments
I suspect that the reason is because these packages are not officially intended to be used directly... but I think that in some way we can adapt the code, in the worst case using a conditional compilation. As usual any help is appreciated. |
It's actually not related to .NET7, you can reproduce it with this code: [Test]
public void Method_with_generic_constraints()
{
var target = new Interpreter();
var x = new MyTestService();
target.SetVariable("x", x);
Assert.AreEqual("works", target.Eval("x.GenericMethodWithConstraint(\"works\")"));
Assert.Throws<NoApplicableMethodException>(() => target.Eval("x.GenericMethodWithConstraint(5)"), "This shouldn't throw a System.ArgumentException \"Violates the constraint of type 'T'\"");
}
private class MyTestService
{
public T GenericMethodWithConstraint<T>(T input) where T : class
{
return input;
}
} You can't call |
I tried to run unit tests on the .net 7.0, everything is working except of linq stuff.
The following unit tests are failing:
Error Message: System.ArgumentException : GenericArguments[1], 'System.Object', on 'TResult Average[TSource,TAccumulator,TResult](System.Collections.Generic.IEnumerable1[TSource])' violates the constraint of type 'TAccumulator'. System.Security.VerificationException : Method System.Linq.Enumerable.Average: type argument 'System.Object' violates the constraint of type parameter 'TAccumulator'.
Linq also fails if you try to use nuget on .net 7.0 project (.net 6.0 are OK).
The text was updated successfully, but these errors were encountered: