Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Razor Tag Helper repro — SDK 10.0.400 regression

Minimal repro for a Razor Tag Helper compilation bug on Linux publish builds using .NET SDK 10.0.400.

Symptom

When a @section block (rendered via @RenderSection in _Layout.cshtml) contains more than one element that needs Tag Helper processing (e.g. ~/-prefixed href values, asp-append-version), only the first element is processed correctly. Every element after it is emitted as literal, unprocessed markup — no build error or warning.

@section head {
    <link rel="stylesheet" href="~/css/one.css" asp-append-version="true">
    <link rel="stylesheet" href="~/css/two.css" asp-append-version="true">
}

Expected (both resolved):

<link rel="stylesheet" href="/css/one.css?v=xxxxx">
<link rel="stylesheet" href="/css/two.css?v=yyyyy">

Actual on affected SDK (second element untouched):

<link rel="stylesheet" href="/css/one.css?v=xxxxx">
<link rel="stylesheet" href="~/css/two.css" asp-append-version="true">

Bisection

SDK version Feature band Result
10.0.302 3xx ✅ works
10.0.303 3xx ✅ works
10.0.400 4xx ❌ broken

All three share runtime 10.0.11. Only reproduces on Linux builds — not reproducible building/running the same source on Windows.

How to reproduce

global.json at the repo root pins the SDK version tested. Edit the version field to switch between a known-good and known-bad SDK, e.g.:

{
  "sdk": {
    "version": "10.0.302",
    "rollForward": "disable"
  }
}

Then, on a Linux machine/agent/container with that SDK installed:

dotnet publish -c Release -o out
cd out
ASPNETCORE_URLS=http://localhost:5000 dotnet RazorTagHelperRepro.dll

In another terminal:

curl -s http://localhost:5000/ | grep -A1 "css/one.css"

Or open http://localhost:5000 in a browser and view source.

Using Docker (no local SDK install needed)

# Known-good (edit global.json to 10.0.302 first)
docker run --rm -v "$PWD":/src -w /src mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c "dotnet publish -c Release -o /tmp/out && cd /tmp/out && \
         ASPNETCORE_URLS=http://0.0.0.0:8080 dotnet RazorTagHelperRepro.dll & \
         sleep 3 && curl -s http://localhost:8080/ | grep -A1 'css/one.css'"

Repeat with global.json set to 10.0.400 to see the second <link> tag fail to resolve.

Environment where this was first observed

  • Azure DevOps, Microsoft-hosted ubuntu-latest agent
  • UseDotNet@2 task with a floating 10.x version specifier, which silently picked up 10.0.400 after previously resolving 10.0.302
  • ASP.NET Core MVC, multi-project solution, view rendered through _Layout.cshtml via @RenderSection("head", required: false)

This minimal repro strips away the multi-project/shared-static-file specifics of the original app — the bug reproduces with plain files in wwwroot and no custom MSBuild targets involved.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages