Błąd powodujący zresetowanie bazy nazw jednostek w najnowszej wersji - ważne!

Witam, dziś wywaliło crash i zresetowało wszystkie województwa, powiaty i jednostki. Więc trzeba namierzać od początku. Wiadomo co mogło być powodem?

08/13/2025 07:42:20 - Got Fatal exception
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
   at <U+202E>​‌​‏<U+202B><U+202D>​<U+202D><U+202B><U+202A><U+202D><U+202B>‎<U+202B><U+202D><U+202E><U+202B><U+202A><U+202B><U+202E>‎​<U+202A><U+202E>.get_Count()
   at System.Collections.ObjectModel.Collection`1.get_Count()
   at System.Windows.Forms.CurrencyManager.get_Count()
   at System.Windows.Forms.DataGridViewCell.GetValue(Int32 rowIndex)
   at System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex, Size constraintSize)
   at System.Windows.Forms.DataGridViewCell.GetPreferredHeight(Int32 rowIndex, Int32 width)
   at System.Windows.Forms.DataGridViewCell.OnCellDataAreaMouseEnterInternal(Int32 rowIndex)
   at System.Windows.Forms.DataGridViewCell.OnMouseMoveInternal(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellMouseMove(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo hti, MouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at JWW\,\*\,ZM\*`~FUE$NkA}%=xXT".<U+202B><U+202B><U+202D>‌‍‏<U+202E><U+202E><U+202C><U+202B><U+202C><U+202A>​‍​​​<U+202B><U+202B>​‍<U+202C><U+202E><U+202D><U+202C><U+202D><U+202D><U+202E>(Object , EventArgs )
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at <U+202E>​‌‎‌‌‏<U+202E><U+202B><U+202D>​<U+202D>‍<U+202B>‎‏‍‏<U+202B>​‍​‌<U+202B><U+202E>.‌‌‌‏‎‎<U+202E>‍‍<U+202D>‍<U+202C><U+202D>‏‏<U+202D><U+202A>‎​<U+202E><U+202D><U+202E><U+202C><U+202A><U+202E><U+202E>()

Witam, błąd wygląda na problem związany ze współbieżnością. Tego typu błędy są najgorsze w naprawieniu, ponieważ trudno ustalić konkretną przyczynę.

Tu wygląda to tak, jakby jeden wątek czytał z kolekcji w celu ustalenia liczby elementów, podczas gdy inny właśnie zmienia zawartość tej kolekcji. Zgaduję, że błąd nastąpił w momencie edytowania bazy nazw. Prawdopodobnie włączona była funkcja dopisywania nieznanych kodów do bazy i dekodowanie było aktywne podczas otwarcia okna edytora nazw. Dwa “elementy programu” uzyskały dostęp do tego samego obiektu i wszystko się wysypało.

Proszę o dokładną instrukcją co zrobić w programie, żeby ten błąd wywołać, w ten sposób na 100% będę go mógł naprawić. Bez tego nie mam pewności co dokładnie się stało i mogę zgadywać.

Jako “leczenie objawowe” mogę wdrożyć funkcję automatycznego kopiowania bazy nazw do osobnego pliku raz na jakiś czas, wtedy zawsze będzie jakaś kopia w razie wypadku.

To sie stalo dokladnie przy edytowaniu numeru jednostki i chyba wtedy poszedl selekt jednoczesnie, ale nie jestem pewien w 100%.

Jakby sie dalo kopie robic tego automatycznie to by bylo juz cudownie

Hm mogę też dodać możliwość kopii w chmurze, wtedy zainteresowane osoby mogłyby włączyć automatyczne przesyłanie konfiguracji do mnie i byłaby również opcja przywrócenia tych ustawień.

2 polubienia

Pewnie wiele by to ulatwilo

Okej udało mi się wywołać podobny problem w środowisku testowym.

NIE NALEŻY edytować bazy nazw podczas, gdy dekodowanie jest aktywne razem z tą opcją włączoną:

Poprawię to w aktualizacji. Bardzo dziękuję za zgłoszenie.

Bardzo dziękuje za chęć pomocy i naprawę tego

1 polubienie