Prior to upgrading to 21.12, searching for “~~Value” in a cell using LookAtType.Contains option would find the cell. After the upgrade, the search fails. Even when we escape the tildes using additional tildes. The escape of the tildes works when using LookAtType.StartWith, but NOT with LookAtType.Contains.
Here is a test method that demonstrates the failure, note that the searches with “Contains” option fail to find the cells:
[Test]
public void FindExtensionTest()
{
Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets.Add("Tilde Test 1");
ws.Cells[0, 1].PutValue("fooey");
ws.Cells[1, 1].PutValue("~blah");
ws.Cells[4, 4].PutValue("~TildeTest");
ws.Cells[5, 5].PutValue("~~TildeTest");
ws.Cells[5, 6].PutValue("Don't find me.");
ws.Cells[6, 1].PutValue("?Hello");
ws.Cells[7, 2].PutValue("??Goodbye");
ws.Cells[8, 3].PutValue(string.Empty);
ws.Cells[9, 4].PutValue("~~ContainsTest");
FindOptions findOptions = new FindOptions();
// Demonstrate that single tilde finds no data.
findOptions.LookAtType = LookAtType.StartWith;
Cell cell = ws.Cells.Find("~", null, findOptions);
Assert.AreEqual(null, cell?.Value);
// Demonstrate that nullifying the tilde with a tilde will search for a tilde.
findOptions.LookAtType = LookAtType.StartWith;
cell = ws.Cells.Find("~~", null, findOptions);
Assert.AreEqual("~blah", cell.Value);
// Demonstrate that the same search fails when doing Contains option.
findOptions.LookAtType = LookAtType.Contains;
cell = ws.Cells.Find("~~", null, findOptions);
Assert.IsNull(cell);
// Do a double tilde search without nullifying the tildes
// and verify that the wrong value was found.
findOptions.LookAtType = LookAtType.StartWith;
cell = ws.Cells.Find("~~TildeTest", null, findOptions);
Assert.AreNotEqual("~~TildeTest", cell.Value);
// Do double tilde search with proper nullification
// and verify that the correct cell was found.
findOptions.LookAtType = LookAtType.StartWith;
cell = ws.Cells.Find("~~~~TildeTest", null, findOptions);
Assert.AreEqual("~~TildeTest", cell.Value);
// Demonstrate that the same search fails when doing Contains option.
findOptions.LookAtType = LookAtType.Contains;
cell = ws.Cells.Find("~~~~TildeTest", null, findOptions);
Assert.IsNull(cell);
}