Nullability annotations for System.Data#38810
Conversation
2aa2c47 to
1d6d1d2
Compare
src/libraries/System.Data.Common/src/System/Data/Common/AdapterUtil.Common.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
The following 0 count means the array never gets enumerated anyway
src/libraries/System.Data.Common/src/System/Data/Common/BooleanStorage.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Data/Common/DbConnectionOptions.Common.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I see call sites for some of these virtuals checking for and allowing null. Is non-nullable correct for the return value for all of these?
There was a problem hiding this comment.
The default implementation coalesces to string.Empty, and it's supposed to be a string you can always concatenate before/after the string. It's true that it's virtual so anything's possible, though I'm only seeing IsNullOrEmpty in the Odbc and OleDb providers, and SqlClient just calls base.QuotePrefix.
Where are you seeing null checks, anything persuasive? I can make it nullable if you think that's safer.
There was a problem hiding this comment.
Where are you seeing null checks
The IsNullOrEmpty checks you mentioned. But it's not just in Odbc and OleDb, e.g. DBCommandBuilder allows null in both private void BuildInformation(DataTable schemaTable) and private string QuotedColumn(string column).
There was a problem hiding this comment.
OK, yeah - I see them though they're also IsNullOrEmpty. I think the point is to check for length 0 rather than for null (the coalescing behavior of the property getters is a good indication), but if you think we should annotate these as nullable I can do that. We could also do a more thorough search outside the BCL to see who's overriding DbCommandBuilder and what they're doing, let me know.
src/libraries/System.Data.Common/src/System/Xml/XPathNodePointer.cs
Outdated
Show resolved
Hide resolved
stephentoub
left a comment
There was a problem hiding this comment.
I only spot checked and I'm exhausted; thanks for slogging through this.
2daaa57 to
655d26b
Compare
|
Tagging subscribers to this area: @roji, @ajcvickers |
8aed39b to
dc8fe20
Compare
Following ec73c56. A few corners have been left annotated because of dependencies.
dc8fe20 to
d0f5d5e
Compare
|
@stephentoub have merged this to be able to continue working on Odbc etc., thanks for taking the time to review this (it was most definitely a slog). If there are any outstanding points (e.g. #38810 (comment)) let me know and I'll do fix-up to this in a later PR. |
Following ec73c56.
Part of #2339