From 9fd4981131dd9d792b2d8722505deb588232ca9d Mon Sep 17 00:00:00 2001 From: BoundedChenn31 Date: Tue, 26 Nov 2024 03:04:50 +0300 Subject: [PATCH 1/2] Add null annotation to Async.SwitchToContext --- src/FSharp.Core/async.fs | 4 ---- src/FSharp.Core/async.fsi | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/FSharp.Core/async.fs b/src/FSharp.Core/async.fs index 1c5138b93dc..959d47d0aab 100644 --- a/src/FSharp.Core/async.fs +++ b/src/FSharp.Core/async.fs @@ -868,11 +868,7 @@ module AsyncPrimitives = /// - Initial cancellation check /// - Call syncCtxt.Post with exception protection. This may fail as it is arbitrary user code -#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT let CreateSwitchToAsync (syncCtxt: SynchronizationContext) = -#else - let CreateSwitchToAsync (syncCtxt: SynchronizationContext | null) = -#endif MakeAsyncWithCancelCheck(fun ctxt -> ctxt.PostWithTrampoline syncCtxt ctxt.cont) /// - Initial cancellation check diff --git a/src/FSharp.Core/async.fsi b/src/FSharp.Core/async.fsi index 1cd02f9694b..e01ba0d8d75 100644 --- a/src/FSharp.Core/async.fsi +++ b/src/FSharp.Core/async.fsi @@ -647,7 +647,7 @@ namespace Microsoft.FSharp.Control /// Threads and Contexts /// /// - static member SwitchToContext : syncContext:System.Threading.SynchronizationContext -> Async + static member SwitchToContext : syncContext:(System.Threading.SynchronizationContext | null) -> Async /// Creates an asynchronous computation that captures the current /// success, exception and cancellation continuations. The callback must From 2273e94427d21f59daf2accc335bd3d282955b0c Mon Sep 17 00:00:00 2001 From: Petr Date: Wed, 27 Nov 2024 12:24:48 +0100 Subject: [PATCH 2/2] release notes --- docs/release-notes/.FSharp.Core/9.0.200.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Core/9.0.200.md b/docs/release-notes/.FSharp.Core/9.0.200.md index 2ea077abe4b..fdcc65f5537 100644 --- a/docs/release-notes/.FSharp.Core/9.0.200.md +++ b/docs/release-notes/.FSharp.Core/9.0.200.md @@ -1,6 +1,7 @@ ### Fixed * Fix exception on Post after MailboxProcessor was disposed ([Issue #17849](https://github.com/dotnet/fsharp/issues/17849), [PR #17922](https://github.com/dotnet/fsharp/pull/17922)) +* Fix missing null annotation in Async.SwitchToContext ([Issue #18055](https://github.com/dotnet/fsharp/issues/18055), [PR #18059](https://github.com/dotnet/fsharp/pull/18059)) ### Added