Serg046/MsBuildTaskExplorer

Searching for a term that contains a slash crashes MSBTE

Closed this issue · 4 comments

I searched for src\ (this is the beginning of the path where my projects are located) and MBSTE crashed.

msbuild-filter-slash-crash

Yep, this is my bad. You can double the symbol as temp workaround src\\|

Unfortunately I don't see a way to escape the string automatically. Of course, you can call Regex.Escape(...) but then it escapes everything including . and *, so that for the string foo.*bar you will get foo\.\*bar that is what we don't want. That's why I just left the code as is but moved the exception to the output window.

Will be shipped with the next release.

How about automatically escaping \ when it is not followed by one of regex special characters ?

If we supported it for \, we would need to support the same for other symbols. Although it is easy to implement for \, it is not for other symbols like [. With that symbol we would need to look for ] somewhere farther in the string and ensure that it is not escaped \]. It looks like a complication without a big need. This search is one-time action that's why I think we can pay this cost for simplification. The only issue I still see is performance. Exception handling is heavy operation. But there is no any other officially supported way to validate the expression