Example #1
0
        private void _arrangedItems_OnItemsChanged(object sender, EventArgs e)
        {
            try
            {
                render();
            }
            catch (ObjectDisposedException ex)
            {
                // I confirmed that this object DOES dispose, it just takes a long time for GC to kick in.
                // And apparently the Java object will dispose before it. But if I call GC.Collect, it disposes immediately.
                // So instead, I'll just unwire the events and then at some point in time GC will collect.
                if (!_objectDisposed)
                {
#if DEBUG
                    WeakEventHandler.InvokeObjectDisposedAction();
#endif
                    _objectDisposed = true;
                    Deinitialize();
                }
                else
                {
                    TelemetryExtension.Current?.TrackException(new Exception("DayScheduleSnapshotView ObjectDisposedException hit twice or more", ex));
                }
            }
            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }