Skip to content

ASPNETCORE_HOSTINGSTARTUPASSEMBLIES not working for Blazor wasm development server #63130

@kallebysantos

Description

@kallebysantos

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Previous I remember that I was working in a dotnet new blazorwasm project and did setup the ASPNETCORE_HOSTINGSTARTUPASSEMBLIES for my tailwindcss compiler package.

It was working well, until an user come out saying the following error (issue #15):

crit: Microsoft.AspNetCore.Hosting.Diagnostics[11]
      Hosting startup assembly exception
      System.InvalidOperationException: Startup assembly Tailwind.Hosting failed to execute. See the inner exception for more details.
       ---> System.IO.FileNotFoundException: Could not load file or assembly 'Tailwind.Hosting, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

      File name: 'Tailwind.Hosting, Culture=neutral, PublicKeyToken=null'
         at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
         at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
         at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.ExecuteHostingStartups()
         --- End of inner exception stack trace ---

After trying to launch my old project I could see that is not working anymore, I'm not sure if was a sdk version update breaking change. But seems not possible to fit a Hosting Startup Assembly to the Dev Server.

I did also setup a blank solution with a minimal hosted assembly with "Hello world" message and its only working for dotnet web projects while throws on blazorwasm.


I know that after publish a blazorwasm it will generate client side only code. But in my case I just need theses Startup Assemblies while development from dotnet watch run command.

Expected Behavior

After run: dotnet run -c Development or dotnet watch run, it should also load the ASPNETCORE_HOSTINGSTARTUPASSEMBLIES

Steps To Reproduce

Add any startup assembly to launchSettings.json then execute with dotnet run -c Development

Exceptions (if any)

crit: Microsoft.AspNetCore.Hosting.Diagnostics[11]
      Hosting startup assembly exception
      System.InvalidOperationException: Startup assembly Tailwind.Hosting failed to execute. See the inner exception for more details.
       ---> System.IO.FileNotFoundException: Could not load file or assembly 'Tailwind.Hosting, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

      File name: 'Tailwind.Hosting, Culture=neutral, PublicKeyToken=null'
         at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
         at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
         at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.ExecuteHostingStartups()
         --- End of inner exception stack trace ---

.NET Version

10, 9 and 8

Anything else?

The Startup library mentioned
Project that I was working before

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions