|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
IndexOutOfRangeException - Index was outside the bounds of the array.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. Sorry, I am new at posting to newsgroups. I figured out how to post the
code. I hope this works. Attached is a zip file containing my sample code and an XML file that it will read to duplicate this behavior. I stripped out all of our business layer logic and substituted a lot of hard-coding, so please do not be too critical of my code. If a watch is added to this statement on line 109: dsMatchedRecords.Tables("UnmatchedRecord").Select("PrintKitID='001'"), it will display a value of the number of rows matching this SELECT clause. HOWEVER, about halfway through the function removeOutputFileFields on line 114, it will suddenly change to: System.IndexOutOfRangeException - Index was outside the bounds of the array. This is running on .NET 1.1 framework. Any light that could be shed on this issue would be greatly appreciated. Thank you. Show quote "Doug McCormick" <dmccormick@nospam.nospam> wrote in message [attached file: Form2.zip]news:uT4O1ONVGHA.4436@TK2MSFTNGP10.phx.gbl... > 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. > > 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.) Hello,
Thank you for looking at this. It is necessary that the table be queried a SECOND time with a SELECT clause after the columns are added and removed in order for the error to be thrown. I was using a watch to capture the point in time when the error condition occurred, but the code itself was not actually reaching the point to throw the error. I have restructured my code so that it will do this and the error will be thrown. Attached is the new code. Thank you, Doug Show quote "Luke Zhang [MSFT]" <lukez***@online.microsoft.com> wrote in message [attached file: Form2.zip]news:dmFeFusVGHA.5540@TK2MSFTNGXA01.phx.gbl... > 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.) > 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." I will try that. Thank you very much!
Show quote "Kevin Yu [MSFT]" <v-k***@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." > 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 Show quote "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-k***@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." >> > > |
|||||||||||||||||||||||