5

I've created a WPF app which works pretty stable. But there is one issue I'm not able to solve.

When I connect via TeamViewer (version 11) to the tablet on which my WPF app is running (in fullscreen mode), the app crashes. Same happens when I end the remote connection.

I got following exception:

System.ComponentModel.Win32Exception (0x80004005): 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, Object args, Int32 numArgs, Delegate catchHandler)

I assume that the problem is somewhere in my code and is not a fault of TeamViewer. I was already searching for the GetWindowText() method without success. The only thread here on StackOverFlow which refers to the same exception couldn't help me either.

Hopefully someone can give me some reasons why this exception could occur.

Community
  • 1
  • 1
Felix
  • 2,670
  • 3
  • 13
  • 21
  • Unfortunately I don't know anything about this specific error. But as a hint: I had enough problems with TeamViewer in a WPF application and in an Excel COM addin because TeamViewer effectively blocks the clipboard (somehow on an apparently deep Win32 layer) from being used. The solution in my case was to avoid the Windows clipboard when a TeamViewer session is open and to build an "application internal clipboard". – haindl Oct 11 '16 at 11:39
  • Thanks for your answer. But on my tablet is no excel installed. The only apps running there are my wpf app and TeamViewer. But so you are saying that TeamViewer could be the culprit and not my app? – Felix Oct 11 '16 at 12:55
  • 1
    Yes, in my case an open TeamViewer session prevented us from using `Clipboard.GetDataObject();` and `Clipboard.SetDataObject(data);` in WPF and from using `Worksheet.Paste();` and `Range.PasteSpecial();` in the Excel addin. I don't have the exact Exception at hand but it was most definitely a `Win32Exception` with a 0x8000.... error code. After closing the TeamViewer session the clipboard was fine again. This wasn't good because we mostly handle the support for our software with the help of TeamViewer. – haindl Oct 11 '16 at 13:10
  • Same thing is happening to me. I am afraid that TeamViewer is the troublemaker here and I have no idea how to resolve this. – lot Nov 14 '17 at 16:23
  • duplicate question here https://stackoverflow.com/questions/44322332/wpf-application-crashes-when-connected-via-teamviewer suggests the app was missing a title for the MainWindow – Oded Ben Dov Apr 07 '19 at 12:24

0 Answers0