Use RunImmediate for better debug stacks#11788
Conversation
|
@TIHan THis is ready |
TIHan
left a comment
There was a problem hiding this comment.
Looks good, this should help our stacks a little bit, especially in testing.
Only comment I have is that we have duplicate RunImmediate implementations; shouldn't we just have one?
I think maybe two will be ok, one for compiler internals and one for all of testing.
| module Utilities = | ||
|
|
||
| type Async with | ||
| static member RunImmediate (computation: Async<'T>, ?cancellationToken ) = |
There was a problem hiding this comment.
Shall we consolidate this one with the default one?
There was a problem hiding this comment.
The default one is not public (not added to FSharp.Core)
I'm sure there was a way to consolidate these a bit - however I couldn't find it immediately. We have one internal in the FSharp.Compiler.Service.dll and one in each test suite. TBH the easiest way to consoldiate is probably to add this method to FSharp.Core |
* Use RunImmediate for better debug stacks * fix build Co-authored-by: Don Syme <[email protected]>
Addresses internal engineering issue #11754
Async.RunSynchronously starts the async on a thread pool thread. There is a suggestion to add Async.RunImmediate that never does this. fsharp/fslang-suggestions#1042. This can be defined in terms of
Async.StartWithContinuations(which should really be calledAsync.StartImmediateWithContinuations)This defines and uses Async.RunImmediate internally in our compiler/service implementation and testing since it gives much better synchronous stacks.