-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Insert entity in non existing table throws NullException #9599
Comments
@JeanCollas I'm unable to repro this so far. Can you confirm that you are using the 2.0 version of all packages, including Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore. |
I get this error with Pomelo.EntityFrameworkCore.MySql provider
|
I see that issue during integration testing my ASP Net app. Multiple For example this test is fine when it is executed without prior creation of the [Fact]
public void CreateEmptyCalendar() {
using (var context = TestUtils.GetContext()) {
context.Calendars.Add(new Calendar());
Assert.Throws<DbUpdateException>(() => context.SaveChanges());
}
} But if fails with a The exception goes away if I don't call I'll see if I can come up with a small test case. |
I'm seeing this as well. It seems like if anything throws an exception inside SaveChanges(Async) this happens. I've disabled Just My Code in the debugger and am able to see the real exception before it gets caught by the framework - in this case a What seems to happen is the I'm out of time right now so I can't investigate further but hopefully this is a step in the right direction. |
Ok so apparently what is happening is Hopefully this helps track it down and get the problem fixed. |
@anpete Can you bump up the priority of investigating this, also considering dotnet/aspnetcore#2820 |
@ajcvickers Will do. |
…eException when ef exception occur in background task Fix dotnet/efcore#9599 - Insert entity in non existing table throws NullException Added null checks to async local access in event callback. Related to dotnet/aspnetcore#2825
Fix dotnet/aspnetcore#2820 - UseDatabaseErrorPage throws NullReferenceException when ef exception occur in background task Fix dotnet/efcore#9599 - Insert entity in non existing table throws NullException Added null checks to async local access in event callback. Related to dotnet/aspnetcore#2825
Fix dotnet/aspnetcore#2820 - UseDatabaseErrorPage throws NullReferenceException when ef exception occur in background task Fix dotnet/efcore#9599 - Insert entity in non existing table throws NullException Added null checks to async local access in event callback. Related to dotnet/aspnetcore#2825
Fix dotnet/aspnetcore#2820 - UseDatabaseErrorPage throws NullReferenceException when ef exception occur in background task Fix dotnet/efcore#9599 - Insert entity in non existing table throws NullException Added null checks to async local access in event callback. Related to dotnet/aspnetcore#2825
I just saw this problem in EF Core 2.0.3 (included via Microsoft.AspNetCore.All 2.0.8). In my attempt to build a minimal test case, the problem disappeared and gave way to a much more helpful exception, which explained that a TimeSpan of 4 days is too big for a column in SqlServer. |
Using Dot Net Core 2.0 framework and
I cannot reproduce it but it happens often. Here is the stack trace:
|
@mustafashujaie - This issue has been fixed in 2.1 release. Which version of packages are you using? Fix is in Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore package. |
This is the
|
@mustafashujaie - You are using 2.0.8 version of AspnetCore.All. Please upgrade all AspNet related packages to 2.1 release in order to get the bug fix. Read this for more info on how to upgrade. https://docs.microsoft.com/en-us/aspnet/core/migration/20_21?view=aspnetcore-2.1 |
The following code generates a -not dev-friendly- error
The error:
Message:
It would be nice to have something saying that the table could not be found or something like this :)
The text was updated successfully, but these errors were encountered: