当我在视频录制过程中锁定手机时,我的应用程序挂起堆栈跟踪,如下所示:
System.Windows.dll!MS.Internal.NativePhotoMethods.CapMan_Disconnect(int dwSeq)
System.Windows.dll!System.Windows.Media.CaptureSource.CaptureThread() + 0x2dd 字节 mscorlib.dll!System.Threading.ThreadHelper.ThreadStartHelper(System .Threading.ThreadHelper t) + 0x1d 字节
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(对象状态) + 0xb 字节
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading. ContextCallback 回调,对象状态)+ 0x63 字节
mscorlib.dll!System.Threading.ThreadHelper.ThreadStartHelper() + 0x2a 字节
当我调用captureSource.Stop()
(在锁定事件PhoneApplicationFrame.Obscured上)时,我的应用程序挂起不同的堆栈跟踪:
mscorlib.dll!System.Threading.Thread.Join() System.Windows.dll!System.Windows.Media.CaptureSource.StopManagedImageCapture() + 0x3e 字节
System.Windows.dll!System.Windows.Media.CaptureSource.Stop() + 0x10 字节
HelloWorld.dll!HelloWorld.App.RootFrame_Obscured(object sender, Microsoft.Phone.Controls.ObscuredEventArgs e) 第 96 行 + 0xa 字节 C# Microsoft.Phone.dll!System.Windows.Controls.Frame.FireEventHandler(System.EventHandler处理程序,对象发送者,Microsoft.Phone.Controls.ObscuredEventArgs 参数)+ 0xd 字节 Microsoft.Phone.dll!Microsoft.Phone.Controls.PhoneApplicationFrame.ShellPageManager_OnLockStateChange(对象发送者,Microsoft.Phone.Shell.Interop.LockStateChangeEventArgs 参数)+ 0x48 字节
Microsoft.Phone.Interop.dll!Microsoft.Phone.Shell.Interop.ShellPageManager.ShellPageCallback_OnLockStateChange(object source, Microsoft.Phone.Shell.Interop.LockStateChangeEventArgs e) + 0x12 字节
Microsoft.Phone.Interop.dll!Microsoft.Phone.Shell .Interop.ShellPageCallback.FireOnLockStateChange(bool fLocked) + 0x41 字节
[外部代码]
如何防止挂起并正确暂停/关闭CaptureSource
?