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

System.ArgumentOutOfRangeException #705

Closed
StoyanDimitrov opened this issue Jul 9, 2022 · 3 comments
Closed

System.ArgumentOutOfRangeException #705

StoyanDimitrov opened this issue Jul 9, 2022 · 3 comments
Labels

Comments

@StoyanDimitrov
Copy link
Contributor

StoyanDimitrov commented Jul 9, 2022

  • Search type Regular expression
  • Search string (two spaces)
  • Replace string \t
  • Match pattern: *.xhtml
  • test-case.xhtml (extension changed due to GitHub upload restrictions)
<logevent time="2022-07-09 09:16:01.2004" level="Error" logger="dnGREP.WPF.App">
  <message>Unhandled exception caught</message>
  <exception>System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at dnGREP.WPF.ReplaceViewModel.SelectNextMatch()
   at dnGREP.WPF.ReplaceViewModel.SelectNextFile()
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Interop.HwndTarget.OnResize()
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   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)</exception>
</logevent>

After dismissing the error dialogue (the one that points you to the log file) the replacement does not occur. The Replace dialogue does not have matches highlighted etc.

As a workaround I tried to change the regex to {2} (two repetitions of space character). This was partially successful because there was a successful replacements but text was used as literal '\t' - the resulting text was something like \t\t<h2>...

The final workaround was to use literal tab character.

@doug24 doug24 added the bug label Jul 9, 2022
@doug24
Copy link
Contributor

doug24 commented Jul 9, 2022

There is an existing method to insert a tab in the Replace string, either by itself or with other characters: \\t
You can also use \\n and \\r for newline and return.

But I don't think they are in the documentation. I would like to keep these escape sequences as-is and add them to the documentation.

Anyone have any thoughts on this?

@StoyanDimitrov
Copy link
Contributor Author

StoyanDimitrov commented Jul 9, 2022

I'd add few more strings in the TTBx group, mentioning those escape sequences.

@doug24
Copy link
Contributor

doug24 commented Aug 20, 2022

Fixed in release v3.0.136

@doug24 doug24 closed this as completed Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants