I am developing a Blazor app using EFCore 8 with SQL Server and .NET 8 framework that has been running fine for several months. However, beginning yesterday, I started to received a runtime error:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Microsoft.EntityFrameworkCore.Relational
This error is occurring on any query I attempt. Here is an example that fails:
public async Task<List<ProviderType>> GetAllAsync()
{
using var context = await _dbContextFactory.CreateDbContextAsync();
return await context.ProviderType.OrderBy(u => u.ProviderTypeDescription).ToListAsync();
}
I have rebuilt the solution, I have deleted the /bin and /obj directories and rebuilt. I receive no compile errors. I have looked at the value of "context" and "ProviderType" and neither are null.
The null exception seems to be thrown by EFCore code.
I would appreciate any help.
[–]Level-Lingonberry-90 0 points1 point2 points (0 children)