C # UWP Windows 10

There is such code:

private ObservableCollection<GroupInfoList> GroupedTags = new ObservableCollection<GroupInfoList>(); private void Refresh() { GroupedTags.Clear(); foreach (var x in GetGroupedTags()) GroupedTags.Add(x); } 

When any attempt to add or remove an item of a collection, the application crashes, the VisualStudio debugger does not show anything, the catch does not work. One time an error appeared: something like "... most likely indicates that the memory is damaged."

I tried to run the application on 2 computers and a phone - the result is the same everywhere.

Moreover, if you perform the operation = then all the rules, it falls on the lines:

  • GroupedTags.Add(x);
  • GroupedTags.Remove(x);
  • If errors are about corrupted memory - the problem is not here. Do you have a native code or P / Invoke in the project? - VladD
  • @VladD no. And on the other form, the same method, with the same list (but with a different class) works fine - SYL
  • Well, it doesn’t mean anything, if the memory is really damaged, then the problem can appear at any point, no matter how correct the code at that point is. - VladD

0