F# ImagePipeline throws IndexOutOfRangeException


Twice now when I’ve run the ImagePipeline sample I’ve had an IndexOutOfRangeException when I press the “stop” button. The exception is reraised but the stacktrace seems to indicate a problem here in BlockingMultiplexer.fs
                    let index = 
                       (producers |> Seq.filter (fun info -> info.Collection = waitList.[waitListIndex])
                                  |> Seq.map (fun info -> info.Index)).Single()
                    let lockId = lockOrderFn (!item)
Tomas, you might like to quickly review the translation from C#. Otherwise I guess it’s a bug in the original C# code.
Closed Sep 29, 2010 at 11:03 AM by AdeMiller
Fixed with changeset 54190.


AdeMiller wrote Sep 7, 2010 at 6:40 PM

Doesn't repro on C# version.

AdeMiller wrote Sep 7, 2010 at 9:46 PM

I believe this might be a bug in the port.

The C# code
                    if (waitList.Length == 0)
                        if (token.IsCancellationRequested)
                            yield break;
                            throw new InvalidOperationException("Producer blocking collections omitted required value " +
was ported into F# as
               if waitList.Length = 0 then
                   if token.IsCancellationRequested then 
                       yieldBreak := true
                       let msg = "Producer blocking collections omitted required value " + nextLockId.ToString()
                       raise (new InvalidOperationException(msg))
I think this is a bug because in F# you have allowed a loop to continue that should be terminated. (I think you need to add some kind of loop break or nonlocal exit to the F# so that you break out of the current iteration.)

AdeMiller wrote Sep 29, 2010 at 11:01 AM

The behavior I see is that the UI locks up.

wrote Sep 29, 2010 at 11:03 AM

wrote Feb 14, 2013 at 8:05 PM

wrote May 16, 2013 at 10:07 AM