Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes when selecting commit text which includes a bug tracker reference #342

Closed
RoystonS opened this issue Jun 25, 2019 · 22 comments

Comments

@RoystonS
Copy link

commented Jun 25, 2019

Version: Git-Fork Windows 1.35.0.0

I often want to copy an issue number from one commit to another, but now I've turned on bug tracking references in my Git Fork for Windows, any attempt even to select text from a commit, where the selection crosses a bug tracking reference link, causes Git Fork to crash completely.

Here's a little video of Git Fork crashing after I've selected some commit text that attempts to include a bug tracking link. Fork hangs at the 0:08 mark, then crashes.

GitForkCrash

@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jun 25, 2019

I can't reproduce that. Can you try to reboot the computer please?

@Otiel

This comment has been minimized.

Copy link

commented Jun 25, 2019

I've reproduced this, with GitHub issue tracker. Nothing specific is logged into C:\Users\[user]\AppData\Local\Fork\logs\fork.log

Restarting the PC doesn't change anything.

@jerone

This comment has been minimized.

Copy link

commented Jun 25, 2019

Also confirmed! Also nothing specific found in the logs.

@felixhirt

This comment has been minimized.

Copy link

commented Jul 4, 2019

i cannot reproduce this bug (Jira server issue tracker), but i noticed that i cannot select the first character in the commit message if it starts with an issue tracker link. Just throwing this in here because it seems really minor. Just tell me if i should open a separate issue for that

@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

@felixhirt can you select it backward (starting from end till the start)?

@jerone

This comment has been minimized.

Copy link

commented Jul 4, 2019

I can still confirm this issue. On 2 different machines. Latest Fork version. Any commit with issue-tracker links. Both in subject & description. Selecting only text is fine, but as soon as you select text + link, it crashes.

Two rules:

  1. (?!^|\b|\s|\n|\()#(\d+)(?:$|\b|\s|\n|\)) + https://org.visualstudio.com/proj/_workitems/edit/$1
  2. (?!^|\B|\s|\n|\()PR\s?(\d+)(?:$|\b|\s|\n|\)) + https://org.visualstudio.com/_git/proj/pullrequest/$1
@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

@jerone both work fine on my computer 😕. Not sure what can make the difference...

Lack of crash report is also strange

@jerone

This comment has been minimized.

Copy link

commented Jul 4, 2019

Lack of crash report is also strange

C:\Users\<user>\AppData\Local\Fork\logs\fork.log, right? Nothing in there before I restart Fork.

I do find it strange that the log is cleared when Fork is restarted.

Also, sometimes I takes me a while to reproduce. Other times I happens instantly.

@RoystonS

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

@DanPristupov I've rebooted (sorry it took 8 days!) and the problem still exists.

@RoystonS

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

I've managed to get an error trace out of Windows Event Viewer:

Application: Fork.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Unrecoverable system error.
Stack:
   at System.Environment.FailFast(System.String)
   at MS.Internal.Invariant.FailFast(System.String, System.String)
   at System.Windows.Documents.TextPointerBase.MoveToNextInsertionPosition(System.Windows.Documents.ITextPointer, System.Windows.Documents.LogicalDirection)
   at System.Windows.Documents.TextPointer.MoveToNextInsertionPosition(System.Windows.Documents.LogicalDirection)
   at System.Windows.Documents.TextPointer.System.Windows.Documents.ITextPointer.MoveToNextInsertionPosition(System.Windows.Documents.LogicalDirection)
   at System.Windows.Documents.TextPointer.System.Windows.Documents.ITextPointer.GetNextInsertionPosition(System.Windows.Documents.LogicalDirection)
   at System.Windows.Documents.TextEditorMouse.OnMouseMoveWithFocus(System.Windows.Documents.TextEditor, System.Windows.Input.MouseEventArgs)
   at System.Windows.Documents.TextEditorMouse.OnMouseMove(System.Object, System.Windows.Input.MouseEventArgs)
   at System.Windows.Input.MouseEventArgs.InvokeEventHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run(System.Windows.Window)
   at Fork.App.Main()
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at <Module>.Main(System.String[])
@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

@RoystonS great!

This seems to be tricky. Fork in not in the call stack.

But at least we have the source: https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Documents/TextPointerBase.cs,87505e7a51e3caca

@RoystonS

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

Yeah, my heart always sinks when somebody gives me a crashing call stack and my app is nowhere to be seen. :(

I'm guessing one of those Asserts has failed? Give me a shout if you want me to run a tweaked Fork or something to get more diagnostics.

@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

I'm guessing one of those Asserts has failed?

Most likely, yes.

The text control consists of multiple text elements: plain text, hyperlink text, paragraph, etc.

internal static bool MoveToNextInsertionPosition(...)

Since the crash is caused by the looking for next insert point it can be related to hyperlink bounds.

There must be some common pattern:

  • May be only messages which end with a hyperlink crash.
  • May be messages without space between plain text and hyperlink crash

@jerone in your case, is the crash reproducible on some particular messages?

@jerone

This comment has been minimized.

Copy link

commented Jul 4, 2019

@jerone in your case, is the crash reproducible on some particular messages?

Yeah, maybe... I could (for now) only reproduce it when the message ended with an hyperlink:

Implement XXX. Closes #12345678

I select XXX and as soon as I move my cursor to the end of #12345678, it crashes.
Stopping halfway #12345678 does not crash it.

It looks like the last character is the issue!

@Otiel

This comment has been minimized.

Copy link

commented Jul 4, 2019

I can reproduce it 100% with a simple Fixes #12345678 text in the commit description.

as soon as I move my cursor to the end of #12345678, it crashes.
Stopping halfway #12345678 does not crash it.

Same here.

@felixhirt

This comment has been minimized.

Copy link

commented Jul 4, 2019

@felixhirt can you select it backward (starting from end till the start)?

yes, thats what i did. it just stops selecting at the second char
select_commit_message
Also, i too can reproduce the crash if the issuetracker link is at the end of the commit

@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jul 5, 2019

I fixed both cases. The fix will be available in Fork 1.36.
ezgif com-video-to-gif

Thank you to everyone!

@DanPristupov DanPristupov added this to the 1.36 milestone Jul 5, 2019

@RoystonS

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

Wonderful - thank you! Purely out of curiosity, do you know what caused it to fail for some people but not others?

@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2019

@RoystonS Jerone mentioned the reason some comments above (#342 (comment))

Most probably the crash (and incorrect selection too) was caused by a bug in the selection range calculation in WPF.

@DanPristupov

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

I just released Fork 1.36

@RoystonS

This comment has been minimized.

Copy link
Author

commented Jul 12, 2019

Thank you - updated and it all works perfectly. Thank you.

@RoystonS RoystonS closed this Jul 12, 2019

@jerone

This comment has been minimized.

Copy link

commented Jul 12, 2019

Also confirmed working 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.