The VS 11 and the new Find feature with .NET regular expressions change not only affects the EditPoint.FindPattern method, it also affects the EditPoint.ReplacePattern method.
I have found an issue that I reported to Microsoft Connect as a bug but it has been closed as “Not reproducible”. Anyone can reproduce it and post a comment?:
Microsoft Connect Bug Report: EditPoint.ReplacePattern in add-in causes COMException 0x800A00B9
Update (Jan 14): Microsoft closed this bug report indicating that was fixed in the next build
Update (Mar 3): certainly it has been fixed in VS 11 Beta, released three days ago.
When Microsoft released Visual Studio .NET and the .NET Framework 1.0 back in 2002, one of the quirks of the IDE was that while the .NET Framework has one syntax for regular expressions, the Find dialog has another syntax for them. This has been so for ten years and five Visual Studio releases (2002, 2003, 2005, 2008 and 2010), but finally in VS 11 the IDE will use the .NET Framework syntax for regular expressions, and wildcards support will be removed.
This has two consequences for developers extending Visual Studio, either with macros or with add-ins using the EnvDTE.EditPoint.FindPattern(pattern, vsFindOptionsValue, …) method of the automation model:
- In VS 11 the vsFindOptionsWildcards value is no longer supported. You need to use regular expressions now.
- In VS 11 the vsFindOptionsRegularExpression value now refers to .NET regular expressions, not to VS.NET regular expressions. That is, likely you need to change the pattern value for the FindPattern method to work the same in VS 2010 and VS 11.
Happy New Year!
I have just received the Most Valuable Professional (MVP) award again!. It’s always great to start a new year with this award, something that has happened to me the 9 last years 🙂
As always, I am very grateful to Microsoft for this recognition 🙂