Linq expressions with no replacements break builds
See original GitHub issueI know the Linq mutator was only added recently but there appears to be issues with the mutations that go from something to ‘none’ (OrderBy, OrderByDescending, Reverse, etc), where the replacement is not able to build.
For example, the following line:
someList.OrderBy(i => i.ToString());
is mutated to:
someList.(i => i.ToString());
Perhaps the following options could be considered for fixes?
// Remove the call
someList;
// Find a valid anti-call (may not be always possible)
someList.OrderByDescending(i => i.ToString());
// Don't mutate (when no reasonable mutation exists)
someList.OrderBy(i => i.ToString());
I’ve put together a small reproduction:
public class Class1
{
public void DoIt()
{
new List<object>().OrderBy(o => o.ToString());
}
}
And attached some logs: stryker-debug.log
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Complicated Linq expression builder
I like strong-typed Linq queries, especially since my organization tends to request schema changes on a scarily regular basis, and I want to...
Read more >Expression Trees
Building and running expression trees enables dynamic modification of executable code, the execution of LINQ queries in various databases, and ...
Read more >How to Build Dynamic Queries With Expression Trees in C#
We explore building dynamic query expression trees in C#, creating powerful queries, and covering built-in expressions and conjunctions.
Read more >Mocking LINQ Expressions - Building Steps - WordPress.com
In today's post, we will discuss mocking/stubbing lambda expressions so that we can have a bit more control over our unit tests.
Read more >The power of Entity Framework Core and LINQ Expression ...
This is just a good practice for decoupling database infrastructure code from your service/application and taking the advantage of dependency ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your notice. This mutation was meant to remove the call as you said. It seems nobody noticed this before since the mutations are just rollbacked and this is not shown (unless debugging is enabled). I’ll look into this too!
I agree