Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TwoStepDeviceBuilder Init exception #8

Open
glamour59 opened this issue Aug 22, 2019 · 1 comment
Open

TwoStepDeviceBuilder Init exception #8

glamour59 opened this issue Aug 22, 2019 · 1 comment

Comments

@glamour59
Copy link

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);
}
@keilw
Copy link
Member

keilw commented Aug 22, 2019

Thanks, would you be able to create a Pull Request for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants