Repository navigation
Milestone
Description
Describe the bug
MSTest.Sdk generate two source files at build time: MicrosoftTestingPlatformEntryPoint.cs and SelfRegisteredExtensions.cs.
Invalidation cache keys for this source files:
Lines 123 to 150 in fd74476
| <Target Name="_GenerateTestingPlatformEntryPointFileInputCache" DependsOnTargets="_CalculateGenerateTestingPlatformEntryPoint"> | |
| <PropertyGroup> | |
| <!-- Cache file to check --> | |
| <_GenerateTestingPlatformEntryPointInputsCachFilePath>$(IntermediateOutputPath)$(MSBuildProjectName).gentestingplatformentrypointinputcache.cache</_GenerateTestingPlatformEntryPointInputsCachFilePath> | |
| <_GenerateTestingPlatformEntryPointInputsCachFilePath>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(_GenerateTestingPlatformEntryPointInputsCachFilePath)))</_GenerateTestingPlatformEntryPointInputsCachFilePath> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <!-- Items to hash--> | |
| <_GenerateTestingPlatformEntryPointInputsCacheToHash Include="@(TestingPlatformBuilderHook)"/> | |
| <_GenerateTestingPlatformEntryPointInputsCacheToHash Include="$(RootNamespace)"/> | |
| <_GenerateTestingPlatformEntryPointInputsCacheToHash Include="$(GenerateTestingPlatformEntryPoint)" /> | |
| <!-- Export the items name for the _GenerateTestingPlatformInjectEntryPoint task--> | |
| <GenerateTestingPlatformEntryPointInputsCacheFilePath Include="$(_GenerateTestingPlatformEntryPointInputsCachFilePath)" /> | |
| </ItemGroup> | |
| <!-- Hash the extensions information --> | |
| <Hash ItemsToHash="@(_GenerateTestingPlatformEntryPointInputsCacheToHash)"> | |
| <Output TaskParameter="HashResult" PropertyName="_GenerateTestingPlatformEntryPointInputsCache" /> | |
| </Hash> | |
| <!-- Write the hash value to the cache file --> | |
| <WriteLinesToFile Lines="$(_GenerateTestingPlatformEntryPointInputsCache)" | |
| File="$(_GenerateTestingPlatformEntryPointInputsCachFilePath)" | |
| Overwrite="true" | |
| WriteOnlyWhenDifferent="true" /> | |
| <ItemGroup> | |
| <FileWrites Include="$(_GenerateTestingPlatformEntryPointInputsCachFilePath)" /> | |
| </ItemGroup> | |
| </Target> |
Lines 216 to 243 in fd74476
| <Target Name="_GenerateSelfRegisteredExtensionsFileInputCache" DependsOnTargets="_CalculateGenerateSelfRegisteredExtensions"> | |
| <PropertyGroup> | |
| <!-- Cache file to check --> | |
| <_GenerateSelfRegisteredExtensionsInputsCachFilePath>$(IntermediateOutputPath)$(MSBuildProjectName).genautoregisteredextensionsinputcache.cache</_GenerateSelfRegisteredExtensionsInputsCachFilePath> | |
| <_GenerateSelfRegisteredExtensionsInputsCachFilePath>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(_GenerateSelfRegisteredExtensionsInputsCachFilePath)))</_GenerateSelfRegisteredExtensionsInputsCachFilePath> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <!-- Items to hash--> | |
| <_GenerateSelfRegisteredExtensionsInputsCacheToHash Include="@(TestingPlatformBuilderHook)"/> | |
| <_GenerateSelfRegisteredExtensionsInputsCacheToHash Include="$(RootNamespace)"/> | |
| <_GenerateSelfRegisteredExtensionsInputsCacheToHash Include="$(GenerateSelfRegisteredExtensions)"/> | |
| <!-- Export the items name for the _GenerateSelfRegisteredExtensions task--> | |
| <GenerateSelfRegisteredExtensionsInputsCacheFilePath Include="$(_GenerateSelfRegisteredExtensionsInputsCachFilePath)" /> | |
| </ItemGroup> | |
| <!-- Hash the extensions information --> | |
| <Hash ItemsToHash="@(_GenerateSelfRegisteredExtensionsInputsCacheToHash)"> | |
| <Output TaskParameter="HashResult" PropertyName="_GenerateSelfRegisteredExtensionsInputsCache" /> | |
| </Hash> | |
| <!-- Write the hash value to the cache file --> | |
| <WriteLinesToFile Lines="$(_GenerateSelfRegisteredExtensionsInputsCache)" | |
| File="$(_GenerateSelfRegisteredExtensionsInputsCachFilePath)" | |
| Overwrite="true" | |
| WriteOnlyWhenDifferent="true" /> | |
| <ItemGroup> | |
| <FileWrites Include="$(_GenerateSelfRegisteredExtensionsInputsCachFilePath)" /> | |
| </ItemGroup> | |
| </Target> |
Do not include generator own version, thus them not invalidated and regenerated after SDK update.
Version used
.NET SDK: 10.0.302
MSTest.Sdk: 4.3.2 and 4.2.3
Steps To Reproduce
Create empty project:
<Project Sdk="MSTest.Sdk/4.2.3">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
</Project>Build project.
Inspect content of (point 1):
- obj\Debug\net10.0\MicrosoftTestingPlatformEntryPoint.cs
- obj\Debug\net10.0\SelfRegisteredExtensions.cs
Update project:
<Project Sdk="MSTest.Sdk/4.3.2">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
</Project>Build project.
Inspect content of the same files (point 2).
Delete this files.
Build project.
Inspect content of the same files (point 3).
Expected behavior
Point 1:
MicrosoftTestingPlatformEntryPoint.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MicrosoftTestingPlatformEntryPoint
{
public static async global::System.Threading.Tasks.Task<int> Main(string[] args)
{
global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder = await global::Microsoft.Testing.Platform.Builder.TestApplication.CreateBuilderAsync(args);
SelfRegisteredExtensions.AddSelfRegisteredExtensions(builder, args);
using (global::Microsoft.Testing.Platform.Builder.ITestApplication app = await builder.BuildAsync())
{
return await app.RunAsync();
}
}
}
}SelfRegisteredExtensions.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static class SelfRegisteredExtensions
{
public static void AddSelfRegisteredExtensions(this global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder, string[] args)
{
global::Microsoft.Testing.Platform.MSBuild.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.Telemetry.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.VisualStudio.TestTools.UnitTesting.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.TrxReport.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.CodeCoverage.TestingPlatformBuilderHook.AddExtensions(builder, args);
}
}
}MicrosoftTestingPlatformEntryPoint.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MicrosoftTestingPlatformEntryPoint
{
public static async global::System.Threading.Tasks.Task<int> Main(string[] args)
{
global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder = await global::Microsoft.Testing.Platform.Builder.TestApplication.CreateBuilderAsync(args);
global::Test.SelfRegisteredExtensions.AddSelfRegisteredExtensions(builder, args);
using (global::Microsoft.Testing.Platform.Builder.ITestApplication app = await builder.BuildAsync())
{
return await app.RunAsync();
}
}
}
}SelfRegisteredExtensions.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::Microsoft.CodeAnalysis.Embedded]
internal static class SelfRegisteredExtensions
{
public static void AddSelfRegisteredExtensions(this global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder, string[] args)
{
global::Microsoft.Testing.Platform.MSBuild.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.Telemetry.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.VisualStudio.TestTools.UnitTesting.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.TrxReport.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.CodeCoverage.TestingPlatformBuilderHook.AddExtensions(builder, args);
}
}
}
namespace Microsoft.CodeAnalysis
{
internal sealed partial class EmbeddedAttribute : global::System.Attribute
{
}
}Actual behavior
Point 1:
MicrosoftTestingPlatformEntryPoint.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MicrosoftTestingPlatformEntryPoint
{
public static async global::System.Threading.Tasks.Task<int> Main(string[] args)
{
global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder = await global::Microsoft.Testing.Platform.Builder.TestApplication.CreateBuilderAsync(args);
SelfRegisteredExtensions.AddSelfRegisteredExtensions(builder, args);
using (global::Microsoft.Testing.Platform.Builder.ITestApplication app = await builder.BuildAsync())
{
return await app.RunAsync();
}
}
}
}SelfRegisteredExtensions.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static class SelfRegisteredExtensions
{
public static void AddSelfRegisteredExtensions(this global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder, string[] args)
{
global::Microsoft.Testing.Platform.MSBuild.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.Telemetry.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.VisualStudio.TestTools.UnitTesting.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.TrxReport.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.CodeCoverage.TestingPlatformBuilderHook.AddExtensions(builder, args);
}
}
}Point 3:
MicrosoftTestingPlatformEntryPoint.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MicrosoftTestingPlatformEntryPoint
{
public static async global::System.Threading.Tasks.Task<int> Main(string[] args)
{
global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder = await global::Microsoft.Testing.Platform.Builder.TestApplication.CreateBuilderAsync(args);
global::Test.SelfRegisteredExtensions.AddSelfRegisteredExtensions(builder, args);
using (global::Microsoft.Testing.Platform.Builder.ITestApplication app = await builder.BuildAsync())
{
return await app.RunAsync();
}
}
}
}SelfRegisteredExtensions.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Microsoft.Testing.Platform.MSBuild
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test
{
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::Microsoft.CodeAnalysis.Embedded]
internal static class SelfRegisteredExtensions
{
public static void AddSelfRegisteredExtensions(this global::Microsoft.Testing.Platform.Builder.ITestApplicationBuilder builder, string[] args)
{
global::Microsoft.Testing.Platform.MSBuild.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.Telemetry.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.VisualStudio.TestTools.UnitTesting.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.TrxReport.TestingPlatformBuilderHook.AddExtensions(builder, args);
global::Microsoft.Testing.Extensions.CodeCoverage.TestingPlatformBuilderHook.AddExtensions(builder, args);
}
}
}
namespace Microsoft.CodeAnalysis
{
internal sealed partial class EmbeddedAttribute : global::System.Attribute
{
}
}Metadata
Metadata
Assignees
Labels
No labels
Activity