"FlashControl.Enabled = true" throws FileLoadException occaionally
Hong
1,051
Reputation points
FlashControl flashControl = myMediaCapture.VideoDeviceController.FlashControl;
flashControl.Enabled = true
The above code usually works fine, but "flashControl.Enabled = true" occasionally throws the following:
System.IO.FileLoadException: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
Stack Trace:
at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, SByte) + 0xc0
at __Interop.ForwardComStubs.Stub_24TThis + 0x37
Could anyone shed some light on the possible causes?