You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
which CC static analyzer will think is possibly accessing a null reference.
DataGridViewRowCollection should require for all methods that take in a DataGridViewRow that the row is non-null, and Ensure for all methods that return a DataGridViewRow that the result is non-null
This seems pretty safe to me after going through the code, exception is thrown when null is passed in in relevant places already. But there is one tricky edge case that needs to be cleared up: DataGridViewBand.Clone() needs to guarantee it returns non-null.
public virtual object Clone()
{
DataGridViewBand dataGridViewBand = (DataGridViewBand) Activator.CreateInstance(base.GetType());
if (dataGridViewBand != null)
{
this.CloneInternal(dataGridViewBand);
}
return dataGridViewBand;
}
It's probably safe, but maybe there's some edge case where Activator.CreateInstance returns null? It calls out to external methods so I can't fully analyze it.
DataGridViewRow CreateCellsInstance() and Cells should Ensure non-null
Similar logic as 1).
DataGridViewColumnCollection should require non-null columns to be added, and ensure columns retrieved are non-null
Similar logic as 2), haven't analyzed yet though.
Control.DataBindings can't be null, ButtonBase.FlatAppearance can't be null, ImageList.Images can't be null
Checked and it's not possible, so just add contracts.
Activity
SergeyTeplyakov commentedon Feb 17, 2016
Great suggestion! Pull request is highly welcome!:)
Patashu commentedon Feb 17, 2016
Ok, I'll try my hand at it later.
Patashu commentedon Feb 22, 2016
#387