Bug Report T1216043
Visible to All Users

Code Declare - NullReferenceException is thrown in certain cases

created a year ago

I think this is related to Code Rush.

VS keeps coming up saying that there is a error in the "DeclareProvider".

here is the stack trace:

C#
System.NullReferenceException : Object reference not set to an instance of an object. at Microsoft.CodeAnalysis.AnnotationExtensions.WithAdditionalAnnotations[TNode](TNode node,SyntaxAnnotation[] annotations) at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.PropertyDeclarator.RegisterNodeDeclarations(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.MemberDeclarator.RegisterNodeDeclarations(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.MemberDeclarator.GetNodeReplacements(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.ElementDeclarator.Execute(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.DeclareRefactoring.Execute(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.DeclareRefactoring.ApplyChangeManagerAsync(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.TargetPicker.TargetPickerRegistrator.DoRegistration(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.Refactorings.RefactoringProvider.RegisterRefactoring(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.Refactorings.RefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)

i am using VS v17.8.6

Comments (3)
AE AE
Alex Eg (DevExpress) a year ago

    Hello,

    Please share a sample project where we can reproduce the issue. I tested this behavior in different projects, but I couldn't reproduce it. So, it looks like the issue is related to specific code.

    TH TH
    tony hasselbacher a year ago

      Hi Alex.

      there is no sample as it randomly happens when i can working on my code in VS.
      I just press the "Enable and Ignore" button and goes away.
      the next time i happens, i will see if there is something that might of caused it.

      AE AE
      Alex Eg (DevExpress) a year ago

        Hello,

        I look forward to hearing from you. In the meantime, we will research the code using the call stack you shared and see if we can add necessary checks to avoid the exception.

        Answers approved by DevExpress Support

        created a year 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.

        Important Notes:

        • Hotfixes may be unavailable for Early Access/Beta builds or updates set for release within a week.
        • .NET only: in the NuGet Package Manager, use your personal NuGet feed and check the "Include prerelease" option to view the hotfix package in the "Updates" tab.

          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.