Why ReSharper breaks line in await and return statements differently?

ironic

I have encountered strange behavior which I find annoying and cannot find where it comes from. Consider following code:

using System.Threading.Tasks;

class Program
{
    public static Task DoAction(int i, int j, int k)
    {
        return null;
    }

    public static int GetParameterFromComplicatedProcedure()
    {
        return 0;
    }

    static async Task Main(string[] args)
    {
        return DoAction(GetParameterFromComplicatedProcedure(), GetParameterFromComplicatedProcedure(),
                        GetParameterFromComplicatedProcedure());
    }
}

In Main method the call is wrapped, but kept on same line with 'return'. However, if I change 'return' to 'await', ReSharper formats like this:

await
    DoAction(GetParameterFromComplicatedProcedure(), GetParameterFromComplicatedProcedure(),
             GetParameterFromComplicatedProcedure());

Why does this happen and is there any way to change that?

UPD In response to possible duplicate:

  1. The question is not about how to stop ReSharper from breaking lines. It is about why is there a different handling of 'await' and 'return' statements, which seems to be quite clearly stated in the title, which is a good thing to pay attention to.

  2. The question about breaking lines immediately after 'return' keyword is not properly answered anyway. There are only answers telling how to remove wrapping at all, not how to change places where line is broken.

UPD2 My ReSharper version: 10.0.2 Ultimate. All settings default, except: Code Editing -> C# -> Formatting Style -> Line Breaking and Wrapping -> Keep existing line breaks = false.

Alexander Kurakin

There is a very similar issue in YouTrack https://youtrack.jetbrains.com/issue/RSRP-430882.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why do these statements work differently in JavaScript?

From Dev

WHy a constant char breaks Loop and Switch statements

From Dev

How to Prevent ReSharper from Wrapping One-Line Statements?

From Dev

How to Prevent ReSharper from Wrapping One-Line Statements?

From Dev

Why are Windows line breaks larger than Unix line breaks?

From Dev

Why does Pry format these return values differently?

From Dev

why return behaves differently here in java?

From Dev

Why does * work differently in assignment statements versus function calls?

From Dev

Why aren't there line breaks in this <pre> tag?

From Dev

Why is it faster to read a file without line breaks?

From Dev

Why does the paste command add line breaks?

From Dev

Why do Excel line breaks not transfer into Notepad?

From Dev

Why are there backslash `\` line breaks on this apt install command?

From Dev

Why does C++ require breaks in switch statements?

From Java

Why do my conditions (IF statements) return false?

From Dev

Why are multi-variable return statements allowed?

From Dev

python - Why is it mandatory to use return statements in recursion?

From Dev

Why does the compiler not recognize my return statements?

From Dev

python - Why is it mandatory to use return statements in recursion?

From Dev

Javascript: Why using anonymous functions and return statements

From Dev

Why does thenComposeAsync await the return to be redeemable

From Dev

Why does resharper suggest: "Return type can be IEnumerable<T>"?

From Dev

How to return text from window.prompt() that retains line breaks?

From Dev

Remove every line breaks following carriage return (^M) and join the lines

From Dev

EJS/Javascript: Carriage return & line break breaks Javascript

From Dev

Why does [:lower:] return differently in bash depending on the existence of files?

From Dev

Why does [:lower:] return differently in bash depending on the existence of files?

From Java

Why does a Java class compile differently with a blank line?

From Dev

Why does a Java class compile differently with a blank line?

Related Related

  1. 1

    Why do these statements work differently in JavaScript?

  2. 2

    WHy a constant char breaks Loop and Switch statements

  3. 3

    How to Prevent ReSharper from Wrapping One-Line Statements?

  4. 4

    How to Prevent ReSharper from Wrapping One-Line Statements?

  5. 5

    Why are Windows line breaks larger than Unix line breaks?

  6. 6

    Why does Pry format these return values differently?

  7. 7

    why return behaves differently here in java?

  8. 8

    Why does * work differently in assignment statements versus function calls?

  9. 9

    Why aren't there line breaks in this <pre> tag?

  10. 10

    Why is it faster to read a file without line breaks?

  11. 11

    Why does the paste command add line breaks?

  12. 12

    Why do Excel line breaks not transfer into Notepad?

  13. 13

    Why are there backslash `\` line breaks on this apt install command?

  14. 14

    Why does C++ require breaks in switch statements?

  15. 15

    Why do my conditions (IF statements) return false?

  16. 16

    Why are multi-variable return statements allowed?

  17. 17

    python - Why is it mandatory to use return statements in recursion?

  18. 18

    Why does the compiler not recognize my return statements?

  19. 19

    python - Why is it mandatory to use return statements in recursion?

  20. 20

    Javascript: Why using anonymous functions and return statements

  21. 21

    Why does thenComposeAsync await the return to be redeemable

  22. 22

    Why does resharper suggest: "Return type can be IEnumerable<T>"?

  23. 23

    How to return text from window.prompt() that retains line breaks?

  24. 24

    Remove every line breaks following carriage return (^M) and join the lines

  25. 25

    EJS/Javascript: Carriage return & line break breaks Javascript

  26. 26

    Why does [:lower:] return differently in bash depending on the existence of files?

  27. 27

    Why does [:lower:] return differently in bash depending on the existence of files?

  28. 28

    Why does a Java class compile differently with a blank line?

  29. 29

    Why does a Java class compile differently with a blank line?

HotTag

Archive