Bug Report T437351
Visible to All Users

Templates (C#) - and, or, not, xor etc. should not be expanded inside xml comments

created 8 years ago

In C#, when I type the word 'and' within a comment, it gets converted to '&&' when I press the space. Same for 'not' which gets converted to '!'. How can I prevent this.

I remember there was a setting in the old CodeRush to prevent template expansions in comments, but I cannot find anything similar in CodeRush for Roslyn.

I guess I could modify the template definition, but it seems to be correct. 'Transitional/Visual Basic/and' has

C#
Context: ([InCodeBlock] && [CharLeftIsWhitespace]) && ![InPreprocessorDirective]

But it's still firing within comments.

Show previous comments (1)
RA RA
Robert Anderson 8 years ago

    Ok I played around some more. It's related to triple slash comments, but it also seems to be context sensitive too. Outside of methods it seems ok.

    C#
    namespace ConsoleApplication2 { /// <summary> /// Works ok here. and not or /// </summary> class Program { /// <summary> /// Works ok here. and not or /// </summary> static void Main(string[] args) { /// Fails here. && ! || // but not here. and not or } } public class MyClass { public MyClass() { /// && ! || /// Definitely related to triple slash comments. // Ok here. and not or } } }
    RA RA
    Robert Anderson 8 years ago

      I've attached my settings.

      DevExpress Support Team 8 years ago

        Thank you for the additional information. I have reproduced this issue inside xml comments. We will fix this issue in our future builds.
        As a workaround you can change the context to

        C#
        ([InCodeBlock] && [CharLeftIsWhitespace]) && ![InPreprocessorDirective] && ![InXmlDocComment]

        Answers approved by DevExpress Support

        created 8 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          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.