当我在视频录制过程中锁定手机时,我的应用程序挂起了堆栈跟踪,如下所示:
System.Windows.dll!MS.Internal.NativePhotoMethods.CapMan_Disconnect(int dwSeq)
System.Windows.dll!System.Windows.Media.CaptureSource.CaptureThread()+ 0x2dd bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStartHelper(System.Threading.ThreadHelper t)+ 0x1d bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(对象状态)+ 0xb字节
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext,System.Threading.ContextCallback callback,object state)+ 0x63 bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStartHelper()+ 0x2a bytes
当我拨打captureSource.Stop()
时(在锁定事件PhoneApplicationFrame.Obscured上),我的应用程序挂起了不同的堆栈跟踪:
mscorlib.dll中!System.Threading.Thread.Join() System.Windows.dll!System.Windows.Media.CaptureSource.StopManagedImageCapture()+ 0x3e bytes
System.Windows.dll!System.Windows.Media.CaptureSource.Stop()+ 0x10 bytes
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 handler,object sender,Microsoft.Phone.Controls.ObscuredEventArgs args)+ 0xd bytes Microsoft.Phone.dll!Microsoft.Phone.Controls.PhoneApplicationFrame.ShellPageManager_OnLockStateChange(object sender,Microsoft.Phone.Shell.Interop.LockStateChangeEventArgs args)+ 0x48 bytes
Microsoft.Phone.Interop.dll!Microsoft.Phone.Shell.Interop.ShellPageManager.ShellPageCallback_OnLockStateChange(object source,Microsoft.Phone.Shell.Interop.LockStateChangeEventArgs e)+ 0x12 bytes
Microsoft.Phone.Interop.dll!Microsoft.Phone.Shell.Interop.ShellPageCallback.FireOnLockStateChange(bool fLocked)+ 0x41 bytes
[外部代码]
如何防止挂起并正确暂停/关闭CaptureSource
?
答案 0 :(得分:-1)