Picture of Stefan Lieser
Stefan Lieser

IOSP Analyzer 0.2.0

IOSP Analyzer Example 1

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.

Our seminars

course
Clean Code Developer Basics

Principles and tests - The seminar is aimed at software developers who are just starting to deal with the topic of software quality. The most important principles and practices of the Clean Code Developer Initiative are taught.

to the seminar "
course
Clean Code Developer Trainer

Conducting seminars as a trainer - This seminar is aimed at software developers who would like to pass on their knowledge of Clean Code Developer principles and practices or Flow Design to others as a trainer.

to the seminar "
course
Clean Code Developer CoWorking

Online CoWorking incl. coaching -
We are often asked what developers can do to keep up with the topic of clean code development. Our answer: Meet up with other Clean Code Developers online on a regular weekly basis.

to the seminar "

Leave a Comment

Your email address will not be published. Required fields are marked *

en_USEnglish