FSharpAux icon indicating copy to clipboard operation
FSharpAux copied to clipboard

Inproper exception when `JaggedArray`/`JaggedList.transpose` is used on arrays/lists with different lengths

Open omaus opened this issue 1 year ago • 0 comments

Description

When calling JaggedArray.transpose or JaggedList.transpose on arrays resp. lists with differently long arrays/lists inside, an exception is thrown. But this exception does not help detect the problem in a, say, long pipeline.

Repro steps

  1. Run this exemplary code snippet:
JaggedList.transpose [[1;2;3]; [4;5]]
JaggedArray.transpose [|[|1;2;3|]; [|4;5|]|]
  1. See errors.

Expected behavior

Throws an exception that tells the user that array/list elements are varying in length.

Actual behavior

Throws following exceptions: System.ArgumentException: The input list was empty. (Parameter 'list'), resp. System.IndexOutOfRangeException: Index was outside the bounds of the array..

omaus avatar Apr 08 '23 18:04 omaus