I have a WPF window containing a RadWebCam control and a CameraSettingsControl control associated with it (as shown in the online documentation). When I close the WPF window, no memory associated with that window is released. I implemented a Finalizer in the window and found that it wasn't getting called even after several GC.Collect() calls. The culprit appears to be the CameraSettingsControl when it's associated with the RadWebCam control. In my application, it's not freeing about 80MB of memory after each window invocation.
I have included a full project sample which demonstrates the issue. Just set a BreakPoint on the finalizer ~TakePicture(). When the application is run, hit the 'Take Picture' button to launch the Camera window, and then close it. To verify that it's not just a delay in garbage collection, hit the GCCollect button on the main window a couple of times. The Finalizer never gets called until you exit the app.
Here's the Telerik control WPF I'm using, but it's also in the sample.
<telerikWebCam:RadWebCam Grid.Column ="0" x:Uid="WebCamCaptureWindow_RadWebCam" x:Name="webCam" MinWidth="0" MinHeight="0" AutoStart="False" Margin="0 25 0, 0"BorderThickness="0"
a call to StartRecording() results in an unhandled null reference exception when the webcam has been disabled. (this is not the case when other webcam errors occur, like when the webcam is taken by another application).
Our application provides a fallback scenario to make an audio recording when the webcam is not available, in order for this to work it would be preferable to be able to call the StartRecording() method without causing a crash, and to still have the RecordingStarted event triggered, just like in the case of a "camera unavailable" error.
Steps to reproduce:
1. Create a form with a webcam that calls Close and Dispose when closed.
2. Create a second form with a button that shows the first form.
3. Run the project and you will see an exception when closing the webcam form.
Steps to reproduce:
1. Place a camera on a window
2. Have no camera plugged in the PC
3. Call the Start or Stop method
Expected behaviour: Nothing
Actual behaviour: An exception is thrown