C# Component "Index out of Range" Line 0

Hi, I am trying to calculate the Column Spans for layout of Floor Planks. Although all the numbers and syntax are all correct. The component throws the error “INDEX OUT OF RANGE”(LINE: 0)

Its a bit difficult to find the error and fix it , if the component throws error @ line:0.
Anybody knows what could be the problem, here is the GH file.
FPOffsets.gh (6.2 KB)


Use try and catch statement to know which line is failing or debug line by line

Thanks @Petras_Vestartas. I’ll Give it a try.

I’ve not looked closely at your code but this error usually comes when you are counting your loops wrong and either have not enough loops for your data or too many counts than the amount of loops (meaning you are calling an index that does not exist aka index out of range). Double check your lines where you call colIndex or doing .counts.

Some strange things in this code.
You are adding to a temp list from outside an if statement that only exists inside the if statement.

you are adding to these lists outside of the foreach loop.

In this line you are adding a list to another list which would be .AddRange()

Actually I realized it is a List List (matrix) in which case arrays will be easier.

I could help more but it is not exactly clear to me what the results should be.