Milestone R3 ImageViewerControl throws NullReferenceException after being disposed.

I am attempting to dispose of an ImageViewerControl and it appears you guys are not checking for disposed/disconnected in the camera reconnect timer. I have tried a few variants of the calls but i still get an unhandled exception bubbling up from your library.

After calling the following methods:

_imageViewerControl.Disconnect();
_imageViewerControl.Close();
_imageViewerControl.Dispose();

I get a NullReferenceException and here is a partial stack trace (I have attached the full one)

   at VideoOS.UI.Common.WPF.VideoPlayer.Toolkit.ToolkitVideoSource.Connect(XmlDocument configurationXml, XmlDocument digitalZoomConfigurationXml, List`1 renderingParameters, Boolean multicast)
   at VideoOS.UI.Common.WPF.VideoPlayer.VideoPlayer.Connect(XmlDocument configurationXml, XmlDocument digitalZoomConfigurationXml, List`1 renderingParameters, String cameraName, String cameraAddress, Boolean multicast)
   at VideoOS.Platform.SDK.UI.PlatformImageViewerWpfControl.ConnectUsingCameraConfigurationXml(String bstrUsername, String bstrPassword, String bstrCameraConfigurationXml)
   at VideoOS.Platform.SDK.UI.PlatformImageViewerWpfControl.ConnectToServer()
   at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)

I have reproduced the error using your PlaybackWpfUser sample project by adding the following to the MainWindow constructor:

Task.Delay(20000).ContinueWith(_ =>
{
    Dispatcher.Invoke(() =>
    {
        _imageViewerControl.Disconnect();
        _imageViewerControl.Close();
        _imageViewerControl.Dispose();
    });
 
});

The documentation you have on the control contains the following instructions:

A simple implementation just need these lines for initialization:

imageViewerControl.CameraFQID = _selectedCameraItem.FQID;

imageViewerControl.Initialize();

imageViewerControl.Connect();

When the session is to be terminated, issue the following statement:

imageViewerControl.Disconnect();

After this you can connect again to the same or another camera. Once you are completely done with the image viewer call this:

imageViewerControl.Close();

imageViewerControl.Dispose();

Any help is appreciated

Thanks a lot for providing such detailed description. It made it quite easy for us to track down the problem and we have now made a fix for the next release (2018 R1).

Would it be possible for you to wait for that release (estimated February 2018) or implement a temporary work-around in your code?

Thanks. Unfortunately, because we rely heavily on changing video feeds on the fly, a temporary work-around will not be suitable. Is a hotfix possible? We need this particular problem fixed as soon as possible.

A hotfix build was developed. The hotfix is a new MIP SDK with installer and all.

http://download.milestonesys.com/MIPSDK/HOTFIX/MIPSDKbuild/Hotfix145725_build2436_MIPSDK_Installer_2017R3.msi

Awesome. Do you have a hotfix change log available? We will also need the x86 version of the binaries available as well. Your quick response is very appreciated in regards to this matter.

We have now uploaded the x86 binaries installer also:

http://download.milestonesys.com/MIPSDK/HOTFIX/TFS145725/MIPSDK_2017R3_Redist_Installer_x86.msi

And at the same time moved the other file a bit so that the download link for that one is now:

http://download.milestonesys.com/MIPSDK/HOTFIX/TFS145725/MIPSDK_Installer_2017R3.msi

We only make release notes for the official releases and not for the hotfixes, but I can inform you that apart from this fix the only other change compared to the released MIP SDK 2017 R3 is removal of a potential memory leak for the Image Viewer Controls.

Looks to be working correctly now. Thanks for getting these updates out.

I was having the same issue, I’ve noticed that after ImageViewerWpfControl.Disconnect() the source was reconnected again. This hotfix has solved the issue! Thanks.