Exception handlers in observe computation expression cannot be compiled.
Repro steps
open System
open FSharp.Control.Reactive.Builders
let errorObservable () =
observe {
try
InvalidOperationException() |> raise
with
| :? InvalidOperationException ->
printfn "InvalidOperationException raised"
}
Expected behavior
It should be compiled.
Actual behavior
This runtime coercion or type test from type
'a
to
InvalidOperationException
involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed.
Known workarounds
ObservableBuilder has
member __.TryWith(m: IObservable<_>, h: #exn -> IObservable<_>) = Observable.Catch(m, h)
Description
Exception handlers in observe computation expression cannot be compiled.
Repro steps
Expected behavior
It should be compiled.
Actual behavior
Known workarounds
ObservableBuilder has
but it intended for
h: exn -> IObservable<_>
?