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.

Cannot specify full method name within ignored methods

See original GitHub issue

Describe the bug

So imagine I have the following code:

public static void CheckAnswer(int number)
{
    if (number == 42)
    {
        return;
    }

    CrashWithException("wrong answer");
}

private static void CrashWithException(string text)
{
    throw new Exception(text);
}

For dotnet stryker, Stryker produces two mutations here, as expected:

image

Now I want to ignore the exception text mutation. I run Stryker like dotnet stryker -im "['CrashWithException']".

This also works as expected:

image

Now I decide to move the CrashWithException logic to a separate class Crash with the method WithException:

public static void CheckAnswer(int number)
{
    if (number == 42)
    {
        return;
    }

    Crash.WithException("wrong answer");
}

But now if I run it like dotnet stryker -im "['Crash.WithException']" the mutation is not ignored anymore:

image

I can ignore just WithException but I don’t want that - because the name is not generic enough and I’m afraid to miss some important mutations elsewhere in the code. I want to ignore only this particular one in that particular class.

Expected behavior One can specify the full method name within ignored methods setting and this is taken into account.

Desktop (please complete the following information):

  • OS: Windows
  • Type of project: Core
  • Framework Version: NET 5.0
  • Stryker Version: 0.22.7

Additional context I attach the repro. IgnoreRepro.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
rouke-broersmacommented, Jul 29, 2021

Right sorry it should have been closed with the merge but because we changed the default branch github won’t auto close. We keep forgetting :p

1reaction
richardwerkmancommented, Jul 23, 2021

Awesome! Good luck.

And a tip: if you want to quickly check how a syntaxtree for this looks like use this website sharplab.io

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - "Result of method is ignored"- what does this imply?
This method suggests that you are creating directory with your specified path if directory is not already created then this function will ...
Read more >
CA1806: Do not ignore method results (code analysis) - .NET
Method name only (which will include all methods with that name, regardless of their containing type or namespace). Fully qualified name in ......
Read more >
Ignoring in Git: How To Use .gitignore Files
When making commits to any Git repository, you'll choose the files you want to stage and then you'll commit them.
Read more >
Ignoring Files and Folders in Git
Here the name of the empty folder is batman. So these are the two methods by which we can track an empty folder...
Read more >
Overriding and Hiding Methods (The Java™ Tutorials ...
An instance method in a subclass with the same signature (name, plus the number and ... Methods that are already overridden by other...
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