************** Outer Exception **************
Exception type:System.InvalidOperationException
Exception message:Collection was modified; enumeration operation may not execute.
Exception source:mscorlib
Exception Target Site: ThrowInvalidOperationException
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at VideoOS.RemoteClient.Application.MIP.Manager.SCClientControl.ReleaseAllPlaybackControllers()
at VideoOS.RemoteClient.Application.MIP.Manager.SCEnvironmentManager.HandleApplicationStateChangedLogoff()
at VideoOS.RemoteClient.Application.MIP.Manager.SCEnvironmentManager.SmartClientLoggedOffHandler()
at VideoOS.RemoteClient.Application.Application.Logout()
at VideoOS.RemoteClient.MainApp.MainWindow.Window_Closing(Object sender, CancelEventArgs e)
at System.Windows.Window.OnClosing(CancelEventArgs e)
at System.Windows.Window.WmClose()
at System.Windows.Window.WindowFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
************** System Info **************
Date and time: 3/31/2025 9:23:30 AM
Machine Name: XXXXX
Processors count: 32
OS version: Microsoft Windows NT 10.0.26100.0
64 bit OS: True
64 bit process: True
IP address: fe80::4596:fe4e:b3eb:5b5b%15 (XXXXXX)
Current user: XXXXXXX\Demo
I am using 2024 R2 smart client
Pls help to resolve issue
Did you develop a Smart Client plugin that is now causing this error to happen? If you haven’t tested this please see if removing your plugin makes the issue go away, and deploying your plugin makes it happen.
If yes, please describe your plugin and what it does to give us a clue as to what this might be.
If no, as this does not pertain to development but to a general situation you will most likely get better help from the partners active in the Support Community - https://supportcommunity.milestonesys.com
Yes, we have a plugin in which we are using CEFSharp to load a browser within the Smart Client.
Could you please guide us on how to debug this issue?
Any help or suggestions on how to approach the debugging process would be greatly appreciated.
We have this guide on debugging.. https://developer.milestonesys.com/s/article/debugging-techniques-for-Smart-Client-plugins
Try to debug the plugin directly, see what is happening in your plugin when it happens, if anything.
Given the exception we have a question. Do you in your plugin use PlaybackController?
Yea I use play back Controller.
if I close smart client without closing play back window this error comes
do you have any solution for this.
pls help urgent
My question was too simple. Do you create and/or remove PlaybackControllers? What does trigger the create and/or remove?
Playback window is opened by clicking a button to view the playback. When the playback window is manually closed, I remove the playback controller.
However, the error occurs when the playback window remains open, and the Smart Client is closed without closing the playback window first.
This error was not happening in older version of smart client
Please try to describe how you close or remove the playback controller, especially from which methods or events you do it.
i have a global variable to keep track of active instances
public static List ActiveInstances = new List();
when ever i start playback i add ActiveInstances.Add(this);
when window manually closed i close it
protected override void OnFormClosed(FormClosedEventArgs e)
{
try
{
EnvironmentManager.Instance.Log(false, "PlayBackView", "Inside OnFormClosed");
base.OnFormClosed(e);
ActiveInstances.Remove(this); // ✅ Clean up tracking
if (imageViewerControl != null)
{
if (imageViewerControl.CameraFQID != null)
{
imageViewerControl.Disconnect();
imageViewerControl.Close();
}
imageViewerControl.Dispose();
imageViewerControl = null;
}
if (playbackFQID != null)
{
ClientControl.Instance.ReleasePlaybackController(playbackFQID);
playbackFQID = null;
}
if (playbackUserControl != null)
{
playbackUserControl.Dispose();
playbackUserControl = null;
}
}
catch (Exception ex)
{
EnvironmentManager.Instance.Log(true, "OnFormClosed", ex.Message);
}
}
At start of my application i added code for cleanup of close like this
System.Windows.Application.Current.Exit += (s, e) =>
{
foreach (var instance in PlayBackView.ActiveInstances)
{
if (instance != null && !instance.IsDisposed)
{
instance.Invoke((Action)(() => instance.Close())); // ✅ Ensure it's closed on UI thread
}
}
};
However, the error occurs when the playback window remains open, and the Smart Client is closed without closing the playback window first.
The last method, we have an idea that if you put that on the plugin Close method instead it might work better. We think there is a sequence to how the Smart Client closes and you are not hooking into this when using System.Windows.Application.Current.Exit
Please let me know if this solves the issue, if not please let me know what you observe debugging this.