0

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.

svick
  • 236,525
  • 50
  • 385
  • 514
ironic
  • 8,368
  • 7
  • 35
  • 44
  • 1
    Possible duplicate of [How to stop Resharper from line breaking after return keyword for long lines?](http://stackoverflow.com/questions/20509768/how-to-stop-resharper-from-line-breaking-after-return-keyword-for-long-lines) – David Pine Feb 19 '16 at 14:26
  • What version of ReSharper are you using, what are the settings -- can you share those? – David Pine Feb 19 '16 at 15:16
  • @DavidPine updated question. – ironic Feb 19 '16 at 15:46

1 Answers1

1

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

Alexander Kurakin
  • 13,373
  • 2
  • 33
  • 29