ASP.NET Core Testing - Get NullReferenceException When Initializing InMemory SQLite Dbcontext In Fixture
Answer : I encountered this problem while trying to do EF Core scaffolding for an Sqlite database. The problem was that I had installed Microsoft.EntityFrameworkCore.Sqlite.Core rather than Microsoft.EntityFrameworkCore.Sqlite . I uninstalled the former package, and ran this command: Install-Package Microsoft.EntityFrameworkCore.Sqlite -Version 3.1.2 Then everything worked. Yup... My bad. I had installed Microsoft.Data.Sqlite.Core version 3.0.0 when I needed version 2.2.6 and I had not installed Microsoft.Data.Sqlite 2.2.6, which I have since installed. It's working now. Also, FYI: both .UseSqlite("Data Source=:memory:") and .UseSqlite("DataSource=:memory:") work. I had similar issue when trying to open Microsoft.Data.Sqlite.SqliteConnection , it was throwing System.NullReferenceException as well. The class which was initializing the connection was in library project referencing: Microsoft.Data.Sqlite - v3.1.2 Microsoft.Data.Sqlite.Core - v3...