This is a migrated thread and some comments may be shown as answers.

Collection was modified; enumeration may not execute

2 Answers 257 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Marko asked on 26 Jan 2009, 06:32 PM
Hi, I'm using rad upload to read in 2 files, and I'm using RadProgressManager to inform the user of the progress.  First I'm reading in one file which contains records to add to a database, and I'm updating the progress manager through each iteration.  When the first file is complete, the 2nd file is processed and I do the same thing, update the progress manager through each iteration.  The files are 1MB and 2MB, and the entire operation takes maybe 2 minutes.  The progress manager seems to work just fine throughout most of the process, but when the 2nd file is being processed, I end up getting the following error (it doesn't happen at the same exact time each time it happens):
adUpload Ajax callback error. Source url returned invalid content: 
var rawProgressData = {InProgress:true,ProgressCounters:true,CurrentOperationText:'StudentsExcp_200812.txt'
System.InvalidOperationException: Collection was modified; enumeration operation may not execute. 
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) 
   at System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator.MoveNext() 
   at Telerik.Web.UI.Upload.ProgressData.Serialize(TextWriter writer) 
   at Telerik.Web.UI.RadProgressContext.Serialize(TextWriter writer) 
   at Telerik.Web.UI.RadUploadProgressHandler.ProcessRequest(HttpContext context) 
Did you register the RadUploadProgressHandler in web.config? 
Please, see the help for more details: RadUpload for ASP.NET Ajax - Configuration - RadUploadProgressHandler. 

When I run it locally on my machine, I don't get this error, I only get it when I put it on our testing server.  On my machine I'm using Visual Studio 2008, Windows Vista, IIS 7.0.6000.  My test server, is running on Windows Server 2003 R2, with IIS 6.

As far as the progress manager goes, I my code is pretty much the same as the example on the site.  Declared the progress manager in the aspx page:
<telerik:RadProgressManager ID="rpmStudentProgress" runat="server" /> 
    <telerik:RadProgressArea ID="rpaStudentProgress" runat="server"  
        ProgressIndicators="FilesCountBar, FilesCount, FilesCountPercent, SelectedFilesCount, CurrentFileName, TimeElapsed"  
        <Localization Uploaded="Uploaded"></Localization> 

In the Page_Load function of the code behind I set the text for Localization.UploadedFiles, Localization.TotalFiles, and Localization.CurrentFileName.  In the upload function, I show the progress manager:
RadProgressContext context = RadProgressContext.Current; 
context.CurrentOperationText = file.GetName(); 
context.SecondaryTotal = arrStudents.Count + " students"; 

Then in my for loop I update the values:
context.SecondaryValue = (i + 1).ToString(); 
context.SecondaryPercent = Convert.ToInt32((i * 1.0 / arrStudents.Count) * 100); 

In the same function, when the first file is finished, I update the progress monitor text:
context.CurrentOperationText = exceptFile.GetName(); 
context.SecondaryTotal = arrExcept.Count + " exceptionalities"; 

Then in my next for loop I update the values like in the first for loop:
context.SecondaryValue = (j + 1).ToString(); 
context.SecondaryPercent = Convert.ToInt32((j * 1.0 / arrExcept.Count) * 100); 

I have Telerik in specified in the httpHandlers section of my config file:
<add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.2.1001.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/> 
<add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler, Telerik.Web.UI"/> 

Does anyone have any idea what could be causing the error I'm getting?  I tried to provide as much info as possible.  Any suggestions are appreciated.


2 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 19 Feb 2009, 10:26 PM
Hey Marko - did you find any solution to this?

I've just started getting exactly the same error, when I use files over a certain size.
My processing situation is pretty much the same as yours.

Telerik, any ideas?
Top achievements
Rank 1
answered on 19 Feb 2009, 10:38 PM
Update: turns out it is a bug in the telerik controls, fixe din Q3 2008:
Upload (Obsolete)
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Share this question