-
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
NullReferenceException in Get-Migration in EF Core 8 #32732
Comments
I have a cut down sample of the client solution that reproduces the problem. I can share the code with you folks as long as it's not made public. How would we do that? |
@bgoodearl You can email it to avickers at this place I work. Let me know when you have done so, since it may go to spam. |
Arthur - just sent you an email without a zip. Will follow up with a zip. |
Sent emails with zips |
Updated NuGet packages to 8.0.1 and VS2022 to 17.8.4 - same results |
we're also encountering the issue when switched to .NET 8 with EF8 and executing "dotnet.exe ef migrations script -i" which worked fine on .NET 7. Stacktrace:
|
@MantasG-Visma That looks like a different issue. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate. |
* Don't assume that FK of skip navigation is non-null Fixes #32732 * Add additional assesion.
* Don't assume that FK of skip navigation is non-null Fixes #32732 * Add additional assesion.
@ajcvickers I have debugged the issue, it seems it is caused by default value of a guid key:
When I delete it, it works. |
It helped me to change table.Column(nullable: false) to table.Column(type: "uniqueidentifier", nullable: false) |
File a bug
See details in issue 32487
efcore/issues/32487
We've spent a fair bit of time trying to reproduce the issue with a cut-down sample, but have not been successful.
A colleague has debugged into the EF code with our client project and found where the exception is being thrown.
I created a test sample with enough entities to have the entity where the exception was thrown, but that sample does not fail.
We can share the new test sample with you and include information about where the client code is failing and the new sample is not failing, but do not want to make the new sample public.
Code that's failing:
this throws the exception: conventionSkipNavigation.ForeignKey.IsRequired due to ForeignKey being null
This problem is a show-stopper for converting this client project to .NET 8.
Include provider and version information
EF Core version: 8.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: Windows 10
IDE: Visual Studio 2022 17.8.3
The text was updated successfully, but these errors were encountered: