Bug Report T1255310
Visible to All Users

Code Declare - "DeclareProvider encountered an error and has been disabled" is thrown in Visual Studio 2022

created 5 months ago

Not looking for support - just reporting the bug:

Received above "DeclareProvider encountered an error and has been disabled" in Visual Studio 2022 Enterprise.

Here's the about window:
Microsoft Visual Studio Enterprise 2022
Version 17.11.4
VisualStudio.17.Release/17.11.4+35312.102
Microsoft .NET Framework
Version 4.8.09037

Installed Version: Enterprise

Visual C++ 2022 00482-20600-49203-AA957
Microsoft Visual C++ 2022

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 17.11.231.19466
ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.11.231.19466
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio 2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 17.11.231.19466
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 4.11.0-3.24460.3+5649376e0e5f5db3743a94a62b073f2cce4be5d9
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.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

DevExpress Reporting Tools Extension 1.0
Extends Visual Studio with tools required for the Report Designer editor.

DevExpress.DeploymentTool 1.0
A useful tool for deploying DevExpress assemblies.

FireGiant HeatWave 1.0.4.5
Visual Studio tooling for WiX projects. For more information about HeatWave, visit http://www.firegiant.com.

GitHub Copilot 0.2.1653.9816
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

ILSpy.AddIn 1.0
Integration of the ILSpy Decompiler into Visual Studio.

Microsoft Azure Hive Query Language Service 2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service 2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager 6.11.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core) 17.11.3.2442001+68650a7d94261bc56a1f4bc522c2ee35314b1abb
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 17.11.47.0
Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 17.0.30715.2002
TypeScript Tools for Microsoft Visual Studio

VersionChanger Extension 1.0
VersionChanger Visual Studio Extension Detailed Info

Visual Basic Tools 4.11.0-3.24460.3+5649376e0e5f5db3743a94a62b073f2cce4be5d9
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.11.0-beta.24421.7+af2f522de602281d4ef5a7b71507c428e814c5c1
Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

WiX Toolset Visual Studio Extension 1.0.0.22
WiX Toolset Visual Studio Extension version 1.0.0.22
Copyright © .NET Foundation and contributors. All rights reserved.

Here's the stack trace:
System.ArgumentNullException : Value cannot be null.
Parameter name: returnType
at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MethodDeclaration(SyntaxList1 attributeLists,SyntaxTokenList modifiers,TypeSyntax returnType,ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier,SyntaxToken identifier,TypeParameterListSyntax typeParameterList,ParameterListSyntax parameterList,SyntaxList1 constraintClauses,BlockSyntax body,ArrowExpressionClauseSyntax expressionBody,SyntaxToken semicolonToken)
at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MethodDeclaration(TypeSyntax returnType,SyntaxToken identifier)
at DevExpress.CodeAnalysis.CSharp.CodeDeclare.MethodDeclarator.RegisterDeclarationForMethodReference(InsertionPlaceInfo insertionInfo,ICSharpSyntaxService syntaxService,SemanticModel semantic,Int32 position,SyntaxToken identifier,TypeSyntax returnType,ParameterListSyntax parameterList,IEnumerable`1 typeParametersInfos,ITypeSymbol returnTypeSymbol)
at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.MethodDeclarator.RegisterDeclarationForSimpleName(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async DevExpress.CodeAnalysis.CSharp.CodeDeclare.MethodDeclarator.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.<>c__DisplayClass12_0.<GetRefactoringFromProviderAsync>b__0(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)

This is the code I was typing at the time:

C#
foreach (var line in lines) { var parseResults = CSVHelpers.SplitCSV(line); switch (parseResults[0]) { case "HD": // we have a header retVal.RecordID = parseResults[0]?.Trim(); retVal.FileControlNumber = parseResults[1]?.Trim(); if (DateTime.TryParse(parseResults[2], out var p)) retVal.FileDate = p; break; } }

Hope that helps :)

Regards!

Comments (1)
PW PW
Przemyslaw Wlodarczak (DevExpress) 5 months ago

    Carl,

    Thank you for the report. We are already aware of this issue and are working on a fix now.

    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.
      Comments (3)
      PW PW
      Przemyslaw Wlodarczak (DevExpress) 4 months ago

        Hi,

        Do you mind if we make this ticket public, so that we can include it in the list of fixed issues for the next release?

          Not at all. Go ahead and make it public; I’m always happy to help.

          Warmly,
          Carl Masters

          PW PW
          Przemyslaw Wlodarczak (DevExpress) 4 months ago

            Thank you!

            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.