Skip to content
Merged
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
6 changes: 3 additions & 3 deletions documentation/Property-tracking-capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The feature implements specialized event handling for four tracking scenarios (p
1. `PropertyReassignmentEventArgs`
- Triggered when a property value is changed
- `set MsBuildLogPropertyTracking=1`
- **Note:** Property reassignment tracking is automatically enabled with ChangeWaves.Wave17_10, even when `MsBuildLogPropertyTracking=0`
- **Note:** Property reassignment tracking is enabled by default, even when `MsBuildLogPropertyTracking=0`

2. `PropertyInitialValueSetEventArgs`
- Triggered when a property is first initialized
Expand All @@ -49,6 +49,6 @@ If you want to enable all these events reporting, enable it by `set MsBuildLogPr

Property reassignment tracking has special enabling logic. It is enabled when:
- `PropertyReassignment` flag is explicitly set (value includes `1`), OR
- `MsBuildLogPropertyTracking=0` AND ChangeWaves.Wave17_10 features are enabled
- `MsBuildLogPropertyTracking=0`

This means that in projects with Wave17_10 enabled, property reassignments will be tracked even when property tracking appears to be disabled.
This means that property reassignments will be tracked even when property tracking appears to be disabled.
8 changes: 0 additions & 8 deletions documentation/aot/sdk-resolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ Knobs:
* `MSBUILDADDITIONALSDKRESOLVERSFOLDER` (and `_NET` / `_NETFRAMEWORK` variants) - test hook
that adds an override resolver folder.
* `MSBUILDINCLUDEDEFAULTSDKRESOLVER=false` - drop the built-in default resolver.
* Legacy path: when ChangeWave 17.10 is **disabled**, `SdkResolverService` uses a
non-caching `SdkResolverLoader` and the eager `LoadAllResolvers`, which scans
`MSBuildToolsDirectory32\SdkResolvers` and loads **every** resolver up front. The default
(17.10 enabled) path is manifest-based and lazy via `CachingSdkResolverLoader`.

### 1.3 The built-in fallback resolver

Expand Down Expand Up @@ -319,10 +315,6 @@ through the guard: `SdkResolverLoader.LoadResolverAssembly`, `GetResolverTypes`,
`LoadResolvers`, `LoadResolversFromManifest`, `LoadAllResolvers`, and
`CachingSdkResolverLoader.LoadResolversFromManifest`.

Legacy note: the `LoadAllResolvers` path (only used when ChangeWave 17.10 is disabled) is also
reflective. Either apply the same guard there, or document that disabling Wave17.10 is not part
of the trim-safe contract (the default, caching, manifest-based path is what trims).

### 2.5 Step 4 - the error resource

Add to [src/Build/Resources/Strings.resx](../../src/Build/Resources/Strings.resx) (assigned `MSB4282`;
Expand Down
64 changes: 33 additions & 31 deletions documentation/wiki/ChangeWaves.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,6 @@ Change wave checks around features will be removed in the release that accompani
### 18.4
- [Start throwing on null or empty paths in MultiProcess and MultiThreaded Task Environment Drivers.](https://github.com/dotnet/msbuild/pull/12914)

## Change waves that will be removed in the release accompanying .NET 11

### 18.3
- [Replace Transactional property with ChangeWave control, implement atomic file replacement with retry logic, and update tests.](https://github.com/dotnet/msbuild/pull/12627)

### 17.14
- ~[.SLNX support - use the new parser for .sln and .slnx](https://github.com/dotnet/msbuild/pull/10836)~ reverted after compat problems discovered
- ~~[Support custom culture in RAR](https://github.com/dotnet/msbuild/pull/11000)~~ - see [11607](https://github.com/dotnet/msbuild/pull/11607) for details
- [VS Telemetry](https://github.com/dotnet/msbuild/pull/11255)

### 17.12
- [Log TaskParameterEvent for scalar parameters](https://github.com/dotnet/msbuild/pull/9908)
- [Convert.ToString during a property evaluation uses the InvariantCulture for all types](https://github.com/dotnet/msbuild/pull/9874)
- [Fix oversharing of build results in ResultsCache](https://github.com/dotnet/msbuild/pull/9987)
- [Add ParameterName and PropertyName to TaskParameterEventArgs](https://github.com/dotnet/msbuild/pull/10130)
- [Emit eval props if requested by any sink](https://github.com/dotnet/msbuild/pull/10243)
- [Load Microsoft.DotNet.MSBuildSdkResolver into default load context (MSBuild.exe only)](https://github.com/dotnet/msbuild/pull/10603)

### 17.10
- [AppDomain configuration is serialized without using BinFmt](https://github.com/dotnet/msbuild/pull/9320) - feature can be opted out only if [BinaryFormatter](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter) is allowed at runtime by editing `MSBuild.runtimeconfig.json`. **Please note that [any usage of BinaryFormatter is insecure](https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide).**
- [Warning on serialization custom events by default in .NET framework](https://github.com/dotnet/msbuild/pull/9318)
- [Cache SDK resolver data process-wide](https://github.com/dotnet/msbuild/pull/9335)
- [Target parameters will be unquoted](https://github.com/dotnet/msbuild/pull/9452), meaning the ';' symbol in the parameter target name will always be treated as separator
- [Add Link metadata to Resources in AssignLinkMetadata target](https://github.com/dotnet/msbuild/pull/9464)
- [Change Version switch output to finish with a newline](https://github.com/dotnet/msbuild/pull/9485)
- [Load NuGet.Frameworks into secondary AppDomain (MSBuild.exe only)](https://github.com/dotnet/msbuild/pull/9446)
- [Update Traits when environment has been changed](https://github.com/dotnet/msbuild/pull/9655)
- [Exec task does not trim leading whitespaces for ConsoleOutput](https://github.com/dotnet/msbuild/pull/9722)
- [Introduce [MSBuild]::StableStringHash overloads](https://github.com/dotnet/msbuild/issues/9519)
- [Keep the encoding of standard output & error consistent with the console code page for ToolTask](https://github.com/dotnet/msbuild/pull/9539)

## Change Waves No Longer In Rotation

### 16.8
Expand Down Expand Up @@ -140,3 +109,36 @@ Change wave checks around features will be removed in the release that accompani
- [Delete destination file before copy](https://github.com/dotnet/msbuild/pull/8685)
- [Moving from SHA1 to SHA256 for Hash task](https://github.com/dotnet/msbuild/pull/8812)
- [Deprecating custom derived BuildEventArgs](https://github.com/dotnet/msbuild/pull/8917) - feature can be opted out only if [BinaryFormatter](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter) is allowed at runtime by editing `MSBuild.runtimeconfig.json`

### 17.10

- [AppDomain configuration is serialized without using BinFmt](https://github.com/dotnet/msbuild/pull/9320) - feature can be opted out only if [BinaryFormatter](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter) is allowed at runtime by editing `MSBuild.runtimeconfig.json`. **Please note that [any usage of BinaryFormatter is insecure](https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide).**
- [Warning on serialization custom events by default in .NET framework](https://github.com/dotnet/msbuild/pull/9318)
- [Cache SDK resolver data process-wide](https://github.com/dotnet/msbuild/pull/9335)
- [Target parameters will be unquoted](https://github.com/dotnet/msbuild/pull/9452), meaning the ';' symbol in the parameter target name will always be treated as separator
- [Add Link metadata to Resources in AssignLinkMetadata target](https://github.com/dotnet/msbuild/pull/9464)
- [Change Version switch output to finish with a newline](https://github.com/dotnet/msbuild/pull/9485)
- [Load NuGet.Frameworks into secondary AppDomain (MSBuild.exe only)](https://github.com/dotnet/msbuild/pull/9446)
- [Update Traits when environment has been changed](https://github.com/dotnet/msbuild/pull/9655)
- [Exec task does not trim leading whitespaces for ConsoleOutput](https://github.com/dotnet/msbuild/pull/9722)
- [Introduce [MSBuild]::StableStringHash overloads](https://github.com/dotnet/msbuild/issues/9519)
- [Keep the encoding of standard output & error consistent with the console code page for ToolTask](https://github.com/dotnet/msbuild/pull/9539)

### 17.12

- [Log TaskParameterEvent for scalar parameters](https://github.com/dotnet/msbuild/pull/9908)
- [Convert.ToString during a property evaluation uses the InvariantCulture for all types](https://github.com/dotnet/msbuild/pull/9874)
- [Fix oversharing of build results in ResultsCache](https://github.com/dotnet/msbuild/pull/9987)
- [Add ParameterName and PropertyName to TaskParameterEventArgs](https://github.com/dotnet/msbuild/pull/10130)
- [Emit eval props if requested by any sink](https://github.com/dotnet/msbuild/pull/10243)
- [Load Microsoft.DotNet.MSBuildSdkResolver into default load context (MSBuild.exe only)](https://github.com/dotnet/msbuild/pull/10603)

### 17.14

- ~[.SLNX support - use the new parser for .sln and .slnx](https://github.com/dotnet/msbuild/pull/10836)~ reverted after compat problems discovered
- ~~[Support custom culture in RAR](https://github.com/dotnet/msbuild/pull/11000)~~ - see [11607](https://github.com/dotnet/msbuild/pull/11607) for details
- [VS Telemetry](https://github.com/dotnet/msbuild/pull/11255)

### 18.3

- [Replace Transactional property with ChangeWave control, implement atomic file replacement with retry logic, and update tests.](https://github.com/dotnet/msbuild/pull/12627)
1 change: 0 additions & 1 deletion documentation/wiki/Results-Cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ MSBuild uses caching to speed up builds. It does this by remembering the outcome
### How `BuildRequestDataFlags` Affect Caching

When MSBuild decides to build something, the request (`BuildRequest`) carries special instructions called `BuildRequestDataFlags`. These flags tell MSBuild *how* to perform the build and *what kind of result* is expected. The `ResultsCache` pays close attention to these flags because they are crucial for determining if a cached outcome is truly a match for a new request.
It's an out-in feature that can be disabled with change wave `17.12`. See more details in [ChangeWaves.md](ChangeWaves.md)

Here's how some important flags interact with caching:

Expand Down
24 changes: 24 additions & 0 deletions eng/BootStrapMsBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,30 @@
<Copy SourceFiles="@(FreshlyBuiltNetBinaries)"
DestinationFiles="@(FreshlyBuiltNetBinaries->'$(InstallDir)sdk\$(BootstrapSdkVersion)\%(RecursiveDir)%(Filename)%(Extension)')" />

<!--
The .NET SDK layout keeps some of MSBuild's own props/targets under sdk\<ver>\Current\ rather than at the
SDK root, because they are imported through $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\... and
$(MSBuildToolsVersion) is "Current" there. Microsoft.Common.props is the notable one: it exists *only*
under Current\, and Microsoft.NET.Sdk's Sdk.props imports it from that path for every SDK-style project.

Our build output has no Current\ subdirectory, so the overlay above lands those files at the SDK root only
and leaves the acquired SDK's copies - belonging to whatever older MSBuild it shipped with - in place. Every
bootstrap build then silently evaluates the stale file, so changes to src\Tasks\Microsoft.Common.props never
take effect in bootstrap-based tests.

Overlay our freshly-built copy of any file the acquired SDK keeps in Current\. Directories under Current\
(the Microsoft.Common.targets\ImportAfter\ style extension points) are not matched by the glob and are
correctly left alone.
-->
<ItemGroup>
<_AcquiredSdkCurrentFile Include="$(InstallDir)sdk\$(BootstrapSdkVersion)\Current\*.*" />
<_FreshlyBuiltCurrentFile Include="$(OutDir)%(_AcquiredSdkCurrentFile.Filename)%(_AcquiredSdkCurrentFile.Extension)"
Condition="Exists('$(OutDir)%(_AcquiredSdkCurrentFile.Filename)%(_AcquiredSdkCurrentFile.Extension)')" />
</ItemGroup>

<Copy SourceFiles="@(_FreshlyBuiltCurrentFile)"
DestinationFolder="$(InstallDir)sdk\$(BootstrapSdkVersion)\Current" />

<!--
MSBuild can target an earlier .NET runtime than the SDK we overlay it onto.
In that case the freshly-built *.runtimeconfig.json files pin Microsoft.NETCore.App to a runtime version
Expand Down
12 changes: 2 additions & 10 deletions src/Build.UnitTests/BinaryLogger_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -813,17 +813,9 @@ public void ParseParametersTests(string parametersString, string expectedLogFile
[InlineData("LogFile={}.binlog")] // Wildcard with LogFile= prefix
public void ParseParameters_WildcardPath_ReturnsNullPath(string parametersString)
{
using (TestEnvironment env = TestEnvironment.Create())
{
// Enable Wave17_12 to support wildcard parameters
ChangeWaves.ResetStateForTests();
env.SetEnvironmentVariable("MSBUILDDISABLEFEATURESFROMVERSION", "");
BuildEnvironmentHelper.ResetInstance_ForUnitTestsOnly();

var result = BinaryLogger.ParseParameters(parametersString);
var result = BinaryLogger.ParseParameters(parametersString);

result.LogFilePath.ShouldBeNull();
}
result.LogFilePath.ShouldBeNull();

// Create the expected log file to satisfy test environment expectations
File.Create(_logFile).Dispose();
Expand Down
59 changes: 0 additions & 59 deletions src/Build.UnitTests/Evaluation/Expander_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5190,53 +5190,6 @@ public void ExpandItem_ConvertToStringUsingInvariantCultureForNumberData()
}
}

[Fact]
public void ExpandItem_ConvertToStringUsingInvariantCultureForNumberData_RespectingChangeWave()
{
// Note: Skipping the test since it is not a valid scenario when ICU mode is not used.
if (!ICUModeAvailable())
{
return;
}

var currentThread = Thread.CurrentThread;
var originalCulture = currentThread.CurrentCulture;
var originalUICulture = currentThread.CurrentUICulture;

try
{
var svSECultureInfo = new CultureInfo("sv-SE");
using (var env = TestEnvironment.Create())
{
env.SetEnvironmentVariable("MSBUILDDISABLEFEATURESFROMVERSION", ChangeWaves.Wave17_12.ToString());
ChangeWaves.ResetStateForTests();
currentThread.CurrentCulture = svSECultureInfo;
currentThread.CurrentUICulture = svSECultureInfo;
var root = env.CreateFolder();

var projectFile = env.CreateFile(root, ".proj",
@"<Project>

<PropertyGroup>
<_value>$([MSBuild]::Subtract(0, 1))</_value>
<_otherValue Condition=""'$(_value)' &gt;= -1"">test-value</_otherValue>
</PropertyGroup>
<Target Name=""Build"" />
</Project>");
var exception = Should.Throw<InvalidProjectFileException>(() =>
{
new ProjectInstance(projectFile.Path);
});
exception.BaseMessage.ShouldContain("A numeric comparison was attempted on \"$(_value)\"");
}
}
finally
{
currentThread.CurrentCulture = originalCulture;
currentThread.CurrentUICulture = originalUICulture;
}
}

[Theory]
[InlineData("getType")]
[InlineData("GetType")]
Expand Down Expand Up @@ -5346,18 +5299,6 @@ public void FastPathValidationTest(string methodInvocationMetadata)
}
}

/// <summary>
/// Determines if ICU mode is enabled.
/// Copied from: https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu#determine-if-your-app-is-using-icu
/// </summary>
private static bool ICUModeAvailable()
{
SortVersion sortVersion = CultureInfo.InvariantCulture.CompareInfo.Version;
byte[] bytes = sortVersion.SortId.ToByteArray();
int version = bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
return version != 0 && version == sortVersion.FullVersion;
}

[Fact]
public void PropertyFunctionRegisterBuildCheck()
{
Expand Down
6 changes: 1 addition & 5 deletions src/Build/BackEnd/Components/Caching/ResultsCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;

#nullable disable

Expand Down Expand Up @@ -168,10 +167,7 @@ public ResultsCacheResponse SatisfyRequest(BuildRequest request, List<string> co
{
if (_resultsByConfiguration.TryGetValue(request.ConfigurationId, out BuildResult allResults))
{
bool buildDataFlagsSatisfied = ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave17_12)
? AreBuildResultFlagsCompatible(request, allResults) : true;

if (buildDataFlagsSatisfied)
if (AreBuildResultFlagsCompatible(request, allResults))
{
// Check for targets explicitly specified.
bool explicitTargetsSatisfied = CheckResults(allResults, request.Targets, checkTargetsMissingResults: true, skippedResultsDoNotCauseCacheMiss);
Expand Down
24 changes: 7 additions & 17 deletions src/Build/BackEnd/Components/Logging/LoggingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,23 +612,13 @@ private void InferEvalDataBehavior()
{
var sinks = _eventSinkDictionary.Values.OfType<EventSourceSink>().ToList();

if (ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave17_12))
{
// If any logger requested the data - we need to emit them
IncludeEvaluationPropertiesAndItemsInEvaluationFinishedEvent =
sinks.Any(sink => sink.IncludeEvaluationPropertiesAndItems);
// If any logger didn't request the data - hence it's likely legacy logger
// - we need to populate the data in legacy way
IncludeEvaluationPropertiesAndItemsInProjectStartedEvent =
sinks.Any(sink => !sink.IncludeEvaluationPropertiesAndItems);
}
else
{
bool allSinksIncludeEvalData = sinks.Any() && sinks.All(sink => sink.IncludeEvaluationPropertiesAndItems);

IncludeEvaluationPropertiesAndItemsInEvaluationFinishedEvent = allSinksIncludeEvalData;
IncludeEvaluationPropertiesAndItemsInProjectStartedEvent = !allSinksIncludeEvalData;
}
// If any logger requested the data - we need to emit them
IncludeEvaluationPropertiesAndItemsInEvaluationFinishedEvent =
sinks.Any(sink => sink.IncludeEvaluationPropertiesAndItems);
// If any logger didn't request the data - hence it's likely legacy logger
// - we need to populate the data in legacy way
IncludeEvaluationPropertiesAndItemsInProjectStartedEvent =
sinks.Any(sink => !sink.IncludeEvaluationPropertiesAndItems);
}
}

Expand Down
Loading