微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 通过Teamviewer连接时WPF应用程序崩溃

将teamviewer连接到运行 WPF应用程序的设备时出现问题.如果建立了此连接,我的WPF应用程序崩溃时出现以下异常:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: Cannot create a file when that file already exists
   at MS.Win32.UnsafeNativeMethods.GetwindowText(HandleRef hWnd,StringBuilder lpString,Int32 nMaxCount)
   at System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.ContextLayoutManager.fireAutomationEvents()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Object args,Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,Delegate callback,Int32 numArgs,Delegate catchHandler)
   at System.Windows.Threading.dispatcherOperation.InvokeImpl()
   at System.Windows.Threading.dispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext,Object state)
   at System.Windows.Threading.dispatcherOperation.Invoke()
   at System.Windows.Threading.dispatcher.ProcessQueue()
   at System.Windows.Threading.dispatcher.WndProcHook(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Boolean& handled)
   at MS.Win32.HwndSubclass.dispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Delegate catchHandler)
   at System.Windows.Threading.dispatcher.LegacyInvokeImpl(dispatcherPriority priority,TimeSpan timeout,Delegate method,Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.dispatchMessage(MSG& msg)
   at System.Windows.Threading.dispatcher.PushFrameImpl(dispatcherFrame frame)
   at System.Windows.Threading.dispatcher.PushFrame(dispatcherFrame frame)
   at System.Windows.Application.Rundispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)

这个问题似乎与描述的相同
here.

在对此问题的评论中,提到剪贴板的使用可能是导致此问题的原因.但我的WPF应用程序不使用剪贴板.

我希望有人能帮我找到这个例外的原因.

解决方法

我自己解决了这个问题.它是由MainWindow的空标题引起的.设置后,问题得到解决.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