Skip to content

Commit

Permalink
Add nullable annotations to System.ComponentModel.TypeConverter (#54961)
Browse files Browse the repository at this point in the history
* Add nullable annotations to System.ComponentModel.TypeConverter

* Annotate System.Data.Common

* Annotations in depending projects

* address feedback
  • Loading branch information
krwq authored Jul 8, 2021
1 parent 594901a commit 885296a
Show file tree
Hide file tree
Showing 216 changed files with 2,289 additions and 2,338 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public MetadataPropertyDescriptorWrapper(PropertyDescriptor descriptor, Attribut

public override Type ComponentType { get { return _descriptor.ComponentType; } }

public override object GetValue(object component) { return _descriptor.GetValue(component); }
public override object? GetValue(object? component) { return _descriptor.GetValue(component); }

public override bool IsReadOnly
{
Expand All @@ -45,7 +45,7 @@ public override bool IsReadOnly

public override void ResetValue(object component) { _descriptor.ResetValue(component); }

public override void SetValue(object component, object value) { _descriptor.SetValue(component, value); }
public override void SetValue(object? component, object? value) { _descriptor.SetValue(component, value); }

public override bool ShouldSerializeValue(object component) { return _descriptor.ShouldSerializeValue(component); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ private void SetupConversion()

TypeConverter converter = GetOperandTypeConverter();
IComparable min = (IComparable)(ParseLimitsInInvariantCulture
? converter.ConvertFromInvariantString((string)minimum)
: converter.ConvertFromString((string)minimum));
? converter.ConvertFromInvariantString((string)minimum)!
: converter.ConvertFromString((string)minimum))!;
IComparable max = (IComparable)(ParseLimitsInInvariantCulture
? converter.ConvertFromInvariantString((string)maximum)
: converter.ConvertFromString((string)maximum));
? converter.ConvertFromInvariantString((string)maximum)!
: converter.ConvertFromString((string)maximum))!;

Func<object, object?> conversion;
if (ConvertValueInInvariantCulture)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.ComponentModel.manual.cs" />
Expand Down
Loading

0 comments on commit 885296a

Please sign in to comment.