Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor WASM throwing exception when trying to run EF Core #17799

ebekker opened this issue Nov 14, 2019 · 0 comments

Blazor WASM throwing exception when trying to run EF Core #17799

ebekker opened this issue Nov 14, 2019 · 0 comments


Copy link

@ebekker ebekker commented Nov 14, 2019

This issue is being re-filed here, after originally being submitted in the AspNetCore project as issue 17095 as per @javiercn 's suggestion:

Describe the bug

I'm trying to run an experiment using Blazor for WASM -- I'm trying to run Entity Framework Core with the InMemory provider. I setup a very basic model of two entities and very simple DBContext. And a very basic test of simply creating a couple entities, then trying to persist the context.

My expectation was that since EF Core is compatible with .NET Standard 2.0/2.1, as is the InMemory provider, and there should not be any "platform not supported" issues, such as network or disk I/O with this setup, that EF Core should work.

However, I'm seeing WASM exceptions, such as WASM: undefined and Uncaught (in promise) abort(undefined). Build with -s ASSERTIONS=1 for more info..

To be sure that this isn't due to some bits being linked away, I disabled the linker altogether, but this did not seem to have any impact.

To Reproduce

I have a very simple EF model and context setup:

using Microsoft.EntityFrameworkCore;

namespace Sample.Shared.Data
    public class Student
        public int StudentId { get; set; }
        public string Name { get; set; }

    public class Course
        public int CourseId { get; set; }
        public string CourseName { get; set; }

    public class SchoolContext : DbContext
        public DbSet<Student> Students { get; set; }
        public DbSet<Course> Courses { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

and then in a Razor page, I have a very simple invocation that produces the error:

@code {
    private void AddCourse()
        using (var ctx = new Sample.Shared.Data.SchoolContext())
            ctx.Courses.Add(new Sample.Shared.Data.Course
                CourseName = $"Course {Guid.NewGuid()}",

I'm including the top of the exception stack as provided from Firefox console:

WASM: Courses: blazor.webassembly.js:1:37571

and from the exception:

WASM: undefined blazor.webassembly.js:1:37571
WASM: undefined blazor.webassembly.js:1:37626
    printErr http://localhost:5000/_framework/blazor.webassembly.js:1
    abort http://localhost:5000/_framework/wasm/mono.js:1
    _abort http://localhost:5000/_framework/wasm/mono.js:1
    <anonymous> http://localhost:5000/_framework/wasm/mono.wasm:731188
    <anonymous> http://localhost:5000/_framework/wasm/mono.wasm:791957
    <anonymous> http://localhost:5000/_framework/wasm/mono.wasm:771979

Further technical details

  • Using .NET Core/AspNetCore 3.1 preview 1 (as well as corresponding EF Core bits)
  • Building and running from CLI
  • Output of dotnet --info:
.NET Core SDK (reflecting any global.json):
 Version:   3.1.100-preview1-014459
 Commit:    ac3b59712d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.100-preview1-014459\

Host (useful for support):
  Version: 3.1.0-preview1.19506.1
  Commit:  bbf5542781

.NET Core SDKs installed:
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.509 [C:\Program Files\dotnet\sdk]
  2.1.802 [C:\Program Files\dotnet\sdk]
  2.2.402 [C:\Program Files\dotnet\sdk]
  3.0.100-preview9-014004 [C:\Program Files\dotnet\sdk]
  3.0.100 [C:\Program Files\dotnet\sdk]
  3.1.100-preview1-014459 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview7.19365.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview9.19424.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0-preview1.19508.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0-preview1.19506.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.0-preview1.19506.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:

I know this is not a conventional scenario and may not be something that will ever be supported, but I'm looking for at least some guidance as to where to look for the issue. Is the Build with -s ASSERTIONS=1 for more info. message with the exception a legitimate place to start, and how would I go about enabling that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.