Skip to content

Remove vestigial test_templates at sdk's old TemplateEngine.TestTemplates path - #6594

Merged
dsplaisted merged 1 commit into
dotnet:mainfrom
dsplaisted:cleanup-old-test-templates
May 14, 2026
Merged

dsplaisted merged 1 commit into
dotnet:mainfrom
dsplaisted:cleanup-old-test-templates

Conversation

@dsplaisted

Copy link
Copy Markdown
Member

Summary

Remove the unreferenced src/sdk/test/TemplateEngine/Microsoft.TemplateEngine.TestTemplates/ directory from the VMR. These files are leftovers from when dotnet/templating was forward-flowing into the VMR and the test templates lived at that path in dotnet/sdk.

Background

  • dotnet/sdk PR #53733 (merged 2026-04-07 by @MichaelSimons) moved the test template fixtures from test/TemplateEngine/Microsoft.TemplateEngine.TestTemplates/ to test/TestAssets/TestPackages/TemplateEngine/.
  • dotnet/templating has since been consolidated into dotnet/sdk (README + default branch now archive) and is no longer in src/source-manifest.json.
  • The VMR's copy of the sdk source mirrored the new location but never deleted the old-location files. They're now vestigial.

Why this matters

Both sdk.slnx and TemplateEngine.slnf reference only the new location (test/TestAssets/TestPackages/...). The old-location files are unreferenced inside the VMR.

But every backflow from this VMR to dotnet/sdk re-introduces them in dotnet/sdk (because dotnet/sdk's main no longer has them after #53733). The duplicated content then gets picked up by test/UnitTests.proj's **\*.Tests.csproj glob, which only excludes TestAssets\**\*.Tests.csproj — not the old path. Result on every codeflow PR: NETSDK1138 (net7.0 EOL) and NU1008 (inline Version + CPM) on MyTestProject.Tests.csproj. Blocked dotnet/sdk PR #54292.

Deleting the old path here makes future backflows clean and removes the recurring failure.

What this PR does

git rm -r src/sdk/test/TemplateEngine/Microsoft.TemplateEngine.TestTemplates/ — 324 files, 6193 deletions, no additions.

I verified there are no references to this path anywhere in the VMR (only the NEW location is referenced in sdk.slnx / TemplateEngine.slnf).

cc @MichaelSimons @marcpopMSFT

…ates path

dotnet/sdk PR #53733 (merged 2026-04-07) moved test template fixtures from
test/TemplateEngine/Microsoft.TemplateEngine.TestTemplates/ to
test/TestAssets/TestPackages/TemplateEngine/. The VMR's copy of the sdk
source mirrored the new location but the old-location files were never
deleted from the VMR -- they were originally populated by forward flow from
dotnet/templating, which has since been consolidated into dotnet/sdk and is
no longer in src/source-manifest.json.

These leftover files are unreferenced by sdk.slnx and TemplateEngine.slnf
(both point exclusively at the new TestAssets/TestPackages location), but
every backflow from VMR to sdk re-introduces them in dotnet/sdk because
they don't exist there anymore. The duplicated content then trips
test/UnitTests.proj's `**\*.Tests.csproj` glob, causing NETSDK1138 (net7.0
EOL) and NU1008 (inline Version + CPM) on MyTestProject.Tests.csproj --
broke dotnet/sdk PR #54292 build.

Delete the unreferenced old-location files so future backflows are clean.
Copilot AI review requested due to automatic review settings May 13, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team May 13, 2026 17:21
dsplaisted added a commit to dotnet/sdk that referenced this pull request May 13, 2026
PR #53733 moved test templates to test/TestAssets/TestPackages/TemplateEngine/.
This codeflow re-introduces the old location from the VMR, which still has
leftover files from when dotnet/templating was flowing in (now consolidated).

The old-location files are unreferenced by sdk.slnx / TemplateEngine.slnf but
get picked up by test/UnitTests.proj's `**\*.Tests.csproj` glob, causing
NETSDK1138 (net7.0 EOL) and NU1008 (inline Version + CPM) on
MyTestProject.Tests.csproj.

Companion VMR cleanup: dotnet/dotnet#6594. Once that merges, future
codeflow PRs won't re-introduce these files.
@marcpopMSFT

Copy link
Copy Markdown
Member

CC @premun as it feels weird that this is needed to keep the vmr from bringing the files back during codeflow.

@dsplaisted
dsplaisted merged commit 88f54a2 into dotnet:main May 14, 2026
11 checks passed
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team May 14, 2026 01:57
@premun

premun commented May 14, 2026

Copy link
Copy Markdown
Member

We will have a look. I think someone recently reverted an SDK flow in the VMR so this might be an unwanted outcome

@premun

premun commented May 15, 2026

Copy link
Copy Markdown
Member

@marcpopMSFT we've started seeing some weirdness after Monday's rollout. Will roll back and investigate

dotnet-maestro Bot added a commit to dotnet/sdk that referenced this pull request May 18, 2026
[main] Source code updates from dotnet/dotnet


 - Update generated file

