Unplanned
Last Updated: 26 Oct 2022 14:17 by ADMIN
Philip
Created on: 26 Oct 2022 14:09
Category: WebCam
Type: Bug Report
1
RadWebCam: RaceOnRCWCleanup exception when disposing a form with camera control

To reproduce, run the sample project that uses the following code snippet: 

    public partial class MainForm : Telerik.WinControls.UI.RadForm
    {
        public MainForm()
        {
            InitializeComponent();
        } 
        private void radButton1_Click(object sender, EventArgs e)
        {
            using (CameraForm f = new CameraForm())
            {
                f.ShowDialog();
            }
        }
    }

    public partial class CameraForm : Telerik.WinControls.UI.RadForm
    {
        public CameraForm()
        {
            InitializeComponent();
            
        }

        private void CameraForm_FormClosing(object sender, FormClosingEventArgs e)
        {
         this.radWebCam1.Stop();           
        }

        private void CameraForm_Load(object sender, EventArgs e)
        {

            ReadOnlyCollection<MediaFoundationDeviceInfo> videoDevices = RadWebCam.GetVideoCaptureDevices();
            ReadOnlyCollection<MediaFoundationVideoFormatInfo> videoFormats = RadWebCam.GetVideoFormats(videoDevices[0], true);
            radWebCam1.Initialize(videoDevices[0], videoFormats[0]);
            radWebCam1.Start();
        }
    }

Note: please have in mind that the issue may not occur the first time you close the CameraForm.

1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 26 Oct 2022 14:17

Hello,

Thank you for reporting this undesired behavior.

Currently, the possible solution that I can suggest is to comment any explicit camera stopping and disposing and leave the default form's disposing deals with it. It seems to eliminate the RaceOnRCWCleanup  exception on my end.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.