Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Build.UnitTests/Evaluation/IntrinsicFunctionOverload_Tests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.IO;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Framework;
Expand Down Expand Up @@ -568,5 +569,26 @@ public void MSBuildModuloReal()
ProjectProperty? actualProperty = project.GetProperty("Actual");
actualProperty.EvaluatedValue.ShouldBe(expected);
}

[Fact]
public void SystemUriEscapeDataString()
{
const string projectContent = @"
<Project>
<PropertyGroup>
<TestInput>hello world &amp; friends</TestInput>
<Escaped>$([System.Uri]::EscapeDataString($(TestInput)))</Escaped>
</PropertyGroup>
</Project>";

string expected = Uri.EscapeDataString("hello world & friends");

using TestEnvironment env = TestEnvironment.Create();

using ProjectFromString projectFromString = new(projectContent.Cleanup());
Project project = projectFromString.Project;
ProjectProperty? actualProperty = project.GetProperty("Escaped");
actualProperty.EvaluatedValue.ShouldBe(expected);
}
}
}
1 change: 1 addition & 0 deletions src/Build/Resources/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ private static void InitializeAvailableMethods()
availableStaticMethods.TryAdd("System.StringComparer", new Tuple<string, Type>(null, typeof(StringComparer)));
availableStaticMethods.TryAdd("System.TimeSpan", new Tuple<string, Type>(null, typeof(TimeSpan)));
availableStaticMethods.TryAdd("System.Text.RegularExpressions.Regex", new Tuple<string, Type>(null, typeof(Regex)));
availableStaticMethods.TryAdd("System.Uri", new Tuple<string, Type>(null, typeof(Uri)));
availableStaticMethods.TryAdd("System.UriBuilder", new Tuple<string, Type>(null, typeof(UriBuilder)));
availableStaticMethods.TryAdd("System.Version", new Tuple<string, Type>(null, typeof(Version)));
availableStaticMethods.TryAdd("Microsoft.Build.Utilities.ToolLocationHelper", new Tuple<string, Type>("Microsoft.Build.Utilities.ToolLocationHelper, Microsoft.Build.Utilities.Core, Version=" + MSBuildConstants.CurrentAssemblyVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", null));
Expand Down
Loading