Author Topic: "Index and length must refer to a location within the string" error  (Read 187 times)

Admin Gary

  • Developer and Owner of Suisoft
  • Administrator
  • Full Member
  • *****
  • Posts: 147
    • View Profile
    • Suisoft Website
Symptoms:

The following error occurs when saving a view and subsequently opening the tab for the table.

    Index and length must refer to a location within the string.
    Parameter name: length


Cause / Steps to Reproduce:

An invalid view is causing the program to break when the 'Subset' buttons are being created on the record list screen. These are the bottom left buttons on the records list (e.g. for Kits and Accessories they are 'Wanted', 'Owned' etc).

KitBase shouldn't have allowed this when you saved the view. A fix is planned in the next release.


The sequence of steps that cause the issue are as follows:

1) Adding or Customising a View

2) Setting the first part of 'Subset' to a field (bottom right of the View Designer screen)

3) Leaving the second part of 'Subset' (after =) empty


Normally both parts would be filled in, so that the 'Subset' buttons restrict the list (e.g. 'Status = Owned' on Kits and Accessories).

If you avoid using the 'Subset' options in the way described above (first box filled, second box empty) you shouldn't encounter the problem.


Workaround:

The invalid view needs to be renamed or removed.


*** PLEASE MAKE A BACKUP BEFORE ATTEMPTING THE FIX BELOW ***


1 - Start KitBase and open your database

2 - Go into 'File / Show Database in Explorer'

3 - Go into the 'Views' folder

   Views are prefixed with the Table Id. The standard table Id's in KitBase are:

   Kits and Accessories: d7ea2724-ecca-4acb-86f4-5e16f210a1d3
   References: 610306e1-3251-49dd-b4cf-20d80c87102f
   Paint Stock:f4d2905c-1ae4-4d80-8403-c85495060c63

5 - Switch to 'Details' view in Explorer and sort by 'Date Modified' Descending (indicator arrow down)

6 - Look for the most recently changed view, prefixed with the table Id from the list above

7 - Rename the view, e.g. place an _ (underscore) in front

8 - Try closing the table tab in KitBase and re-open via the link on 'Database Home'

9 - If the tab opens without error, you have found the problematic view. You can leave it renamed or delete it.
     If not, repeat the rename of each view until the tab opens successfully

10 - Any views that you renamed without fixing the problem can be changed back


Status:

Permanent fix underway. To be released in v2.0.7.0, hopefully during late August / early September (2017).
« Last Edit: August 08, 2017, 03:23:50 AM by Admin Gary »