Skip to content

[NET10.0] Annotate ListStringTypeConverter for nullability#28244

Merged
rmarinho merged 1 commit intodotnet:net10.0from
MartyIX:feature/2025-03-06-Convert-nullability-1-n-NET10
Mar 20, 2025
Merged

[NET10.0] Annotate ListStringTypeConverter for nullability#28244
rmarinho merged 1 commit intodotnet:net10.0from
MartyIX:feature/2025-03-06-Convert-nullability-1-n-NET10

Conversation

@MartyIX
Copy link
Contributor

@MartyIX MartyIX commented Mar 7, 2025

Description of Change

Recently, a PR was merged (#27984) where nullability annotations for ShadowTypeConverter were added. However, I believe that there are minor errors.

Based on dotnet/runtime#63874 which corrected nullable types for .NET runtime (e.g. DateTimeConverter), I believe that the correct method synopses are:

+public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
+public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)
+public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
+public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)

This PR attempts to fix the annotations for a single converter to validate my beliefs.


If you wonder, what "~" character (called oblivious marker) denotes in PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt files mean, then look here: https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md#nullable-reference-type-support

Any public API that haven't been annotated (i.e. uses an oblivious reference type) will be tracked with a ~ marker.
The marker lets you track how many public APIs still lack annotations. For instance, ~C.ObliviousMethod() -> string.

@MartyIX MartyIX requested a review from a team as a code owner March 7, 2025 13:57
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 7, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @MartyIX! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

jfversluis
jfversluis previously approved these changes Mar 7, 2025
Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the publicAPI changes are wrong, you need to add [Remove] tag on unshipped , the Shipped should not be changed..

@MartyIX
Copy link
Contributor Author

MartyIX commented Mar 8, 2025

I think the publicAPI changes are wrong, you need to add [Remove] tag on unshipped , the Shipped should not be changed..

Hopefully, it's correct now.

jsuarezruiz
jsuarezruiz previously approved these changes Mar 10, 2025
@rmarinho rmarinho added this to the .NET 10.0-preview3 milestone Mar 10, 2025
Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/Users/builder/azdo/_work/1/s/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt(197,1): error RS0050: Symbol '~override Microsoft.Maui.Controls.ListStringTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type sourceType) -> bool' is marked as removed but it isn't deleted in source code (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net10.0-android35.0]
/Users/builder/azdo/_work/1/s/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt(198,1): error RS0050: Symbol '~override Microsoft.Maui.Controls.ListStringTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) -> bool' is marked as removed but it isn't deleted in source code (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net10.0-android35.0]
/Users/builder/azdo/_work/1/s/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt(199,1): error RS0050: Symbol '~override Microsoft.Maui.Controls.ListStringTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) -> object' is marked as removed but it isn't deleted in source code (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net10.0-android35.0]
/Users/builder/azdo/_work/1/s/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt(200,1): error RS0050: Symbol '~override Microsoft.Maui.Controls.ListStringTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) -> object' is marked as removed but it isn't deleted in source code (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net10.0-android35.0]
    1 Warning(s)
    24 Error(s)

Seems something is wrong, you can test locally first see if dotnet cake --workloads=global works

@rmarinho rmarinho self-assigned this Mar 10, 2025
@MartyIX MartyIX force-pushed the feature/2025-03-06-Convert-nullability-1-n-NET10 branch from a83f02a to fdf32fb Compare March 15, 2025 19:14
@dotnet dotnet deleted a comment from azure-pipelines bot Mar 17, 2025
@dotnet dotnet deleted a comment from jfversluis Mar 17, 2025
@dotnet dotnet deleted a comment from azure-pipelines bot Mar 17, 2025
@github-actions github-actions bot force-pushed the feature/2025-03-06-Convert-nullability-1-n-NET10 branch from fdf32fb to bdfdfc1 Compare March 19, 2025 12:36
@dotnet dotnet deleted a comment from azure-pipelines bot Mar 19, 2025
@github-project-automation github-project-automation bot moved this from Todo to Approved in MAUI SDK Ongoing Mar 19, 2025
@dotnet dotnet deleted a comment from azure-pipelines bot Mar 19, 2025
@rmarinho rmarinho merged commit e76d006 into dotnet:net10.0 Mar 20, 2025
125 of 128 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Mar 20, 2025
@MartyIX MartyIX deleted the feature/2025-03-06-Convert-nullability-1-n-NET10 branch March 21, 2025 07:09
@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants