-
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
Stop scaffolding DbSet initialization to null!
#26877
Comments
After #27869 we should properly suppress all uninitialized DbSet warnings. However, for cases where a constructor exists on the DbContext, our new suppressor depends on a new Roslyn enhancement added in 7.0.0-preview3 (dotnet/roslyn#58073). This means that when using an older SDK, those specific warnings would not be suppressed. This isn't a big problem in itself (not worse than today), but could be an issue if we change scaffolding to remove the bang initialization (this issue); if EF Core 7.0 will target .NET 6.0 as it does today, it would be usable with SDK 6.0 as well, where the scaffolded code would start generate a warning. |
null!
Note from triage: looks like an issue with analyzers during tests. @roji will investigate. |
@bricelam I did some trivial testing from a console program against 7.0.0-preview.6, and everything seems to be working correctly - I'm getting no uninitialized warnings for DbSets (with a DbContext, constructor or without it). So I guess there's some testing issue there - if you want to point me to some failing test I can look... |
Now that we have a diagnostics suppressor for uninitialized DbSet properties (#26795), we can stop scaffolding DbContext code which initializes DbSet properties to
null!
.The text was updated successfully, but these errors were encountered: