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.

Mutations for Linq methods don't work

See original GitHub issue

Describe the bug This code with the Linq method doesn’t mutate.

public int TestLinq(int count)
{ 
    var list = Enumerable.Range(1, count);
    return list.Last();
}

Also I tried to move Linq method from return statement.

public int TestLinq(int count)
{
   var list = Enumerable.Range(1, count);
   var last = list.Last();
   return last;
}

And also I tried another methods (First, FirstOrDefault). Unit test for this method.

[Test]
public void TestLinq_One_Equal()
{
    var r = _sl.TestLinq(5);
    Assert.AreEqual(5, r);
}

Expected behavior Linq method should be mutated Last to LastOrDefault (etc) and vice versa.

Desktop (please complete the following information):

  • OS: Windows 10
  • Type of project: core
  • Framework Version: netcoreapp2.2
  • Stryker Version: 0.11.0 (beta)

Additional context Others mutation for another methods works well.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
richardwerkmancommented, Jun 26, 2019

I have to say that the MutantOrchestator is one of the most complex parts of stryker so I think this might be a hard bug to fix. I’ve created a branch where I’ve cleaned the mutant orchestrator tests (579_call_linq_mutator). This makes TDD possible to target this bug. Maybe that could help. I will try to tackle this too if I find time soon.

0reactions
dupdobcommented, Jul 10, 2019

Fixed by PR #624. Manually tested on real project, but specific test added to the codebase

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# grouped objects aren't being mutated as expected
The issue is that I needed to execute the LINQ query first to materialise the objects before sending them off for mutation.
Read more >
Why is my IEnumerable not being mutated when I assign it ...
In my 8 years experience with C# I though passing argument by reference is the default behavior and thus I never perform mutation...
Read more >
Exciting new features for Stryker.NET
The following mutations have been added to the Linq mutator. Original, Mutated. MinBy(), MaxBy(). MaxBy(), MinBy().
Read more >
Supported and Unsupported LINQ Methods (LINQ to Entities)
This article summarizes the standard query operators that are supported and unsupported in LINQ to Entities queries.
Read more >
Insert, update, and delete data using mutations
This page describes how to insert, update, and delete data using mutations. A mutation represents a sequence of inserts, updates, and deletes that...
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