VFPX / GoFish

GoFish is an advanced code search tool for fast searching and replacing of Visual FoxPro source code.
8 stars 7 forks source link

Some searches produce OLE error code 0x800a139c: Unknown COM status code #68

Closed nmpetkov closed 1 year ago

nmpetkov commented 1 year ago

ℹ Computer information

📝 Provide detailed reproduction steps (if any)

Some searches produce an error: OLE error code 0x800a139c: Unknown COM status code.

To reproduce search for: OpenPath(

These are usually expressions that look like part of method names. Guessing, but not sure, macro substitution is being used somewhere.

📷 Screenshots

2023-03-17 18 12 59

Jimrnelson commented 1 year ago

I am not able to reproduce this error.

Am guessing here -- are you searching using regular expressions?

Also, can you suspend the error and show the execution stack?

nmpetkov commented 1 year ago

After reproduce again the error (I get many times to the moment), I see it you get if you HAVE results, the results table is not empty. Here is call stack:

image

Jimrnelson commented 1 year ago

As I guessed, you're using regular expressions. As I noted in another message, regular expressions are about 5 times slower that the other search alternatives, so the suggestion is to use them only if you really want to use a regular expression.

The search expression you entered, OpenPath(, contains a special character (the left parenthesis) used in regexp and needs a closing right parenthesis to be valid. But these characters have special meaning in RegExp. If that is the text you really want to look for, don't use regular expressions.

That being said, GF tries to validate the search expression before getting going. When I try it, I get this:

image

So, the question behind all this is why this validation works correctly for me and nor for you. That I cannot answer.

nmpetkov commented 1 year ago

There is no regular expressions, just plane search. The error occurs not during the search, but afterwards, when displaying the search result. Please look at the call stack abouve in the provided image.

Jimrnelson commented 1 year ago

There is no regular expressions, just plane search. The error occurs not during the search, but afterwards, when displaying the search result. Please look at the call stack abouve in the provided image.

Ah, you are correct, my bad.

So the problem occurs when it is trying to display the context pane that shows that line and surrounding lines (for most, this line appears under the grid.)

RegExp is used, apparently, to generate the HTML code that appears there, which includes highlighting the match line. (Yes, that sounds like another issue, doesn't it.)

Am guessing that a rather simple fix, a Try/Catch in the correct place, would prevent the error (as well as the hoped for highlighting.)

nmpetkov commented 1 year ago

Am guessing that a rather simple fix, a Try/Catch in the correct place, would prevent the error (as well as the hoped for highlighting.)

I also think that would solve the problem

Jimrnelson commented 1 year ago

Also --

I have not upgraded to version 6 yet. I do not see this problem in version 5.

lscheffler commented 1 year ago

@Jimrnelson The expression BlaBla( as regexp runs fine, gets zero results and an error-message complaining about the wrong pattern afterwards, but does not fail unexpected.

@nmpetkov As I see from the call stack, the build of the HTML browser output fails. Does any other search run, or can you display a restored search result at all?

Please post the value of lcRegEx.

@Jimrnelson I guess the problem is different. The engine uses regexp internally to create the HTML, try to replace the pattern blabla( and fails because the bracket is not escaped. So in GoFishSearchEngine.RegExReplace, if the search runs without regexp, the pattern must be expected as a literal string and signs special for regexp must be escaped out. (Thanks to the other issue I have my brain turned on for regexp. :) )

Update: But not for spelling. I will fix the the next days.

lscheffler commented 1 year ago

@nmpetkov To bypass the problem try:
Activate regexp. Use OpenPath\( as search string. This will slow down GoFish by an order of magnitude, but at least should display your result. Untested, I'm 16h on the keyboard and quit for today.

nmpetkov commented 1 year ago

I have not upgraded to version 6 yet. I do not see this problem in version 5.

As I stated when opening the issue, it is error in version 6 only.

nmpetkov commented 1 year ago

@lscheffler @Jimrnelson To reproduce the error in GoFish 6, open one of your projects and temporarily write somewhere in it OpenPath( and save the file (later of course remove it when you've seen the error :-) Then search OpenPath( and see the error.

lscheffler commented 1 year ago

@nmpetkov Thanks, I see where it happens, and it should happen to any search like somechars( or somechars[ or similar right now, because the pattern fails. The question is why does it run in older versions, or in other words, what have I removed unintended. Since I have not touched this method it remains a bit of a riddle. But nothing a compare tool could not solve. :)

lscheffler commented 1 year ago

@nmpetkov I found the error, I found the change - only I do not see why. I need to think a bit around this.

nmpetkov commented 1 year ago

Works in 6.0.008. Nice!