Weird replace error

System: Windows
Xojo version: 2015r2.1

In a rather large project, I had to replace a lot of terms, and one of them was ‘GridXY’ by ‘ViewXY’. The order of replacing did not matter (replacing GridXY first or replacing it after doing some other replaces). It just happened with the term GridXY.

For reference, because I think this is where Replace All got confused:

  1. GridXY was defined as Property in one Window.

  2. GridXY was also used as a local variable in a method in another window:

dim GridXY as Integer = 24

Before the replace:
GridXY: 76 occurences
ViewXY: 0 occurences

After the replace all:
GridXY: 0 occurences
ViewXY: 76 occurences

However the program did not run anymore. Luckily I had a backup.

When I manually overtyped all 76 occurences of GridXY by ViewXY, I had the same result as doing the replace all (makes sense):
GridXY: 0 occurences
ViewXY: 76 occurences

But now the program works as espected! This made we wondering what had gone wrong so I saved both projects (the one using the ReplaceAll and the one I did the replace manually) to xml and did a file compare:

In the one I did manually,

' Manual change
<Property>
  <ItemName>ViewXY</ItemName>
  <Compatibility></Compatibility>
  <Visible>1</Visible>
  <ItemSource>
   <TextEncoding>134217984</TextEncoding>
   <SourceLine>ViewXY As Integer = 24</SourceLine>
   <SourceLine></SourceLine>
  </ItemSource>
  <TextEncoding>134217984</TextEncoding>
  <ItemDeclaration>ViewXY As Integer = 24</ItemDeclaration>
  <ItemFlags>0</ItemFlags>
  <IsShared>0</IsShared>
 </Property>
 
 <ViewProperty>
   <ObjName>ViewXY</ObjName>
   <PropertyGroup>Behavior</PropertyGroup>
   <PropertyValue>24</PropertyValue>
   <ItemType>Integer</ItemType>
  </ViewProperty>


In the one done with Xojos Replace All:

' Xojo Replace All
 <Property>
  <ItemName>ViewXY</ItemName>
  <Compatibility></Compatibility>
  <Visible>1</Visible>
  <ItemSource>
   <TextEncoding>134217984</TextEncoding>
   <SourceLine>ViewXY As Integer</SourceLine>          		               ' the default value is gone
   <SourceLine></SourceLine>
  </ItemSource>
  <TextEncoding>134217984</TextEncoding>
  <ItemDeclaration>ViewXY As Integer</ItemDeclaration>              ' the default value is gone
  <ItemFlags>0</ItemFlags>
  <IsShared>0</IsShared>
 </Property>
 
<ViewProperty>
   <ObjName>GridXY</ObjName>								' still using the old name GridXY
   <PropertyGroup>Behavior</PropertyGroup>
   <PropertyValue>24</PropertyValue>
   <ItemType>Integer</ItemType>
</ViewProperty>

In the IDE, both gave no errors analysing.

Unfortunately, I cannot report this error through feedback as it keeps crashing on me. I would be grateful if someone could however, as this error has kept me searching for the best part of my day.

Please go to the downloads page on our website and get the latest version of Feedback from there, then you should be able to report the bug.

@Alain Bailleul: Just curious because I’ve experienced problems when bulk renaming as well. IIRC, I corrected it by going back to the replaced value (ViewXY in your case) and deleting the last letter, and then tabbing to autocomplete the variable. Does this work for you?

@Tanner Lee Yes that does fix it. (No more GridXY in the . Of course this only works if you know what is causing the trouble.

@Greg O’Lone I managed to get it in the latest feedback app, but just. Same problems. It’s like when I want to add a case, I got something like 15 seconds to add it. Then it automatically saves the case when I’m still making it. I get the box 'Your case is saved, do you want to see it). When I added the second part (quickly copy paste from notepad where I prepared it), a couple of seconds later I could see a message ‘loading case’ or something (to fast to read it completely) and the second part was added to the case. Looks like a screen refresh causes the case to be saved.