F# cross-thread UI exception in WinForms App

前端 未结 3 451
盖世英雄少女心
盖世英雄少女心 2021-01-21 09:55

I have a problem with developing a simple application in F#, which just reads the length of the requested HTML page.

Seems to be that such an error would be similar for

3条回答
  •  野性不改
    2021-01-21 10:23

    I had the same problem in that the Async.SwitchToContext did not switch to the Main Gui thread. It was in fact switching to some other thread.

    In the end I found that the problem was how I got the uiContext in the first place. Using the following worked:

    let uiContext = System.Threading.SynchronizationContext.Current
    

    But it didnt work with:

    let uiContext = System.Threading.SynchronizationContext()
    

提交回复
热议问题