Reputation: 8959
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:
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.
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.
Upvotes: 0
Views: 179
Reputation: 13533
There is a very similar issue in YouTrack https://youtrack.jetbrains.com/issue/RSRP-430882.
Upvotes: 1