When run, the following code silently throws an exception at the line:
let chartControl = new ChartControl(chart),
despite ostensibly running just fine. The message in the output window is:
"A first chance exception of type 'System.InvalidOperationException' occurred in FSharp.Core.dll"
open System
open System.Drawing
open System.Reactive.Linq
open System.Threading
open System.Windows.Forms
open FSharp.Charting
open FSharp.Charting.ChartTypes
// Learn more about F# at http://fsharp.net
// See the 'F# Tutorial' project for more help.
[<EntryPoint>]
let main argv =
printfn "%A" argv
let form = new Form()
form.Size <- new Size(800, 600)
let step =
let gen = new Random()
(fun () -> 2.0 * (gen.NextDouble() - 0.5))
let randomWalk =
Observable
.Interval(TimeSpan.FromMilliseconds 200.0)
.ObserveOn SynchronizationContext.Current
|> Observable.scan (fun (x, y) _ -> (x + 1.0, y + step())) (0.0, 0.0)
let chart = LiveChart.FastLineIncremental randomWalk
let chartControl = new ChartControl(chart)
chartControl.Dock <- DockStyle.Fill
form.Controls.Add chartControl
Application.Run(form)
0 // return an integer exit code
When run, the following code silently throws an exception at the line:
despite ostensibly running just fine. The message in the output window is: "A first chance exception of type 'System.InvalidOperationException' occurred in FSharp.Core.dll"
Am I doing something that I shouldn't be doing?