Skip to content

TwoStepDeviceBuilder Init exception #8

@glamour59

Description

@glamour59

Hello
I ve got this exception "collection was modified; enumeration operation may not execute" during service initialisation.

It is thrown in Oddr.Builders.Devices.TwoStepDeviceBuilder.AfterOrderingCompleteInit after the first call of SortElement(step1Token);

foreach (String step1Token in orderedRules.Keys)
{
            SortElement(step1Token);
}

This exception was thrown because SortElement modifies orderedRules.Keys collection.

To solve the issue, I changed the code by :

String[] stringKeys = new String[orderedRules.Keys.Count];
orderedRules.Keys.CopyTo(stringKeys, 0);
foreach (String step1Token in stringKeys)
{ 
            SortElement(step1Token);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions