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

Exceptions from CSharpDeclareAsNullableCodeFixProvider #44338

Closed
TessenR opened this issue May 18, 2020 · 0 comments · Fixed by #44604
Closed

Exceptions from CSharpDeclareAsNullableCodeFixProvider #44338

TessenR opened this issue May 18, 2020 · 0 comments · Fixed by #44604
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 May 18, 2020

Version Used:

Microsoft Visual Studio Professional 2019 Preview
Version 16.6.0 Preview 6.0
VisualStudio.16.Preview/16.6.0-pre.6.0+30105.148
Microsoft .NET Framework
Version 4.8.03752

Steps to Reproduce:

Place caret at null in the following code:

using System.Threading;

#nullable enable
class C
{
  void M1()
  {
    string _path = "";
    var path = Interlocked.Exchange(ref _path, null);
  }
}

Expected Behavior:
No exceptions

Actual Behavior:
image

System.IndexOutOfRangeException : Index was outside the bounds of the array.
   at Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider.<TryGetDeclarationTypeToFix>g__TryGetParameterTypeSyntax|13_2(IParameterSymbol parameterSymbol)
   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)
@sharwell sharwell 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 May 18, 2020
@sharwell sharwell added this to the 16.7 milestone May 18, 2020
@jinujoseph jinujoseph modified the milestones: 16.7, Backlog Jun 19, 2020
@sharwell sharwell modified the milestones: Backlog, Next Jun 23, 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 Jun 23, 2020
@dibarbet dibarbet modified the milestones: Next, 16.7.P4 Jun 30, 2020
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.

4 participants