❔ data is null. method or property cannot be called on null value

NNauvran12/22/2022
Everything but the ID is nullable on both the database and the model
I've not set fluent api or the model up with all of the database tables values but it can't be the issue, can it?

All I'm currently trying to do is just get a list of my object
NNauvran12/22/2022
Apparently one row had a value that was null
I don't currently use this value in EF so why is it causing an error?
FFusedQyou12/22/2022
Idk? I can't really give you anything with 0 context on what your code/database looks like
NNauvran12/22/2022
I can't have discord on my work laptop or really share the code
But it's currently complaining about a string/varchar being null
FFusedQyou12/22/2022
Oh boy I know that problem
FFusedQyou12/22/2022
Discord is not work-related enough
FFusedQyou12/22/2022
I had that discussion before
FFusedQyou12/22/2022
As far as I'm aware EF does not allow anything that is null into a column when you set the rule that it's required
FFusedQyou12/22/2022
You can check your latest snapshot to check if everything has IsRequired() set?
Image
NNauvran12/22/2022
Sorry for the late reply
I have tried having it removed and .is required(false)
Both are not working
FFusedQyou12/22/2022
You want it to not allow null though, right?
FFusedQyou12/22/2022
IsRequired basically prevents null values
FFusedQyou12/22/2022
But your code should be set up so it's not nullable either
NNauvran12/22/2022
No I want to allow null
NNauvran12/22/2022
All I'm doing is a simple dumb select
I don't care about that value if it's null or not
NNauvran12/22/2022
Is it something new in .net 6?
I've never had this issue in the old .net core 3 projects i was on before
AAngius12/22/2022
If a property is string then it's not-nullable
AAngius12/22/2022
If you want to make it nullable... make it nullable
AAngius12/22/2022
string?
AAngius12/22/2022
And, yes, non-nullable reference types are a .NET 6 thing
NNauvran12/23/2022
I've tried that as well and that doesn't work either
So far it's not a feature that I like
NNauvran12/23/2022
Right my property is string?
I have tried to set IsRequired(false) in fluent api and I have tried not having it
I have even tried setting Nullable to disabled in the project
The only thing that works is selecting everything else and excluding the column that's has null values
NNauvran12/23/2022
For fucks sake
The issue was that the property was being used in a composite key
AAccord12/24/2022
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.