Fix System.InvalidOperationException: This Visual is not connected to… #148

Merged
flash384 merged 1 commit from fix-invalidoperationexception into master 2020-09-06 14:14:39 -05:00
flash384 commented 2018-06-27 02:51:02 -05:00 (Migrated from github.com)

Check that TextView in PresentationSource

> System.InvalidOperationException: This Visual is not connected to a PresentationSource.
>     System.Windows.Media.Visual.PointToScreen(Point point)
>     ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindowBase.UpdatePosition()
>     ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindowBase.SetPosition(TextViewPosition position)
>     ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindowBase.OnSourceInitialized(EventArgs e)
>    ICSharpCode.AvalonEdit.CodeCompletion.SharpDevelopCompletionWindow.OnSourceInitialized(EventArgs e)
>     System.Windows.Window.CreateSourceWindow(Boolean duringShow)
>     System.Windows.Window.ShowHelper(Object booleanBox)
>     ICSharpCode.AvalonEdit.CodeCompletion.CodeCompletionEditorAdapter.<>c__DisplayClass2.b__1()
>     System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
>     System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Check that TextView in PresentationSource ``` > System.InvalidOperationException: This Visual is not connected to a PresentationSource. > System.Windows.Media.Visual.PointToScreen(Point point) > ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindowBase.UpdatePosition() > ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindowBase.SetPosition(TextViewPosition position) > ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindowBase.OnSourceInitialized(EventArgs e) > ICSharpCode.AvalonEdit.CodeCompletion.SharpDevelopCompletionWindow.OnSourceInitialized(EventArgs e) > System.Windows.Window.CreateSourceWindow(Boolean duringShow) > System.Windows.Window.ShowHelper(Object booleanBox) > ICSharpCode.AvalonEdit.CodeCompletion.CodeCompletionEditorAdapter.<>c__DisplayClass2.b__1() > System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) > System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) ```
flash384 commented 2018-06-27 03:05:32 -05:00 (Migrated from github.com)

Some of tests(WeakReferenceTests) failed without my changes, any idea?

Some of tests(WeakReferenceTests) failed without my changes, any idea?
jogibear9988 commented 2019-09-01 03:10:28 -05:00 (Migrated from github.com)

I think the failing tests are already fixed. Can this be closed?

I think the failing tests are already fixed. Can this be closed?
siegfriedpammer commented 2020-02-04 08:16:45 -06:00 (Migrated from github.com)

@flash384 The fix looks good to me, but do you have reproduction steps for this bug? Possibly using the AvalonEdit.Sample application? Thank you very much!

@flash384 The fix looks good to me, but do you have reproduction steps for this bug? Possibly using the AvalonEdit.Sample application? Thank you very much!
flash384 commented 2020-02-06 09:39:51 -06:00 (Migrated from github.com)

@flash384 The fix looks good to me, but do you have reproduction steps for this bug? Possibly using the AvalonEdit.Sample application? Thank you very much!

Hi! Unfortunately I don't have repro steps.

> @flash384 The fix looks good to me, but do you have reproduction steps for this bug? Possibly using the AvalonEdit.Sample application? Thank you very much! Hi! Unfortunately I don't have repro steps.
dgosbell commented 2020-07-02 17:43:58 -05:00 (Migrated from github.com)

I'm getting crash reports from my app with this error, but I don't have repro steps either. I can only guess that it's some specific sequence of events with a specific timing or something like that. But it would be great to have this pull request merged in as this issue crashes the hosting application.

I'm getting crash reports from my app with this error, but I don't have repro steps either. I can only guess that it's some specific sequence of events with a specific timing or something like that. But it would be great to have this pull request merged in as this issue crashes the hosting application.
dgosbell commented 2020-07-22 22:54:12 -05:00 (Migrated from github.com)

I actually just saw this exception on my app for the first time. But all I did was attempt to reposition the app by dragging the title bar, as far as I can recall the code completion window was not open at the time and I have not been able to repro this again. It makes me wonder if it's only triggered in rare circumstances by some sort of race condition.

I actually just saw this exception on my app for the first time. But all I did was attempt to reposition the app by dragging the title bar, as far as I can recall the code completion window was not open at the time and I have not been able to repro this again. It makes me wonder if it's only triggered in rare circumstances by some sort of race condition.
dgrunwald commented 2020-09-06 14:16:39 -05:00 (Migrated from github.com)

It's a bit weird to have no PresentationSource within the OnSourceInitialized event.
Maybe the event can sometimes be delayed in the dispatcher's queue?
Let's hope this fix works. If it's a race with some other WPF thread, the fix might be insufficient and we'd have to instead catch the exception :/

It's a bit weird to have no `PresentationSource` within the `OnSourceInitialized` event. Maybe the event can sometimes be delayed in the dispatcher's queue? Let's hope this fix works. If it's a race with some other WPF thread, the fix might be insufficient and we'd have to instead catch the exception :/
XspeedPL commented 2020-10-16 11:52:11 -05:00 (Migrated from github.com)

I recently ran into this problem and figured out steps that reproduce it:

  1. Maximize the parent window
  2. Open an OverloadInsightWindow
  3. Remove the editor control from the tree (the overload window stays)
  4. Try to normalize the window
  5. BOOM
I recently ran into this problem and figured out steps that reproduce it: 1. Maximize the parent window 2. Open an OverloadInsightWindow 3. Remove the editor control from the tree (the overload window stays) 4. Try to normalize the window 5. *BOOM*
Sign in to join this conversation.
No description provided.