We are encountering an extremely odd issue. We process incoming files for
customers and output text files to produce printed material. Then an XML
file
containing the fields of the original file along with all fields necessary
to
produce the output text files are saved as an XML file. If an individual's
printed material is destroyed in the process of fulfillment, we must
reproduce the output for them. We do this by reading the XML file back into
a
dataset and re-outputting the text files. The XML file (and hence the
datatable in the dataset) have a LOT of fields/columns (some have over
1000).

We discovered that if a column is added to the datatable at the end of the
columns collection, AND is later referred to in a SELECT clause to return a
row collection, AND then large amounts of columns are removed and then added
back into the columns collection, the following error is thrown:

System.IndexOutOfRangeException - Index was outside the bounds of the array.

We also discovered that if we added the column referred to in the SELECT
clause at the BEGINNING of the columns collection (which was not easy) the
error did NOT occur. However, this is simply side-stepping the bigger issue.

I have sample code that will duplicate this behavior, but that and the XML
is too long to post. Is there some way to post this code and XML?

This is running on .NET 1.1 framework. Any light that could be shed on this
issue would be greatly appreciated.

Thank you.

RE: IndexOutOfRangeException - Index was outside the bounds of the array. by lukezhan

lukezhan
Sun Apr 02 22:05:44 CDT 2006

Hello,

I downloaded your code and run it on my computer. But I failed to reproduce
the problem, the program runs smoothly withtout the exception after I click
the the button. Did I missed something? Have you tried the same code on
more computer?

Regards,

Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Re: IndexOutOfRangeException - Index was outside the bounds of the array. by v-kevy

v-kevy
Tue Apr 04 04:31:33 CDT 2006

Hi Doug,

This seems to be a known issue in .NET framework. Please try to contact
Microsoft PSS for a workaround. You can reach them with the following
contact info.

http://support.microsoft.com/default.aspx?scid=fh;EN-US;OfferProPhone

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Re: IndexOutOfRangeException - Index was outside the bounds of the array. by Doug

Doug
Tue Apr 04 09:09:29 CDT 2006

I will try that. Thank you very much!

"Kevin Yu [MSFT]" <v-kevy@online.microsoft.com> wrote in message
news:FjvdXq8VGHA.5520@TK2MSFTNGXA01.phx.gbl...
> Hi Doug,
>
> This seems to be a known issue in .NET framework. Please try to contact
> Microsoft PSS for a workaround. You can reach them with the following
> contact info.
>
> http://support.microsoft.com/default.aspx?scid=fh;EN-US;OfferProPhone
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>



Re: IndexOutOfRangeException - Index was outside the bounds of the array. by Doug

Doug
Tue Apr 04 12:06:42 CDT 2006

Hello,

I was instructed by Microsoft to invoke the AcceptChanges method on the
datatable after adding/removing columns. This has corrected the issue.

Thanks!
Doug

"Doug McCormick" <dmccormick@nospam.nospam> wrote in message
news:eeWRmF$VGHA.4416@TK2MSFTNGP15.phx.gbl...
>I will try that. Thank you very much!
>
> "Kevin Yu [MSFT]" <v-kevy@online.microsoft.com> wrote in message
> news:FjvdXq8VGHA.5520@TK2MSFTNGXA01.phx.gbl...
>> Hi Doug,
>>
>> This seems to be a known issue in .NET framework. Please try to contact
>> Microsoft PSS for a workaround. You can reach them with the following
>> contact info.
>>
>> http://support.microsoft.com/default.aspx?scid=fh;EN-US;OfferProPhone
>>
>> Kevin Yu
>> =======
>> "This posting is provided "AS IS" with no warranties, and confers no
>> rights."
>>
>
>



Re: IndexOutOfRangeException - Index was outside the bounds of the array. by v-kevy

v-kevy
Tue Apr 04 22:29:52 CDT 2006

Hi Doug,

It was nice to hear that you have had the problem resolved. Thanks for
sharing your experience with all the people here. If you have any
questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."