Cherry-picked from 043321b (old codeflow PR #53847).
Changes test class name reference and removes MetadataUpdater.IsSupported entry.

Co-authored-by: Copilot <[email protected]>

 - Update compiler error code in a test

Cherry-picked from 84f3119 (old codeflow PR #53847).
Updates CS1040 -> CS9378 for shebang-related compiler error.

Co-authored-by: Copilot <[email protected]>

 - Remove vestigial test_templates at old TemplateEngine.TestTemplates path

PR #53733 moved test templates to test/TestAssets/TestPackages/TemplateEngine/.
This codeflow re-introduces the old location from the VMR, which still has
leftover files from when dotnet/templating was flowing in (now consolidated).

The old-location files are unreferenced by sdk.slnx / TemplateEngine.slnf but
get picked up by test/UnitTests.proj's `**\*.Tests.csproj` glob, causing
NETSDK1138 (net7.0 EOL) and NU1008 (inline Version + CPM) on
MyTestProject.Tests.csproj.

Companion VMR cleanup: dotnet/dotnet#6594. Once that merges, future
codeflow PRs won't re-introduce these files.

 - Containers SanityTest: remove Microsoft.Extensions.Logging.Abstractions

The codeflow backflow commit dropped Microsoft.Extensions.Logging.Abstractions
from Microsoft.NET.Build.Containers.csproj (it''s transitively pulled in via
Microsoft.Extensions.Logging and doesn''t need to be redistributed). Update
the SanityTest_NET_Build_ContainersDependencies known list to match.

 - dotnet-new: update verified baselines for template changes

The codeflow brought in template changes that affect the output of
`dotnet new` template-listing commands:
- Added: blazor-wasm-servicedefaults, blazorwebworker
- Removed: webworker (renamed to blazorwebworker)

Update the .verified.txt baseline files for the affected tests on all
three OS platforms:
- DotnetNewCompleteTests.CanDoTabCompletion
- DotnetNewListTests.BasicTest_WhenListCommandIsUsed
- DotnetNewListTests.BasicTest_WhenLegacyCommandIsUsed

 - Blazor: regenerate StaticWebAssets baselines for new framework assemblies

The codeflow brought in AspNetCore changes that include the following
Microsoft.Extensions.* abstraction assemblies in the published Blazor wasm
output where they previously were not:
- Microsoft.Extensions.Configuration.Abstractions
- Microsoft.Extensions.DependencyInjection.Abstractions
- Microsoft.Extensions.FileProviders.Abstractions
- Microsoft.Extensions.Logging.Abstractions
- Microsoft.Extensions.Options
- Microsoft.Extensions.Primitives

Regenerated baselines via:
  dotnet exec Microsoft.NET.Sdk.BlazorWebAssembly.Tests.dll -trait "AspNetCore=BaselineTest"
with environment variable ASPNETCORE_TEST_BASELINES=true.

 - test: include working-dir tail in Helix binlog upload name

When tests run in Helix, every test that uses ExecuteCommand/CreateBuildCommand
writes a relative-path binlog (e.g. `msbuild0.binlog`) to its per-test working
directory. The upload step in TestCommand.Execute() copies those binlogs to
HELIX_WORKITEM_UPLOAD_ROOT using only Path.GetFileName, so multiple tests in
the same Helix work item all collide on the same upload name and overwrite
each other; only the last test's binlog actually gets uploaded.

Prefix the destination filename with the last two segments of the test's
working directory (typically `<TestInstance>---<GUID>-<ProjectDir>`) so each
test's binlog lands at a unique upload path and we can correlate failures with
their binlogs.

Co-authored-by: Copilot <[email protected]>

 - test: fix race where InitSdkVersion temporarily nulls FullFrameworkMSBuildPath on shared singleton

Background: ToolsetInfo is a process-wide singleton accessed by all xUnit tests.
InitSdkVersion runs `dotnet --version` to discover the SDK version, and to
avoid recursing back into itself via AddTestEnvironmentVariables -> SdkVersion,
it temporarily nulls FullFrameworkMSBuildPath on the singleton while the
subprocess runs.

When tests run in parallel (which the new TestPlatform/xUnit-v3 dispatch is
more aggressive about than the previous version), another test thread that
hits ToolsetInfo.CreateCommand during that window reads the transient null,
treats ShouldUseFullFrameworkMSBuild as false, and silently invokes `dotnet
msbuild` (Core MSBuild) instead of the desktop MSBuild that the FullFramework
test leg requested.

Observed regression: `GivenThatWeWantToBuildWithGlobalJson.It_fails_build_on_failed_sdk_resolution(runningInVS: True)`
fails on the FullFramework leg because the Microsoft.DotNet.MSBuildSdkResolver
(loaded via MSBUILDADDITIONALSDKRESOLVERSFOLDER_NETFRAMEWORK, which Core
MSBuild doesn't read) is not loaded, so the expected
`warning : Unable to locate the .NET SDK` is never emitted. Confirmed against
the latest PR build (Core MSBuild 18.8.0-preview-26261-101 + MSBuildRuntimeType=Core)
vs. recent main build 1417464 (Desktop MSBuild 18.6.1 + MSBuildRuntimeType=Full).

Fix: replace the mutation of the shared FullFrameworkMSBuildPath with a
[ThreadStatic] suppression flag. InitSdkVersion sets the flag for its own
thread (preserving the recursion break for its DotnetCommand subprocess) but
no longer perturbs the property other test threads observe. A private
EffectiveFullFrameworkMSBuildPath helper returns null when the per-thread flag
is set, otherwise the real value; CreateCommand and AddTestEnvironmentVariables
now consult Effective* so the suppress thread breaks recursion as before while
parallel test threads continue to see the real desktop MSBuild path.

Co-authored-by: Copilot <[email protected]>

 - dotnet-new: bump AddPackageReference template Newtonsoft.Json version to 13.0.4

The Newtonsoft.Json package version was bumped from 13.0.3 to 13.0.4 in
eng/Versions.props (commit 1599541, "Update Newtonsoft.Json to 13.0.4 to
fix NU1109"). The corresponding test template still hardcoded 13.0.3, causing
three tests to fail:

- PostActionTests.AddPackageReference_Basic
- PostActionTests.AddPackageReference_Basic_Approval
- PostActionTests.ItCanCreateTemplate_WithAddPackageReference

The first two tests assert via HaveStdOutContaining($"Adding a package
reference Newtonsoft.Json (version: {ToolsetInfo.GetNewtonsoftJsonPackageVersion()})"),
which expects the SDK-side version (13.0.4) but gets the template's hardcoded
13.0.3 in the CLI output. The Approval variant additionally relies on a regex
scrubber anchored on the same "(version: <SDK Newtonsoft version>)" text, so
the callback output isn't scrubbed when the versions mismatch.

Bump the hardcoded version in both templates (Basic and BasicWithFiles) and
update the three verified.txt files (Windows/Linux/OSX). This mirrors the
precedent from commit b1dd035 (dotnet/templating@d845c2d8, Sep 2023),
which made the equivalent 13.0.1 -> 13.0.3 update when eng/Versions.props was
bumped earlier.

Co-authored-by: Copilot <[email protected]>

 - Don't expect wasm files in build output

 - dotnet-new: bump dotnet-new test_templates Newtonsoft.Json version to 13.0.4

The previous commit (071fdbb) bumped the TemplateEngine variants of the
AddPackageReference test templates to 13.0.4 but missed the dotnet-new variants
under test/TestAssets/TestPackages/dotnet-new/test_templates/, which are the
ones actually consumed by the failing dotnet-new.IntegrationTests:

  - PostActionTests.AddPackageReference_Basic
  - PostActionTests.AddPackageReference_Basic_Approval
  - PostActionTests.ItCanCreateTemplate_WithAddPackageReference

These tests assert via HaveStdOutContaining(\$"Adding a package reference
Newtonsoft.Json (version: {ToolsetInfo.GetNewtonsoftJsonPackageVersion()})"),
which expects the SDK-side 13.0.4 but received the template's hardcoded
13.0.3. The Approval variant additionally has a ScrubByRegex anchored on the
same "(version: <SDK Newtonsoft version>)" text, so the NuGet callback output
(including the two new `X.509 certificate chain validation will use the
fallback certificate bundle` info lines from NuGet 7.7) goes unscrubbed when
the versions mismatch.

Bump the three dotnet-new template.json files to match.

Co-authored-by: Copilot <[email protected]>

 - dotnet-watch tests: send 'a' after rename in RenameSourceFile to dismiss rude-edit prompt

SourceFileUpdateTests.RenameSourceFile(useMove: False) intermittently hangs on
Windows for 60 minutes (until the hang collector fires). Roslyn's EnC analyzer
classifies the delete-of-Foo.cs + add-of-Renamed.cs (same class content) as a
rude edit (ENC0033 `Deleting class 'Lib' requires restarting the application'')
some of the time -- whether it does depends on file-watcher event timing
(whether the delete and add events arrive close enough for Roslyn to coalesce
them into a rename vs. seeing two separate edits).

When the rude edit fires, dotnet-watch displays an interactive restart prompt
because the test launches `dotnet watch -bl'' without --non-interactive, without
DOTNET_WATCH_RESTART_ON_RUDE_EDIT, and without TestFlags.ReadKeyFromStdin. The
prompt's RestartPrompt.WaitForRestartConfirmationAsync blocks reading stdin,
the test process keeps printing `> Foo.cs'' forever, and AssertOutputLineStartsWith
`> Renamed.cs'' times out.

Observed twice on PR #54292:
- Build 1423147: TestBuild win-x64, dotnet-watch.Tests.dll.11
- Build 1424609: FullFramework win-x64, dotnet-watch.Tests.dll.6
(Each run hits at most one of the two Windows legs because the test shards
differently between TestBuild and FullFramework.)

Fix: opt into TestFlags.ReadKeyFromStdin and send 'a' (always restart) after
the rename. This matches the pattern used by AutoRestartTests, BrowserTests,
AspireHotReloadTests, MauiHotReloadTests, etc., and unblocks the test whether
Roslyn classifies the change as a rude edit or not.

The underlying inconsistency in Roslyn's EnC classification is worth a separate
investigation by @dotnet/roslyn-ide, but is not addressed here.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants