Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'CSharpDeclareAsNullableCodeFixProvider' encountered an error and has been disabled #46354

Closed
TessenR opened this issue Jul 27, 2020 · 1 comment · Fixed by #46437
Closed
Assignees
Labels
Area-IDE Bug IDE-CodeStyle Built-in analyzers, fixes, and refactorings Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@TessenR
Copy link

TessenR commented Jul 27, 2020

Version Used:

Microsoft Visual Studio Professional 2019 Preview
Version 16.7.0 Preview 5.0
VisualStudio.16.Preview/16.7.0-pre.5.0+30317.65
Microsoft .NET Framework
Version 4.8.03752

Steps to Reproduce:

Paste the following code in VS, expand the bulb while caret is on null in t.Item1 = null;

#nullable enable
class Program
{
  static void F1<T>((T, T?) t) where T : class
  {
    if (t.Item2 == null) return;
    t.Item1 = null;
    
    var (a, b) = t;
  }
}

Expected Behavior:
No exceptions I guess

Actual Behavior:

System.IndexOutOfRangeException : Index was outside the bounds of the array.
   at Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider.TryGetDeclarationTypeToFix(SemanticModel model,SyntaxNode node)
   at async Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider.RegisterCodeFixesAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.CodeFixService.GetCodeFixesAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
@jinujoseph jinujoseph added Area-IDE Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-CodeStyle Built-in analyzers, fixes, and refactorings labels Jul 28, 2020
@jinujoseph jinujoseph added this to the 16.8 milestone Jul 28, 2020
@sharwell sharwell added Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented and removed help wanted The issue is "up for grabs" - add a comment if you are interested in working on it labels Jul 30, 2020
@sharwell sharwell modified the milestones: 16.8, Next Jul 30, 2020
@RikkiGibson RikkiGibson modified the milestones: Next, 16.8.P2 Aug 11, 2020
@nstepanets
Copy link

nstepanets commented Oct 5, 2022

I am having a similar problem on Microsoft Visual Studio Community 2022 (64-bit), Version 17.3.5
Target framework: .NET 6.0
System.IndexOutOfRangeException : Index was outside the bounds of the array. at Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider.TryGetDeclarationTypeToFix(SemanticModel model,SyntaxNode node) at async Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider.RegisterCodeFixesAsync(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.CodeAnalysis.CodeFixes.CodeFixService.GetCodeFixesAsync(<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug IDE-CodeStyle Built-in analyzers, fixes, and refactorings Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants