Test-Run fails with "Internal error due to compile error" on generated code
See original GitHub issueThe generated code for a dto by an OpenApi-generator (“csharp-netcore”) contains the following method:
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
This results in the following message for every dto in the project when running stryker.net:
Stryker.NET encountered an compile error in <file> with message: Cannot return a value from an iterator. Use the yield return statement to return a value, or yield break to end the iteration. (Source code: return default(
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult>);)
[06:52:14 WRN] Safe Mode! Stryker will try to continue by rolling back all mutations in method. This should not happen, please report this as an issue on github with the previous error message.
Stopping with
[08:58:44 FTL] Stryker.NET could not compile the project after mutation. This is probably an error for Stryker.NET and not your project. Please report this issue on github with the previous error message.
08:58:44 ERR] An error occurred during the mutation test run
Internal error due to compile error.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Compile error in test run ends up with "tests passed ...
I sympathize with everyone who wishes that go test had a -json flag. Doesn't go test return a non-zero exit code when compilation...
Read more >Not able to run Junit test cases in IntelliJ version ...
I have found two links link1 and link2 but not able to resolve the issue. Please help. Error I am getting : Information:java:...
Read more >.Net Core C# Unit test projects give internal error in ...
Net Core MSTest Unit test project, all variables I try to examine return "Internal Error in the C# compiler". This happens from Immediate ......
Read more >Troubleshoot code coverage - Visual Studio
Learn how to resolve erroneous empty results messages when you expect Visual Studio to collect data for native and managed assemblies.
Read more >Performance testing error messages
A Test could not be launched on Driver: %1 due to an internal error. Please see Problem Determination Log. For more information, see...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think this is related to generated code. There is two issues here:
return default(type)
oryield return default(type)
at the end of methods. It should have injected ayield return
here. The decision is based on the (pre)existence of ayield return
in the code. We did not think about having onlyyield break
.return default(type)
but it clearly failed to do so.Both should be fixable and will be fixed. Until a fix is available, the best course of action is to ignore this file with Stryker options.
This fix solves my problem. Thank you