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

Correct nullable annotation on ICustomTypeDescriptor.GetConverter #72629

Merged
merged 1 commit into from
Jul 22, 2022
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 @@ -289,7 +289,7 @@ protected CustomTypeDescriptor(System.ComponentModel.ICustomTypeDescriptor? pare
public virtual string? GetClassName() { throw null; }
public virtual string? GetComponentName() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
public virtual System.ComponentModel.TypeConverter GetConverter() { throw null; }
public virtual System.ComponentModel.TypeConverter? GetConverter() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The built-in EventDescriptor implementation uses Reflection which requires unreferenced code.")]
public virtual System.ComponentModel.EventDescriptor? GetDefaultEvent() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("PropertyDescriptor's PropertyType cannot be statically discovered.")]
Expand Down Expand Up @@ -584,7 +584,7 @@ public partial interface ICustomTypeDescriptor
string? GetClassName();
string? GetComponentName();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
System.ComponentModel.TypeConverter GetConverter();
System.ComponentModel.TypeConverter? GetConverter();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The built-in EventDescriptor implementation uses Reflection which requires unreferenced code.")]
System.ComponentModel.EventDescriptor? GetDefaultEvent();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("PropertyDescriptor's PropertyType cannot be statically discovered.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public virtual AttributeCollection GetAttributes()
/// descriptor is representing.
/// </summary>
[RequiresUnreferencedCode(TypeConverter.RequiresUnreferencedCodeMessage)]
public virtual TypeConverter GetConverter()
public virtual TypeConverter? GetConverter()
{
if (_parent != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface ICustomTypeDescriptor
/// Gets a type converter for this object.
/// </summary>
[RequiresUnreferencedCode(TypeConverter.RequiresUnreferencedCodeMessage)]
TypeConverter GetConverter();
TypeConverter? GetConverter();

/// <summary>
/// Gets the default event for this object.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ AttributeCollection ICustomTypeDescriptor.GetAttributes()
}

[RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
TypeConverter ICustomTypeDescriptor.GetConverter()
TypeConverter? ICustomTypeDescriptor.GetConverter()
{
return null!;
return null;
}

[RequiresUnreferencedCode("The built-in EventDescriptor implementation uses Reflection which requires unreferenced code.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected virtual DbDataReader GetDbDataReader(int i)
string? ICustomTypeDescriptor.GetComponentName() => null;

[RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
TypeConverter ICustomTypeDescriptor.GetConverter() => null!;
TypeConverter? ICustomTypeDescriptor.GetConverter() => null;

[RequiresUnreferencedCode("The built-in EventDescriptor implementation uses Reflection which requires unreferenced code.")]
EventDescriptor? ICustomTypeDescriptor.GetDefaultEvent() => null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void EndEdit()
string? ICustomTypeDescriptor.GetComponentName() => null;

[RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
TypeConverter ICustomTypeDescriptor.GetConverter() => null!;
TypeConverter? ICustomTypeDescriptor.GetConverter() => null;

[RequiresUnreferencedCode("The built-in EventDescriptor implementation uses Reflection which requires unreferenced code.")]
EventDescriptor? ICustomTypeDescriptor.GetDefaultEvent() => null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal DataView GetDataView(DataTable table)
/// Retrieves the type converter for this object.
/// </summary>
[RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
TypeConverter ICustomTypeDescriptor.GetConverter() => null!;
TypeConverter? ICustomTypeDescriptor.GetConverter() => null;

/// <summary>
/// Retrieves the default event.
Expand Down