SSRS Error – Index was out of range. Must be non-negative and less than the size of the collection.
I got a new SSRS error I’ve never seen before today. Looking around this isn’t specific to Visual Studio 2015, so could solve anyone’s issue using older versions.
After changing a reports dataset when you preview you get the error:
An error occurred during local report processing. An error occurred during rendering of the report. An error occurred during the rendering of the report. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
which looks like below:
This is apparently caused by the data file being corrupt, or getting confused. The solution is to simply delete the .data file. This is found within your solution and will be named the same as your report with .data at the end. for my the problem was with a report called “01 – Database Health Check”. So i deleted the highlighted file.
You can then try and preview the report again and it will work.