Multiple for loops in builder causes crash
edgarfgp opened this issue · comments
Edgar Gonzalez commented
This is the same as edgarfgp/Fabulous.AST#31
[<Test>]
let ``Multiple for loops in builder causes crash`` () =
let view model =
Stack() {
Label($"Foo") // It also crashes only with the multiple for loops
Label($"bar") // It also crashes only with the multiple for loops
for i = 0 to 10 do
Label($"T{i}")
for i = 10 to 20 do
Label($"T{i}")
for i = 20 to 30 do
Label($"T{i}")
}
let init () = true
let update (_: unit) addColor = not addColor
let program = StatefulWidget.mkSimpleView init update view
let instance = Run.Instance program
instance.Start() |> ignore
()
System.ArgumentException : Source array was not long enough. Check the source index, length, and the array's lower bounds. (Parameter 'sourceArray')
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at Fabulous.StackAllocatedCollections.MutStackArray1.combineMut[v](T`1& a, T`1 b) in /Users/edgardev/Projects/Fabulous/src/Fabulous/Array.fs:line 480
at Fabulous.Tests.APISketchTests.Attributes.view@710-56TT.Invoke(a model) in /Users/edgardev/Projects/Fabulous/src/Fabulous.Tests/APISketchTests/APISketchTests.fs:line 718
at Fabulous.Tests.APISketchTests.TestUI_Widgets.Run.Instance`4.Start(arg arg) in /Users/edgardev/Projects/Fabulous/src/Fabulous.Tests/APISketchTests/TestUI.Widgets.fs:line 241
at Fabulous.Tests.APISketchTests.Attributes.Multiple for loops in builder causes crash() in /Users/edgardev/Projects/Fabulous/src/Fabulous.Tests/APISketchTests/APISketchTests.fs:line 728
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)