question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linq expressions with no replacements break builds

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
richardwerkmancommented, Feb 14, 2019

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!

0reactions
rouke-broersmacommented, Feb 15, 2019

I agree

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found