Bug Report T1251197
Visible to All Users

Code Declare - NullReferenceException is thrown in certain cases

created 6 months ago

I recently started getting this error from Visual Studio:

Code
System.NullReferenceException : Object reference not set to an instance of an object. at DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantAvailabilityHelperBase.GetAvailableNodeSync(RefactoringContext context) at DevExpress.CodeAnalysis.CSharp.CodeDeclare.ConstantAvailabilityHelperBase.GetAvailableNode(RefactoringContext context) at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.DeclareMemberRefactoring.RefactoringIsAvailable(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async DevExpress.CodeAnalysis.Refactorings.RefactoringProvider.GetAvailableRefactorings(<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.<>c__DisplayClass12_0.<GetRefactoringFromProviderAsync>b__0(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)

It doesn't seem to matter which project I am working on, but most recently I have been doing Blazor Development, not sure if that is relevant.

Microsoft Visual Studio Professional 2022
Version 17.11.1
VisualStudio.17.Release/17.11.1+35219.272
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Professional

ASP.NET and Web Tools 17.11.230.51983
ASP.NET and Web Tools

C# Tools 4.11.0-3.24376.4+5e3a11e2e7f952da93f9d35bd63a2fa181c0608b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CodeRush for Roslyn 24.1.4.0
DevExpress CodeRush for Roslyn package.

CodeRush for Roslyn Tool Windows 24.1.4.0
DevExpress CodeRush for Roslyn Tool Windows package.

Show previous comments (2)

    I have similar issue with: DeclareProvider, WidenScopeProvider, XpoFieldsProvider.

      Same issue here;
      I think that this problem begin after update VS2022 to 17.11.0; updated to 17.11.1 and 17.11.2 but no difference.

      PW PW
      Przemyslaw Wlodarczak (DevExpress) 5 months ago

        Carlos, you are right - the latest Visual Studio update caused all these issues to appear. We are now working on addressing this compatibility issue.

        Answers approved by DevExpress Support

        created 4 months 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.