moonsharp icon indicating copy to clipboard operation
moonsharp copied to clipboard

System.IndexOutOfRangeException randomly when calling Closure

Open raV720 opened this issue 7 years ago • 0 comments

Have you encountered such exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.

at MoonSharp.Interpreter.Execution.VM.Processor.Processing_Loop (System.Int32 instructionPtr) [0x004ed] in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Execution\VM\Processor\Processor_InstructionLoop.cs:201 at MoonSharp.Interpreter.Execution.VM.Processor.Call (MoonSharp.Interpreter.DynValue function, MoonSharp.Interpreter.DynValue[] args) [0x00075] in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Execution\VM\Processor\Processor.cs:67 at MoonSharp.Interpreter.Script.Call (MoonSharp.Interpreter.DynValue function, MoonSharp.Interpreter.DynValue[] args) [0x0009c] in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Script.cs:483 at MoonSharp.Interpreter.Script.Call (MoonSharp.Interpreter.DynValue function, System.Object[] args) [0x00023] in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Script.cs:502 at MoonSharp.Interpreter.Script.Call (System.Object function, System.Object[] args) [0x00000] in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\Script.cs:525 at MoonSharp.Interpreter.Closure.Call (MoonSharp.Interpreter.DynValue[] args) [0x00000] in Z:\git\my\moonsharp\src\MoonSharp.Interpreter\DataTypes\Closure.cs:102

The error occurs on this line: https://github.com/xanathar/moonsharp/blob/140e1367976fdfd3e460c549d980f54d9ed1bd31/src/MoonSharp.Interpreter/Execution/VM/Processor/Processor_InstructionLoop.cs#L201

I am calling this closure from another lua script using passed C# delegate. This error occurs once in a dozen or so and quite randomly, only on IOS platform (portable-net4+sl5+wp8+win8). The error occurs when creating table:

paramSql = {evtid = p_evtid, image = p_image, fileID2 = F.Guid(), fileSize = p_imageSize, evtcode = evtcodeP, datetime = F.Time()} When I set evtid = "" and image="" then error does not occur. The p_evtid is simple string and p_image is an array of bytes (photo data).

raV720 avatar Sep 26 '18 08:09 raV720