stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.75k stars 176 forks source link

Stryker raises an InvalidOperationException during mutation phase #2836

Closed Alexael closed 5 months ago

Alexael commented 5 months ago

First of all, thank you very much for one of the most awesome .NET tools around! Unless I did something wrong and I'm the bug, I'll happily work on a PR myself as soon as I get some time.

Describe the bug I have a property named "Order", member of record class "CreateOrderCommand". Stryker 3.13.1 attempts to mutate the property name as if it were IEnumerable.Order() When I rename the property to e.g. "OrderModel", the error does not occur.

Logs stryker.log

Expected behavior Stryker should not attempt to mutate a property name.

Desktop (please complete the following information):

dupdob commented 5 months ago

Thanks for reporting this issue. The problem is not due to your property being named Order: it should be supported. This mutation would normally be reported as a compilation error. What happens here is different: it triggers an internal error where Stryker fails to inject the mutation in the code. And this mutation ends up being tentatively injected in the next statement (hence the error)

It turns out I have a PR in draft that will probably fix this problem. It will try to reproduce this issue via an unit test to confirm I have a fix.

dupdob commented 5 months ago

Analysis is over. It turns I have already pushed a fix for this and it will be part of the next release. You can see issue #2825 for a workaround that will resolve the problem immediately. (I close this issue as this problem is already tracked in 2825)