Skip to content
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

Add nullable annotations to System.ComponentModel.TypeConverter #54961

Merged
merged 4 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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