I recently found a bug in Xojo 2020 R2.1, where if you use Search & Replace ALL in the IDE, properties with descriptions can get corrupted. I filed a bug report on it (#63782), but I had to make it private because the project is proprietary. However, it can do serious damage on a large project and I want everyone to be know they should be extra-careful when using All.
what did you type in the “Search” field for example?
The search term can be anything. In my case, it was “SerialNumber”, replaced by “LWID”. The problem is that if any property has a descriptive note in its comments/notes field, then doing the replace All concatenates the comments text, makes that the name of the property, and mucks up the type and default values. This can happen to all properties with comments, not just the ones you searched for. The only way safe way to work at the moment is to do a Run or Analyze Project afterwards, that will show them as errors. If something was corrupted, then your only useful option is to revert back to the state before the replace all. Or maybe use Arbed to compare and fix things.
when you do a search you just search “SerialNumber” or " SerialNumber " (note the spaces) ?
I searched for “SerialNumber”, because that’s the name of a property in my project.
i mean when you search did you search specific enough ?
So did the search results actually reflect what you “ALL” replaced?
or do you mean this bug just always replaces everything?
i do know that some parameters, properties or other things may never get replaced even if you select “Replace” (that replaces the selected search line)
The search & replace actually does what you’ve asked for - correctly. However, it may also screw up some property definitions along the way, in properties that were not affected by the search & replace criteria.
Can you describe your problem with a bit more detail? I haven’t a clue how to reproduce the issue.
You can create a public Feedback case and make attachments private.
i’ve never seen that other than myself to have mistyped the replace " myString." added a space or forgot to add a space … or such. so it means we’re curious how to reproduce so we won’t do that…
What does that have to do with the bug he described??? Have you actually read what he wrote?
The bug isn’t that Search/Replace is not working (and he clearly states that it works) but the side effects he described.
Here are two screen shots (before and after).
In the first one, note the property “HistoryGroupStr” and the search “SerialNumber” and replace “Stuff”.
Clicking the All button results in the second screen shot.
Notice that a new entry has been added below HistoryGroupStr, it has the name “Ifthisitemisthechildofanotheritem”. The new entry is nowhere near anything with the phrase “SerialNumber” in it. There can be multiple new entries, and sometimes an existing property’s name is replaced with a new wonky name that comes from a note attached to a completely different property that is further down the list of properties for this class.
I’ve never had this happen before, but it can happen at any time now. This is Xojo 2020 R2.1.
Thanks for clarifying… i was worried it could be something major.
i happen to have seen this, just today…
This happened to me once too, and Undo did not fix it. I had to get the project back from my Time Machine. I didn’t report the problem. But yes, the problem is real.
Since then, I remind myself whenever I want to do a Search and Replace All, to go the safe route and do the search, then select entries in the results list very carefully, making certain everything selected should really be changed. I almost always had done it that way before, since using blind Replace All for coding is bad practice anyway. Now I have even more reason to do it the slower way.
The good news is, the Feedback report says its reproducible, so hopefully they can get this fixed ASAP.
My favorite Replace All story is from many years ago when I was helping produce a children’s Christmas play for church. We got to a line in the script that was indecipherable. I finally figured out that since we had more girls than boys in the cast, the had changed a boy’s to a girl’s part. They did a search on “Mark” and replaced all with “Jessica”. The original line was “That’s remarkable!”. The garbled result was “That’s reJessicaable!”
I started studying Biology in 1983 … and Computers were few and far between. So when we finally managed to get onto one people liked to show off their skills. So one guy brought his parents and tried to impress them with find/replace:
“And we can easily replace all the ‘e’ in this text with ‘r’ … see … and to reverse it we just do the opposite and replace all the ‘r’ with ‘e’ …” …
There are so many reproducible issues in Feedback it’s not funny anymore.