Skip to content

NullReferenceException in GetDiagnosticFromMarker #1906

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

Closed
3 tasks done
dkattan opened this issue Aug 24, 2022 · 1 comment · Fixed by #1907
Closed
3 tasks done

NullReferenceException in GetDiagnosticFromMarker #1906

dkattan opened this issue Aug 24, 2022 · 1 comment · Fixed by #1907
Labels

Comments

@dkattan
Copy link
Contributor

dkattan commented Aug 24, 2022

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

I am experiencing an intermittent NullReferenceException in AnalysisService.cs

Severity = MapDiagnosticSeverity(scriptFileMarker.Level),

I don't know how to reproduce it, but it appears to be simple to fix.

Expected behavior

NullReferenceException should not happen

Actual behavior

NullReferenceException happens

Error details

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Microsoft.PowerShell.EditorServices
  StackTrace:
   at Microsoft.PowerShell.EditorServices.Services.AnalysisService.GetDiagnosticFromMarker(ScriptFileMarker scriptFileMarker) in C:\Users\DKattan.IN\source\repos\PowerShellEditorServices\src\PowerShellEditorServices\Services\Analysis\AnalysisService.cs:line 421
   at Microsoft.PowerShell.EditorServices.Services.AnalysisService.PublishScriptDiagnostics(ScriptFile scriptFile, IReadOnlyList`1 markers) in C:\Users\DKattan.IN\source\repos\PowerShellEditorServices\src\PowerShellEditorServices\Services\Analysis\AnalysisService.cs:line 401
   at Microsoft.PowerShell.EditorServices.Services.AnalysisService.PublishScriptDiagnostics(ScriptFile scriptFile) in C:\Users\DKattan.IN\source\repos\PowerShellEditorServices\src\PowerShellEditorServices\Services\Analysis\AnalysisService.cs:line 385
   at Microsoft.PowerShell.EditorServices.Services.AnalysisService.<DelayThenInvokeDiagnosticsAsync>d__28.MoveNext() in C:\Users\DKattan.IN\source\repos\PowerShellEditorServices\src\PowerShellEditorServices\Services\Analysis\AnalysisService.cs:line 381
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.PowerShell.EditorServices.Services.AnalysisService.<GetMostRecentCodeActionsForFileAsync>d__19.MoveNext() in C:\Users\DKattan.IN\source\repos\PowerShellEditorServices\src\PowerShellEditorServices\Services\Analysis\AnalysisService.cs:line 228

  This exception was originally thrown at this call stack:
    Microsoft.PowerShell.EditorServices.Services.AnalysisService.GetDiagnosticFromMarker(Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFileMarker) in AnalysisService.cs
    Microsoft.PowerShell.EditorServices.Services.AnalysisService.PublishScriptDiagnostics(Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFile, System.Collections.Generic.IReadOnlyList<Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFileMarker>) in AnalysisService.cs
    Microsoft.PowerShell.EditorServices.Services.AnalysisService.PublishScriptDiagnostics(Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFile) in AnalysisService.cs
    Microsoft.PowerShell.EditorServices.Services.AnalysisService.DelayThenInvokeDiagnosticsAsync(Microsoft.PowerShell.EditorServices.Services.TextDocument.ScriptFile[], System.Threading.CancellationToken) in AnalysisService.cs
    [External Code]
    Microsoft.PowerShell.EditorServices.Services.AnalysisService.GetMostRecentCodeActionsForFileAsync(OmniSharp.Extensions.LanguageServer.Protocol.DocumentUri) in AnalysisService.cs

Environment data

PowerShell 7.1.3 PSES 3.5.0

Version

3.5.0

Visuals

image

image

image

@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 24, 2022
@SydneyhSmith SydneyhSmith added Issue-Bug A bug to squash. Area-Script Analysis and removed Needs: Triage Maintainer attention needed! labels Aug 25, 2022
@andyleejordan
Copy link
Member

Ah, good find @dkattan. Don't have to time to get this into the next release, but triaged!

@andyleejordan andyleejordan moved this from Todo to In Progress in American Pharoah Aug 25, 2022
@andyleejordan andyleejordan changed the title NullReferenceException in GetDiagnosticFromMarker NullReferenceException in GetDiagnosticFromMarker Aug 25, 2022
Repository owner moved this from In Progress to Done in American Pharoah Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants