Collection was modified; enumeration operation may not execute.

Collection was modified; enumeration operation may not execute.

Postby scotth » Mon 30 Jul 2012 12:28

I am running into an error with dotConnect when I submit changes after inserting a new record in the database for a specific table. This insertion might be the only change the occurs when the error happens. The error is not always consistent. The context and updates/inserts are all ran on a background thread in an ASP.NET website.

The following is the error stack trace:

System.InvalidOperationException: {"Collection was modified; enumeration operation may not execute."}

at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Devart.Data.Linq.Engine.b2.a()
at Devart.Data.Linq.Engine.a5.b.d()
at Devart.Data.Linq.Engine.as.a(ConflictMode A_0)
at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at Devart.Data.Linq.DataContext.SubmitChanges()
at CloneTracking.BLL.PlateModels.CopyContentFromSourceWell(Well sourceWell, Well targetWell, SourceTarget sourceTarget, Dictionary`2 solutionSolutionDic) in C:\dev\CloneTracking\trunk\Apps\CloneTracking.BLL\PlateModels.cs:line 303
at CloneTracking.BLL.LogDataProcessManager.ProcessLogData() in C:\dev\CloneTracking\trunk\Apps\CloneTracking.BLL\LogDataProcessManager.cs:line 594

The table in question looks like the following:

<Table Name="CTR.CLONE_SOLUTION" Member="CloneSolutions">
<Type Name="CloneSolution" ed:Guid="83f7cf86-883f-4d80-9236-9274ff7ee252">
<Column Name="SOLUTION_ID" Member="SolutionId" Type="System.Int32" AutoSync="OnInsert" DbType="NUMBER NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" ed:ValidateRequired="True" ed:Guid="25a1320a-0fef-44bb-8eb1-fa3496ff3eac" />
<Column Name="SAMPLE_ID" Member="SampleId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="d901ebd3-0459-48b4-abb4-4085d7e40c7a" />
<Column Name="WELL_ID" Member="WellId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="21b232d3-63b3-488b-abd1-a1d0afbb4281" />
<Column Name="CONCENTRATION" Member="Concentration" Type="System.Decimal" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="959c8fd0-8c49-484b-a35a-d874e65f7ad5" />
<Column Name="VOLUME" Member="Volume" Type="System.Decimal" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="e6d23717-04a3-4b74-a39f-08f4bb827a82" />
<Column Name="YIELD" Member="Yield" Type="System.Decimal" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="8e51fcc2-ed79-4078-a419-775a274a0b6f" />
<Column Name="CONC_UNIT_ID" Member="ConcUnitId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="c6d24b37-21bd-4d60-9c46-da478464fefc" />
<Column Name="VOLUME_UNIT_ID" Member="VolumeUnitId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="1feb197f-d629-4bdf-84c7-0379fe7a6294" />
<Column Name="YIELD_UNIT_ID" Member="YieldUnitId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="ad4c07c6-0d90-4cee-8642-9f38e2f04f6c" />
<Column Name="ROLE_ID" Member="RoleId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="7aa9d6cc-236c-48f6-af5e-4e864f11a5a4" />
<Column Name="TYPE_ID" Member="TypeId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="26660868-7346-45ab-aae8-88425a29f4dd" />
<Column Name="OD260_280" Member="Od260280" Type="System.Decimal" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="62113dac-df39-4713-8fc7-28255f84cdba" />
<Column Name="DATE_CREATED" Member="DateCreated" Type="System.DateTime" DbType="DATE NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="75187e48-85b8-4b71-be70-d3f1fe0240a8" />
<Column Name="CREATED_BY_ID" Member="CreatedById" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="33ffa3a0-8571-4254-8677-19f30fea51a3" />
<Column Name="DATE_MODIFIED" Member="DateModified" Type="System.DateTime" DbType="DATE NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="5fd51555-9f3d-4918-8cc3-9ec51778b723" />
<Column Name="MODIFIED_BY_ID" Member="ModifiedById" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="4a784776-7390-45ff-8780-b0ecc7f4cc5f" />
<Column Name="IS_AVAILABLE" Member="IsAvailable" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="eac484c6-2bbf-4311-bf8c-8a7176b50daf" />
<Column Name="IS_AVAILABLE_COMMENT" Member="IsAvailableComment" Type="System.String" DbType="VARCHAR2(500) NULL" CanBeNull="true" MaxLength="500" ed:ValidateRequired="True" ed:Guid="34c4f48b-b362-472a-8fb8-8a823cfdef03" />
<Column Name="IS_RECOMMENDED" Member="IsRecommended" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="7e96f18e-07f6-49ab-8211-26a742706d59" />
<Column Name="IS_RECOMMENDED_COMMENT" Member="IsRecommendedComment" Type="System.String" DbType="VARCHAR2(500) NULL" CanBeNull="true" MaxLength="500" ed:ValidateRequired="True" ed:Guid="374be0a0-a7e4-48da-92d6-9e317ecb2799" />
<Column Name="SMF_NAME" Member="SmfName" Type="System.String" DbType="VARCHAR2(250) NULL" CanBeNull="true" MaxLength="250" ed:ValidateRequired="True" ed:Guid="1c8bf7a8-7e85-464e-9d4f-edd0d2a89fe0" />
<Column Name="OD260" Member="Od260" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="93c095b1-b082-4bbf-8e80-f74708d8cc90" />
<Column Name="SAMPLE_WF_STATUS_ID" Member="SampleWfStatusId" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="3949d97e-0b5f-4c08-9d4b-b75ed23a2b4a" />
<Column Name="SAMPLE_WF_STATUS_DATE" Member="SampleWfStatusDate" Type="System.DateTime" DbType="DATE NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="511e0ece-8d66-4922-8265-ff94bf740576" />
<Column Name="SAMPLE_WF_STATUS_BY_ID" Member="SampleWfStatusById" Type="System.Decimal" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="26b32152-249a-475d-a630-f9c5fca8be6b" />
<Column Name="IS_VOLUME_ACCURATE" Member="IsVolumeAccurate" Type="System.Int32" DbType="NUMBER NULL" CanBeNull="true" ed:ValidateRequired="True" ed:Guid="f9aeb20c-33a5-4194-a043-7cfa06f48c36" />
<Association Name="Well_CloneSolution" ed:AssociationGuid="c19a130e-4d51-442c-b3de-8e3243802d62" Member="Well" ed:Guid="05b42544-378d-46cb-a1d2-abc65df736cb" ThisKey="WellId" OtherKey="WellId" Type="Well" IsForeignKey="true" />
<Association Name="Unit_CloneSolution" ed:AssociationGuid="a68a7bf5-9166-4f5c-bd26-2cece3215f3c" Member="Unit_YieldUnitId" ed:Guid="921c75c0-db05-4c03-a41a-241bbdf74af5" ThisKey="YieldUnitId" OtherKey="UnitId" Type="Unit" IsForeignKey="true" />
<Association Name="Unit_CloneSolution1" ed:AssociationGuid="a6b65b4f-f72b-4349-83cc-e3de3a8cacb4" Member="Unit_VolumeUnitId" ed:Guid="ed0a68c7-1ecd-45e5-abc8-86bc3a9c4313" ThisKey="VolumeUnitId" OtherKey="UnitId" Type="Unit" IsForeignKey="true" />
<Association Name="Unit_CloneSolution2" ed:AssociationGuid="bc79b645-1272-41e6-a27b-0592138dfbe5" Member="Unit_ConcUnitId" ed:Guid="908fa92a-d8fc-49a2-86e7-771ecc8ae017" ThisKey="ConcUnitId" OtherKey="UnitId" Type="Unit" IsForeignKey="true" />
<Association Name="SolutionType_CloneSolution" ed:AssociationGuid="2cb47182-7465-44c7-829b-d1719bde8af2" Member="SolutionType" ed:Guid="935ac2c1-5a89-439c-b0bc-9f38831e2caf" ThisKey="TypeId" OtherKey="SolutionTypeId" Type="SolutionType" IsForeignKey="true" />
<Association Name="SolutionRole_CloneSolution" ed:AssociationGuid="6e088e39-0fdf-45e0-a1ef-1bd896476f27" Member="SolutionRole" ed:Guid="d1c6eb0e-38a5-434c-b243-66061090c9b7" ThisKey="RoleId" OtherKey="SolutionRoleId" Type="SolutionRole" IsForeignKey="true" />
<Association Name="CloneSolution_SeqQcSolutionConclusion" ed:AssociationGuid="1febfdbc-32e7-4dc2-8b64-688f64cbb48f" Member="SeqQcSolutionConclusions" ed:Guid="b1aa9344-1595-4be7-9173-ecd8c25c2c24" ThisKey="SolutionId" OtherKey="SolutionId" Type="SeqQcSolutionConclusion" />
<Association Name="CloneSolution_SeqQcAttempt" ed:AssociationGuid="dadecdb6-11ae-4abe-ac6f-91df850d25a6" Member="SeqQcAttempts" ed:Guid="66332329-1a74-4b1f-b7b0-cec4aba5c5d4" ThisKey="SolutionId" OtherKey="SolutionId" Type="SeqQcAttempt" />
<Association Name="SampleWorkflowStatus_CloneSolution" ed:AssociationGuid="d84fe2e8-2a38-4bab-9fde-a46e77fb32a9" Member="SampleWorkflowStatus" ed:Guid="5d2f9c8a-5898-47c6-899c-b5b9e94e5eb3" ThisKey="SampleWfStatusId" OtherKey="SampleWfStatusId" Type="SampleWorkflowStatus" IsForeignKey="true" />
<Association Name="CtsUser_CloneSolution" ed:AssociationGuid="a8589ffe-7d82-4aa2-98af-4afacaee0db7" Member="CtsUser_ModifiedById" ed:Guid="aa1255bf-bbeb-4f0f-9c43-44ba4fb8ecfc" ThisKey="ModifiedById" OtherKey="CtsUserId" Type="CtsUser" IsForeignKey="true" />
<Association Name="CtsUser_CloneSolution1" ed:AssociationGuid="2f761389-0153-420e-95f4-f2b8b5c90f26" Member="CtsUser_CreatedById" ed:Guid="7d746ca2-67b4-497b-b2ec-4fd533df5c65" ThisKey="CreatedById" OtherKey="CtsUserId" Type="CtsUser" IsForeignKey="true" />
<Association Name="CloneSolution_AgarQcResult" ed:AssociationGuid="10280362-a917-46db-bdf5-50ce492ae098" Member="AgarQcResults" ed:Guid="e9a4f38b-1a5c-419b-b017-20bd41df57e0" ThisKey="SolutionId" OtherKey="SolutionId" Type="AgarQcResult" />
<Association Name="CloneSample_CloneSolution" ed:AssociationGuid="bb2dd6f1-f652-482e-8b51-adf1af10aa75" Member="CloneSample" ed:Guid="b9b9a590-7618-4d78-80c7-f50b1b578978" ThisKey="SampleId" OtherKey="SampleId" Type="CloneSample" IsForeignKey="true" />
<Association Name="CloneSolution_CloneSolution" ed:AssociationGuid="50153825-4515-4c12-9d9b-eb638be0980c" Member="CloneSolutions1" ed:Guid="ede2cd96-5305-40cd-8035-f1a3991b0b74" ThisKey="SolutionId" OtherKey="SolutionId" Type="CloneSolution" LinkTableName="CTR.SOLUTION_SOLUTION" LinkThisKey="SOLUTION_ID" LinkOtherKey="PARENT_SOLUTION_ID" Cardinality="Many" />
<Association Name="CloneSolution_CloneSolution" ed:AssociationGuid="50153825-4515-4c12-9d9b-eb638be0980c" Member="CloneSolutions_SolutionId" ed:Guid="a402f2fe-3756-4a86-ad03-b332a8ec2e6e" ThisKey="SolutionId" OtherKey="SolutionId" Type="CloneSolution" LinkTableName="CTR.SOLUTION_SOLUTION" LinkThisKey="PARENT_SOLUTION_ID" LinkOtherKey="SOLUTION_ID" IsForeignKey="true" Cardinality="Many" />
</Type>
</Table>

It has a many to many self relationship, which is unique in our project so I am wondering if that's the cause of the error.

I haven't been able to isolate this issue down to a digestible amount of code so I have nothing specific to post right now, but I was wondering if anyone could provide any direction on what to look at for fixing this? The error occurred after updating to v7 of dotconnect for Oracle (currently on the last version also occurred in the prior version).

Any help would be appreciated even if it would help me isolate the issue so I could make a small recreate case. Thanks!
scotth
 
Posts: 1
Joined: Mon 30 Jul 2012 12:13

Re: Collection was modified; enumeration operation may not execute.

Postby MariiaI » Mon 30 Jul 2012 13:38

Thank you for the report. This is a known issue, and we have already made changes that should fix it. The corresponding build of dotConnect for Oracle will be available in about one week.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for Oracle