Skip to content

Exception during type checking may lead to FCS host process crash #15905

@auduchinok

Description

@auduchinok

Consider the following console app project:

// A.fsi
module A

val f: int * bool *  -> unit // synax error in signature
// A.fs
module A

let f _ = ()
// Program.fs
printfn "Hello world"

Analyzing this project in an IDE hosting FCS will crash the IDE process. This happens because of multiple unrelated issues:

  • Parser recovery produces an incorrect tree, which makes the type checking throw an exception
  • This exception is caught but is thrown again inside DiagnosticsLoggerExtensions.ReraiseIfWatsonable during analysis recovery
  • The exception is caught and stored in Async created during BoundModel.tcInfo calculcation, and later crashes the whole process when results of this async are accessed

This is not specific to the parser recovery, and we've seen the process crashing with other exceptions happening during type checking phase. I'm going to open PRs for each of these issues.

Huge thanks to @ForNeVeR and @DedSec256 for helping in investigation of this issue!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions