Skip to content

sm new project: scaffold references /favicon.svg but ships none → 404 #225

Closed

Description

@antosubash

Summary

A fresh sm new project scaffold references a favicon that it doesn't ship, producing a 404 on every page.

Details

  • The host Program.cs maps /favicon.ico to wwwroot/favicon.svg:
    app.MapGet("/favicon.ico", (IWebHostEnvironment env) =>
        Results.File(Path.Combine(env.WebRootPath, "favicon.svg"), "image/svg+xml"))
        .ExcludeFromDescription().AllowAnonymous();
  • The rendered HTML shell links <link rel="icon" type="image/svg+xml" href="/favicon.svg">.
  • But no favicon.svg exists under wwwroot/, so both requests 404.

Actual

GET /favicon.svg 404 (Not Found)

Suggested fix

Ship a default wwwroot/favicon.svg in the scaffold.

Severity

Low.

Environment

  • sm CLI 0.0.37, .NET SDK 10.0.202, Linux.

Activity

  1. antosubash commented on Jun 3, 2026

    @antosubash
    OwnerAuthor

    Correction: in practice this is a 500, not a 404 — Program.cs maps /favicon.ico to Results.File(Path.Combine(env.WebRootPath, "favicon.svg"), ...), and Results.File throws System.IO.FileNotFoundException when the file is missing, which the global exception handler turns into a 500 on every /favicon.ico request (and the shell's <link rel=icon href=/favicon.svg> 404s separately).

  2. antosubash commented on Jun 3, 2026

    @antosubash
    OwnerAuthor

    Fixed in #231 (merged db8be0e). Verified the fix is present on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcli

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions