Conversation
There was a problem hiding this comment.
Pull Request Overview
The purpose of the PR is to apply nullability attributes to TimeChangedEventArgs in .NET 10 so that its behavior aligns with DatePicker. The key changes are:
- Updating the constructor signature to accept nullable TimeSpan values.
- Changing the public properties OldTime and NewTime to be nullable.
- Propagating these API changes to all PublicAPI.Unshipped.txt files for various platforms.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/src/Core/TimeChangedEventArgs.cs | Updated API to use nullable TimeSpan for constructor and properties. |
| src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt | Replaced non-nullable entries with nullable counterparts for TimeChangedEventArgs. |
| src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt | Replaced non-nullable entries with nullable counterparts for TimeChangedEventArgs. |
| src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt | Replaced non-nullable entries with nullable counterparts for TimeChangedEventArgs. |
| src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt | Replaced non-nullable entries with nullable counterparts for TimeChangedEventArgs. |
| src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt | Replaced non-nullable entries with nullable counterparts for TimeChangedEventArgs. |
| src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt | Replaced non-nullable entries with nullable counterparts for TimeChangedEventArgs. |
| TimePicker pickerFromSender = null; | ||
| TimeSpan oldTime = new TimeSpan(); | ||
| TimeSpan newTime = new TimeSpan(); | ||
| TimeSpan? oldTime = new TimeSpan(); |
There was a problem hiding this comment.
Should it be initialized now at null
There was a problem hiding this comment.
Could be. In this case following the same pattern done with the changes in DatePicker (handler, tests etc): https://github.com/dotnet/maui/blob/net10.0/src/Controls/tests/Core.UnitTests/DatePickerUnitTest.cs#L179
There was a problem hiding this comment.
Ok, we might want to create a couple of more tests with these variables taking null and everything works too.
Description of Change
In .NET 10 we make the Time property of the TimePicker class nullable #27930 However missed to apply nullability attributes to TimeChangedEventArgs. With the changes from this PR we align the behavior with the DatePicker https://github.com/dotnet/maui/blob/net10.0/src/Controls/src/Core/DateChangedEventArgs.cs
Issues Fixed
Fixes #29513
Related with #27930