Skip to content

MapStaticAssets crashes entire app due inconsistent appsettings #62444

Open
@abraluve

Description

@abraluve

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I found out this interesting bug - using

app.MapStaticAssets()

shown after certain changes blank page on dev server. I figured out commenting this line would make dev server work again. However localhost start crashing.

Later I figured out this is due appsettings.json in wwwroot of blazor webassembly client.

Appsettings stores URL's to different services. I can't keep in mind to change appsettings to publish new version either to dev or production.

However I cant find in doc how to exclude files and also keep framework think its there. If I remove appsettings.json from wwwroot then startup wont trigger GET request for appsettings.json at all.

Workaround for now: Publish app, manually remove from App.staticwebassets.endpoints.json any entry for appsettings.json

Expected Behavior

Document steps how to remove mapping for .staticwebassets.endpoints.json files.

Steps To Reproduce

  1. Create webassembly app
  2. Create wwwroot/appsettings.json
  3. Bind configuration from file to class via Configuration.Bind
  4. Publish
  5. Change content of appsettings.json on deployment server

Exceptions (if any)

Console output:
blazor.web.js:1

 ManagedError: AggregateException_ctor_DefaultMessage (EndOfStringNotFound LineNumber: 15 | BytePositionInLine: 145.)
    at sn (dotnet.runtime.cymp1amu5g.js:3:26894)
    at Kt.resolve_or_reject (dotnet.runtime.cymp1amu5g.js:3:26449)
    at dotnet.runtime.cymp1amu5g.js:3:172526
    at dotnet.runtime.cymp1amu5g.js:3:172590
    at fr (dotnet.runtime.cymp1amu5g.js:3:35046)
    at Fc (dotnet.runtime.cymp1amu5g.js:3:172173)
    at 00b59d9e:0x1f1a4
    at 00b59d9e:0x1c8ae
    at 00b59d9e:0xea19
    at 00b59d9e:0x1ec88

.NET Version

9.0.2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions