Bug Report T492101
Visible to All Users

Refactorings - DeclareProvider fails on the string literal in VS2017

created 8 years ago

Dear Support,

I am getting this error when loading any page.  It also comes up in the Output window when building my project.

Stack Trace:
System.NullReferenceException : Object reference not set to an instance of an object.
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxToken.Identifier(GreenNode leading,String text,GreenNode trailing)
   at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Identifier(String text)
   at DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantDeclaratorBase.CreateConstantDeclaration(TypeSyntax type,String name,ExpressionSyntax initializer,SyntaxKind visibility,SyntaxTrivia endOfLine)
   at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantDeclaratorBase.RegisterNodeDeclarations(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.MemberDeclarator.GetNodeReplacements(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantDeclarator.GetNodeReplacements(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.ElementDeclarator.Execute(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.DeclareMemberRefactoring.Execute(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.DeclareRefactoring.ApplyChangeManager(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.TargetPicker.TargetPickerRegistrator.DoRegistration(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.TargetPicker.TargetPickerRefactoringProvider.DoRefactoringRegistration(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.Refactorings.RefactoringProvider.RegisterRefactoring(<Unknown Parameters>)
   at async DevExpress.CodeAnalysis.Refactorings.RefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)

I am running the latest Build of your software.
Also CodeRush for Rosslyn V16.2.6
Using VS Professional 2017 Ver: 15.0.0-RTW+26288.4

Comments (3)
DevExpress Support Team 8 years ago

    Hello,

    Thank you for your call stack. I have created a sample project using our Templates Gallery in Visual Studio 2017 and it works fine. Please see the attached video. Would you please describe the issue in greater detail? It would be of great help if you provide us with a sample project that illustrates the issue in action. We will research it and find the cause of this behavior.

      Hello,

      I also has same issue as the original poster.

      System.NullReferenceException : Object reference not set to an instance of an object.
         at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxToken.Identifier(GreenNode leading,String text,GreenNode trailing)
         at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Identifier(String text)
         at DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantDeclaratorBase.CreateConstantDeclaration(TypeSyntax type,String name,ExpressionSyntax initializer,SyntaxKind visibility,SyntaxTrivia endOfLine)
         at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantDeclaratorBase.RegisterNodeDeclarations(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.MemberDeclarator.GetNodeReplacements(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantDeclarator.GetNodeReplacements(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.ElementDeclarator.Execute(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.DeclareMemberRefactoring.Execute(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.DeclareRefactoring.ApplyChangeManager(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.TargetPicker.TargetPickerRegistrator.DoRegistration(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.TargetPicker.TargetPickerRefactoringProvider.DoRefactoringRegistration(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.Refactorings.RefactoringProvider.RegisterRefactoring(<Unknown Parameters>)
         at async DevExpress.CodeAnalysis.Refactorings.RefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
         at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)

      I started using VS2017 Community Edition with the latest CodeRush for Rosslyn and DevExpress.  The error message pops up on certain area of syntax.  I also tested this on other machine that has VS2017 Pro with same latest DevExpress products.

      For example,

      var test = "Hello My World".Split(new char[] { ',', ';', ' '});

      Whenever I click inside any character "Hello My World" from different lines, it triggers the error.

      I also found other case that triggers the error.  It's in the sample project.

      I am attaching the sample project for your investigation.

      Thanks!

      DevExpress Support Team 8 years ago

        Hello,

        Thank you for the detailed explanation and providing a code sample.
        I managed to reproduce this issue on my side.
        We will fix it as soon as possible and notify you when we have any results.

        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.