ComparetheMarket / fettle

An experimental mutation testing tool for C# code :bug::mag:
MIT License
66 stars 10 forks source link

Crash when mutated code contains partial method declaration #25

Closed oliwennell closed 6 years ago

oliwennell commented 6 years ago

This line in CoverageAnalyser.cs:

var firstChildNode = methodNode.Body.ChildNodes().FirstOrDefault();

...throws a NullReferenceException when .Body is null, causing Fettle to quit.

.Body will be null when a method doesn't have a "normal" body. Fettle already handles this for expression-bodied methods and abstract methods, but not partial method declarations. E.g.

public abstract void Thing();