-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Unit Tests that test methods with Decompile fail while trying to calculate code coverage #15
Comments
Is probably fixed, #39 |
Still seeing this issue in Visual Studio 2019 Enterprise 16.9.4, using EFCore 5.0.5. However the error I see now is as follows: ... |
I'm encountering this as well in 0.30.0. Stepped into it with the debugger. The DelegateDecompiler/src/DelegateDecompiler/MethodBodyDecompiler.cs Lines 42 to 46 in 6a2046e
In my case, that results in a stack with a bunch of extraneous Good instructions: Bad stack, after popping off an Good stack, empty after correctly popping the nullable I guess the integers aren't really a problem, the real problem is why isn't EDIT: First time working with IL, so this is taking me a bit, but it appears that the stloc instruction at index 3/9 pops whatevers on top of the stack into the local variable array at index 1. In the non-code coverage version of the code, that's the value that was just returned from 0002, the call to get that DateTimeOffset. In the code coverage version, that's instead the value Seems like DelegateDecompiler is interpreting these instructions correctly, it's just that the instructions themselves are garbled. |
@hazzik, I've managed to put together a minimal reproduction for this one. It's very strange. |
Hello, i have encountered an issue with DelegateDecompiler:
When i try to test methods that use Decompile(), those tests are passing when i just run them, but when i try to calculate code coverage i receive following error in every test that use Decompile():
System.AggregateException: One or more errors occurred. ---> System.InvalidCastException: Specified cast is not valid.
at DelegateDecompiler.Processor.Process(Instruction instruction, Instruction last)
at DelegateDecompiler.Processor.Process(Instruction instruction, Type returnType)
at DelegateDecompiler.MethodBodyDecompiler.Decompile()
at DelegateDecompiler.DecompileExtensions.<>c__DisplayClass1.b__0(MethodInfo m)
at DelegateDecompiler.Cache
2.GetOrAdd(TKey key, Func
2 func)at DelegateDecompiler.DecompileExtensions.Decompile(MethodInfo method)
at DelegateDecompiler.DecompileExpressionVisitor.Decompile(MethodInfo method, Expression instance, IList
1 arguments) at DelegateDecompiler.DecompileExpressionVisitor.VisitMember(MemberExpression node) at System.Linq.Expressions.MemberExpression.Accept(ExpressionVisitor visitor) at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) at System.Linq.Expressions.ExpressionVisitor.VisitMemberAssignment(MemberAssignment node) at System.Linq.Expressions.ExpressionVisitor.VisitMemberBinding(MemberBinding node) at System.Linq.Expressions.ExpressionVisitor.Visit[T](ReadOnlyCollection
1 nodes, Func2 elementVisitor) at System.Linq.Expressions.ExpressionVisitor.VisitMemberInit(MemberInitExpression node) at System.Linq.Expressions.MemberInitExpression.Accept(ExpressionVisitor visitor) at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression
1 node)at System.Linq.Expressions.Expression
1.Accept(ExpressionVisitor visitor) at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node) at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor visitor) at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) at System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at DelegateDecompiler.DecompileExpressionVisitor.VisitMethodCall(MethodCallExpression node) at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor) at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) at DelegateDecompiler.DecompileExtensions.Decompile[T](IQueryable
1 self)at IBCM.Models.Readers.TaskReader.d__6.MoveNext() in D:\dev\ibcm\src\Models\Readers\TaskReader.cs:line 41
--- End of stack trace from previous location where exception was thrown ---
I tried using nCrunch, dotCover and Visual Studio Coverage Analyzer, but tests are failing no matter which test engine i am using. As i said it happens only when i try to calculate code coverage, tests are working when i run them manually. Example of method with Decompile:
The text was updated successfully, but these errors were encountered: