@@ -167,6 +167,7 @@ module internal Reactor =
167167 System.Threading.Thread.CurrentThread.CurrentUICulture <- culture
168168
169169 let newState =
170+ try
170171 match msg with
171172 | StartBackgroundOp build ->
172173 Debug.WriteLine( " Reactor: --> start background, remaining {0}, mem {1}, gc2 {2}" , inbox.CurrentQueueLength, GC.GetTotalMemory( false )/ 1000000 L, GC.CollectionCount( 2 ))
@@ -194,6 +195,9 @@ module internal Reactor =
194195 | FinishBackgroundOp channel ->
195196 Debug.WriteLine( " Reactor: --> finish background, remaining {0}, mem {1}, gc2 {2}" , inbox.CurrentQueueLength, GC.GetTotalMemory( false )/ 1000000 L, GC.CollectionCount( 2 ))
196197 HandleFinishBackgroundO inbox channel state
198+ with e ->
199+ Debug.Assert( false , " unexpected failure in reactor loop" )
200+ state
197201
198202 return ! loop newState
199203 }
@@ -235,14 +239,14 @@ module internal Reactor =
235239 let! ct = Async.CancellationToken
236240 let resultCell = AsyncUtil.AsyncResultCell<_>()
237241 r.EnqueueOpPrim( desc, ct,
238- ( fun () ->
242+ op = (fun () ->
239243 let result =
240244 try
241245 f ct |> AsyncUtil.AsyncOk
242246 with
243247 | e -> e |> AsyncUtil.AsyncException
244248 resultCell.RegisterResult( result)),
245- ( fun () -> resultCell.RegisterResult ( AsyncUtil.AsyncCanceled( OperationCanceledException())) )
249+ ccont = (fun () -> resultCell.RegisterResult ( AsyncUtil.AsyncCanceled( OperationCanceledException())) )
246250
247251 )
248252 return ! resultCell.AsyncResult
0 commit comments