Bug Report T736487
Visible to All Users

Formatting removes a space between the ‘async’ keyword and the list of lambda-expression parameters

created 6 years ago

CodeRush's Document Formatting feature transforms this:

C#
// Automatically refresh tokens if authorization fails. var policy = Policy .Handle<FaultException>(ex => ex.Code.Name == "INVALID_SESSION_ID") .RetryAsync( retryCount: 1, onRetryAsync: async (outcome, retryNumber, context) => { mLogger.LogInformation("Authorization with metadata API failed (API returned INVALID_SESSION_ID error); attempting to refresh access token."); _ = await mOrgAccessProvider.GetAccessTokenAsync(forceRefresh: true); });

into this:

C#
// Automatically refresh tokens if authorization fails. var policy = Policy .Handle<FaultException>(ex => ex.Code.Name == "INVALID_SESSION_ID") .RetryAsync( retryCount: 1, onRetryAsync: async(outcome, retryNumber, context) => { mLogger.LogInformation("Authorization with metadata API failed (API returned INVALID_SESSION_ID error); attempting to refresh access token."); _ = await mOrgAccessProvider.GetAccessTokenAsync(forceRefresh: true); });

Note that the space between "async" and the lambda parameter list on line 6 has been removed.

I have searched through the formatting settings but cannot find any way to configure this behavior. The closest related setting I can find is in the attached screenshot, but obviously that one has no effect on this.

Answers approved by DevExpress Support

created 4 years ago

We have addressed the issue described in this ticket and will include a fix in our next maintenance update. Should you need to apply our fix prior to official release, you can request a hotfix here.

Note: Hotfixes may be unavailable for betas/updates set for release within a week.

    Other Answers

    created 6 years ago

    Hi Daniel,

    You can set the "Insert space before parentheses" option that locates in "Spacing" options for parameters.
    Here is an image illustrating how to find this option.

      Show previous comments (1)
      DevExpress Support Team 6 years ago

        Hi Daniel,

        Thank you for the clarification.
        We discussed the possibility of adding separate spacing options for parameters in lambda functions and think that it makes sense.
        We've included this task into our plans.

        ZB ZB
        Zvonko Boštjančič 4 years ago

          Hi

          Any update on this matter? It has been over two years without a suitable resolution …

          Thanks,
          Zvonko

          DevExpress Support Team 4 years ago

            Hello,
            Thank you for bringing up this question. We discussed this and reviewed Visual Studio formatting. Visual Studio inserts spaces between the async keyword and lambda parameter list by default. So, we understand that our formatting may be confusing in such cases. We decided to fix this without any additional options.

            This will take some time. We will let you know once a fix is ready.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.