-
Notifications
You must be signed in to change notification settings - Fork 71
Description
I've noticed that some tests which fail in Debug configuration no longer fail in our CI pipeline as the tests in the pipeline are running in Release configuration. Code optimizations applied in release config can lead to validations not properly working anymore.
I have a demo repro available here: https://github.com/timbussmann/ArchUnitNetRepro:
The problem is that due to async state machine optimizations, this code:
public async Task DoSomethingAsync()
{
await service.SomeAsyncMethod();
}
does not violate the following assertion anymore since the actual call has been extracted into the async state machine:
Classes().Should().NotCallAny(MethodMembers().That().AreDeclaredIn(typeof(ExampleService)))
I'm aware that this isn't necessarily ArchUnit.NET's fault, but it's a problem one can easily run into without noticing for a long time, making the tests less useful.