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

Getting System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute.' #1

Open
prasannapad opened this issue Feb 26, 2019 · 0 comments

Comments

@prasannapad
Copy link

Get the following exception:
System.InvalidOperationException
HResult=0x80131509
Message=Collection was modified; enumeration operation may not execute.
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Collections.Generic.List1.Enumerator.MoveNext()
at SensiEdgeDemo.Domain.AccGyroMagViewModel.b__23_0() in C:\Users\prp\Documents\SensiBleWindows-master\SensiEdgeDemo\Domain\AccGyroMagViewModel.cs:line 95
at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
at System.Windows.Threading.DispatcherOperation.InvokeImpl()

here:

var z = new LineSeries() { Fill = Brushes.Transparent, Foreground = Brushes.Blue, PointGeometry = null, Values = new ChartValues() };
foreach (var kvp in Values)
{
switch (SelectedIndex)
{
case 0:
x.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Acc.X)));
y.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Acc.Y)));
z.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Acc.Z)));
break;
case 1:
x.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Gyro.X)));
y.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Gyro.Y)));
z.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Gyro.Z)));
break;
case 2:
x.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Mag.X)));
y.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Mag.Y)));
z.Values.Add(new ObservablePoint(kvp.Key, GetValue(kvp.Value.Mag.Z)));
break;
}
}

...\SensiEdgeDemo\Domain\AccGyroMagViewModel.cs

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

1 participant