Update 0.2.0 - 05.04.2024
The IOSP Analyzer now accepts calls from ConfigureAwait within an integration.
If an asynchronous operation is called, this is of course not a violation of the IOSP. However, if you want to call this with ConfigureAwait This was previously considered a framework/runtime call and therefore a violation of the IOSP.
The addition goes back to a fork of the GitHub repo (see https://github.com/LambdaEcho/ccdanalyzers). A pull request to me would also have done the trick here...
The following code example shows the problem:
public async Task GetNumber_IntegrationOnlyWithConfigureAwait() {
var list = GetList();
var number = await FilterNumberAsync(list).ConfigureAwait(continueOnCapturedContext: false);
return number;
}
private Task FilterNumberAsync(IReadOnlyList list) {
int Value() {
if (list.Count > 0) {
return list[list.Count - 1];
}
return 0;
}
var task = Task.Run(Value);
return task;
}
private static IReadOnlyList GetList() {
return new List() { 1, 2, 3, 4 };
}
This is about line 3: the call of ConfigureAwait from the class Task was previously considered an IOSP violation.
I am always open to suggestions and hints as well as suggestions for improvement! Just write me an e-mail or send me a pull request in the repo in.