Issue Description
I'm creating an issue to reference in a PR I'm about to submit for a bug I spotted.
Essentially, Regex.Replace(string input, string pattern, string replacement) will be called if the receiver type is something other than Regex under certain conditions:
- The receiver type must be included in
AvailableStaticMethods (or the MSBUILDENABLEALLPROPERTYFUNCTIONS must be set).
- The receiver type must not already be handled by
WellKnownFunctions.
Steps to Reproduce
Employ a property expression that matches the criteria specified above. For example, this expression will trigger the problem:
$([System.TimeSpan]::Replace('abc_123_ghi', '\\d+', 'def'))
Expected Behavior
Regex.Replace(string input, string pattern, string replacement) shouldn't be called unless the property function is for
Actual Behavior
An InvalidProjectFileException should be thrown, or the correct Replace method on the given receiver type, if one exists.
Analysis
This is a regression that was introduced with commit 59a6e31 (merged from PR #10409). It looks like it was just a copy paste fail when cleaning up the PR changes.
Versions & Configurations
No response