Aspnetcore: Blazor server side: dotnet run fails with InvalidOperationException on MacOS

Created on 16 Apr 2019  路  11Comments  路  Source: dotnet/aspnetcore

Describe the bug

dotnet run fails with the follwing exception on MacOS for blazorserverside projects

System.InvalidOperationException: Could not load the embedded file manifest 'Microsoft.Extensions.FileProviders.Embedded.Manifest.xml' for assembly 'Microsoft.AspNetCore.Components.Server'.
   at Microsoft.Extensions.FileProviders.Embedded.Manifest.ManifestParser.Parse(Assembly assembly, String name)
   at Microsoft.Extensions.FileProviders.ManifestEmbeddedFileProvider..ctor(Assembly assembly)
   at Microsoft.AspNetCore.Components.Server.ConfigureStaticFilesOptions.PostConfigure(String name, StaticFileOptions options)
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
   at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware..ctor(RequestDelegate next, IWebHostEnvironment hostingEnv, IOptions`1 options, ILoggerFactory loggerFactory)
--- End of stack trace from previous location where exception was thrown ---

To Reproduce

Steps to reproduce the behavior:

  1. Get the latest preview4 sdk from core-sdk
  2. dotnet new blazorserverside
  3. dotnet run

Expected behavior

The app runs successfully

Additional context

Note: This doesn't happen for client-side blazor projects.

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview4-011216
 Commit:    19c844a865

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.0.100-preview4-011216/

Host (useful for support):
  Version: 3.0.0-preview4-27613-07
  Commit:  5c329c85ae

cc @danroth27 @rynowak

Done area-blazor bug

Most helpful comment

@guardrex it will be released with preview 5, but you can try out a nightly build.

Daniel Roth

All 11 comments

Reassigning it to @pranavkm as he already has a PR out to fix this.

Changes are in. Leaving open for verification.

Same problem in linux

SDK de .NET Core (reflejando cualquier global.json):
 Version:   3.0.100-preview4-011223
 Commit:    118dd862c8

Entorno de tiempo de ejecuci贸n:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /snap/dotnet-sdk/36/sdk/3.0.100-preview4-011223/

Host (useful for support):
  Version: 3.0.0-preview4-27615-11
  Commit:  ee54d4cbd2

.NET Core SDKs installed:
  3.0.100-preview4-011223 [/snap/dotnet-sdk/36/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0-preview4-19216-03 [/snap/dotnet-sdk/36/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0-preview4-27615-11 [/snap/dotnet-sdk/36/shared/Microsoft.NETCore.App]

Is there any workaround?

@kattunga Yes, unfortunately this is a known issue with the Preview 4 release. It will be fixed in the next preview in a couple of weeks. There isn't a known workaround at this time, but if we come up with one we will update the known issues doc accordingly. The client-side Blazor templates should work fine though.

[macOS - 3.0.100-preview5-011463]
While it does not give the exception on startup in the latest nightly preview it still does not work. The exception now occurs on the "blazorserverside" template project as soon as one clicks on the counter:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Extensions.FileProviders.Embedded.Manifest.ManifestFileInfo.EnsureLength()
at Microsoft.Extensions.FileProviders.Embedded.Manifest.ManifestFileInfo.get_Length()
at Microsoft.AspNetCore.StaticFiles.StaticFileContext.LookupFileInfo()
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

@tn-5, we are aware of this issue. A fix for this has already been merged https://github.com/aspnet/AspNetCore/pull/9527. It will be available on an upcoming build.

thx

@ajaybhargavb "upcoming build" ... does that mean Pre5, or sooner than that?

@guardrex it will be released with preview 5, but you can try out a nightly build.

Daniel Roth

I also got this when trying to run Blazor Server Side (preview4) on an Azure Kubernetes service
Update: AZ Kubernetes won't build with the nightly build and defaults back to preview4 sadly. Any ideas how to get this to change while we wait for preview5 to be released? Thanks

@simonziegler You can get builds of Preview5 from https://github.com/aspnet/AspNetCore/blob/master/docs/DailyBuilds.md

Was this page helpful?
0 / 5 - 0 ratings