[net11.0] Controls: Annotate remaining converters and harden conversion behavior - #30875
Conversation
|
Hey there @@NirmalKumarYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
786ef98 to
37357a5
Compare
There was a problem hiding this comment.
Pull Request Overview
This pull request continues the series of updates to annotate remaining converter classes for nullability in the .NET MAUI Controls library. The changes focus on enabling nullable reference types and modernizing code syntax to improve type safety and code readability.
Key Changes:
- Enables nullable reference types (
#nullable enable) across multiple type converter classes - Updates method signatures in type converters to support nullable parameters
- Modernizes code syntax with file-scoped namespaces and improved conditional statements
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| TextAlignment.cs | Enabled nullability and modernized namespace declaration with improved conditional formatting |
| ShellSection.cs | Updated type converter method signatures for nullable parameters |
| ShellNavigationState.cs | Enabled nullability for ShellNavigationStateTypeConverter |
| ShellItem.cs | Updated ShellItemConverter with nullable parameter support |
| ShellContent.cs | Added nullability annotations to ShellContentConverter |
| StrokeShapeTypeConverter.cs | Comprehensive refactoring with nullability, modernized syntax, and improved error handling |
| ResourceDictionary.cs | Restructured RDSourceTypeConverter with nullable support and method reordering |
| FormattedString.cs | Updated FormattedStringConverter with nullable annotations |
| FontAttributes.cs | Enhanced FontAttributesConverter with nullability and improved conditional formatting |
| Button.cs | Updated ButtonContentTypeConverter with nullable support |
| BindablePropertyConverter.cs | Major refactoring with nullability enabled and method reorganization |
| PublicAPI files | Added new public API entries for all updated converter method overrides |
|
@NirmalKumarYuvaraj Could you rebase and fix the conflicts? |
1e16118 to
c1c1980
Compare
@jsuarezruiz , I have rebased and resolved the conflicts. please let me know if you have any concerns. |
|
@NirmalKumarYuvaraj Could you rebase and fix the conflicts? (Sorry, again!) |
f5cbaf0 to
16a1df6
Compare
@jsuarezruiz , I have resolved the conflicts. |
|
needs rebase again sorry |
16a1df6 to
0777f61
Compare
@rmarinho , rebased |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@NirmalKumarYuvaraj — new AI review results are available based on this last commit:
bac9168. To request a fresh review after new comments or commits, comment/review rerun.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: ANDROID · Base: net11.0 · Merge base: 7f139ed4
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🧪 FontAttributeConverterUnitTests FontAttributeConverterUnitTests |
✅ FAIL — 113s | ✅ PASS — 82s |
🔴 Without fix — 🧪 FontAttributeConverterUnitTests: FAIL ✅ · 113s
Error-relevant lines (filtered from the build log):
at Microsoft.Maui.Controls.FontAttributesConverter.ParseSingleAttribute(String part, String originalvalue) in /_/src/Controls/src/Core/FontAttributes.cs:line 63
at Microsoft.Maui.Controls.FontAttributesConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) in /_/src/Controls/src/Core/FontAttributes.cs:line 48
at Microsoft.Maui.Controls.Core.UnitTests.FontAttributeConverterUnitTests.FontAttributesRoundTripThroughString(FontAttributes attributes) in /_/src/Controls/tests/Core.UnitTests/FontAttributeConverterUnitTests.cs:line 31
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
🟢 With fix — 🧪 FontAttributeConverterUnitTests: PASS ✅ · 82s
(no coded error found; showing last 1200 chars)
125)
[xUnit.net 00:00:00.30] Discovering: Microsoft.Maui.Controls.Core.UnitTests
[xUnit.net 00:00:02.61] Discovered: Microsoft.Maui.Controls.Core.UnitTests
[xUnit.net 00:00:02.64] Starting: Microsoft.Maui.Controls.Core.UnitTests
Passed FontAttributesRoundTripThroughString(attributes: Bold | Italic) [27 ms]
Passed FontAttributesRoundTripThroughString(attributes: Bold) [< 1 ms]
Passed FontAttributesRoundTripThroughString(attributes: Italic) [< 1 ms]
Passed FontAttributesRoundTripThroughString(attributes: None) [< 1 ms]
Passed TestFontAttributeConverter(input: "Bold", expected: Bold) [< 1 ms]
Passed TestFontAttributeConverter(input: "oblique", expected: Italic) [< 1 ms]
Passed TestFontAttributeConverter(input: "italic", expected: Italic) [< 1 ms]
Passed TestFontAttributeConverter(input: "None", expected: None) [< 1 ms]
Passed TestFontAttributeConverter(input: "oblique, bold", expected: Bold | Italic) [< 1 ms]
[xUnit.net 00:00:02.80] Finished: Microsoft.Maui.Controls.Core.UnitTests
Passed TestFontAttributeConverter(input: "bold italic", expected: Bold | Italic) [< 1 ms]
Test Run Successful.
Total tests: 10
Passed: 10
Total time: 3.5527 Seconds
📁 Fix files reverted (18 files)
src/Controls/src/Core/BindablePropertyConverter.cssrc/Controls/src/Core/Button/Button.cssrc/Controls/src/Core/FontAttributes.cssrc/Controls/src/Core/FormattedString.cssrc/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txtsrc/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txtsrc/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txtsrc/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txtsrc/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txtsrc/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txtsrc/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txtsrc/Controls/src/Core/ResourceDictionary.cssrc/Controls/src/Core/Shapes/StrokeShapeTypeConverter.cssrc/Controls/src/Core/Shell/ShellContent.cssrc/Controls/src/Core/Shell/ShellItem.cssrc/Controls/src/Core/Shell/ShellNavigationState.cssrc/Controls/src/Core/Shell/ShellSection.cssrc/Controls/src/Core/TextAlignment.cs
📱 UI Tests — Button,Shape,Shell
Detected UI test categories: Button,Shape,Shell
✅ Deep UI tests — 414 passed, 0 failed across 3 categories on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
Button |
67/69 ✓ | — |
Shape |
35/35 ✓ | — |
Shell |
312/312 ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
📋 Pre-Flight — Context & Validation
Issue: #N/A - No linked issue found in PR body
PR: #30875 - [Net 11] - Annotated remaining Converter classes for nullability - 3
Platforms Affected: all Controls platforms; testing platform requested: android
Files Changed: 18 implementation/API, 1 test
Key Findings
- PR is a nullability/API annotation update for Controls converters with behavior fixes around converter round-tripping and culture/null handling.
- No linked issue was present (
Fixes #is empty), so context came from PR description, changed files, and review comments. - Prior inline reviews flagged
FontAttributesConverter.ConvertToseparator round-trip behavior,StrokeShapeTypeConverternull culture handling,ShellNavigationState.ConvertTonullable mismatch, and PublicAPI nullability-entry formatting. - Gate result provided by caller: ✅ PASSED — tests fail without fix and pass with fix. Gate was not re-run and
gate/content.mdwas not modified. - GitHub CLI is unauthenticated in this environment, so PR/check context was gathered from public GitHub API and local branch state where possible.
Code Review Summary
Verdict: NEEDS_DISCUSSION
Confidence: low
Errors: 0 | Warnings: 0 | Suggestions: 0
Key code review findings:
- ℹ No high-confidence code findings remained after prior review items were reconciled.
- ℹ CI status remained undetermined/red from available public status context, so the code-review verdict could not be LGTM.
- ℹ Blast radius is localized to converter paths and PublicAPI metadata; no startup/global-state risk identified.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #30875 | Enable nullable annotations across remaining converter classes; preserve converter behavior while fixing FontAttributesConverter.ConvertTo to emit comma-separated values that round-trip; add PublicAPI nullability entries and a FontAttributes round-trip unit test. |
✅ PASSED (Gate) | FontAttributes.cs, converter files, PublicAPI files, FontAttributeConverterUnitTests.cs |
Original PR |
🔬 Code Review — Deep Analysis
Code Review — PR #30875
Independent Assessment
What this changes: Annotates remaining Controls converter classes for nullable reference types, adds/updates TypeConverter overrides and PublicAPI entries, and adds FontAttributes converter round-trip coverage.
Inferred motivation: Reduce nullable warnings/API drift while preserving converter behavior.
Reconciliation with PR Narrative
Author claims: Nullability improvements, converter refactoring, syntax modernization, PublicAPI updates.
Agreement/disagreement: Matches the code. Prior converter issues appear addressed.
Prior Review Reconciliation
| Prior Finding | Source | Status | Evidence |
|---|---|---|---|
PublicAPI entries incorrectly ~-prefixed |
MauiBot [major] |
✅ Fixed | Current entries are annotated without ~: PublicAPI/net/PublicAPI.Unshipped.txt:115-143 |
StrokeShapeTypeConverter ignored culture for double parsing |
Copilot | ✅ Fixed | Uses double.TryParse(strValue, NumberStyles.Number, culture, ...): StrokeShapeTypeConverter.cs:146 |
FontAttributesConverter.ConvertTo bad separator |
MauiBot summary | ✅ Fixed | Uses string.Join(", ", parts) and has round-trip test: FontAttributes.cs:102, test lines 26-31 |
TargetType typo |
MauiBot summary | ✅ Fixed | Current messages spell TargetType |
Blast Radius Assessment
- Runs for all instances: No; only converter paths / XAML/CSS conversions.
- Startup impact: Low; no new startup path.
- Static/shared state: No new mutable static state in reviewed changes.
CI Status
- Required-check result: fail.
gh pr checks --requiredunavailable due missing auth; GitHub check-runs fallback showsmaui-prfailed. - Classification: undetermined. AzDO build
1509587failed inWindows Helix Unit Tests (Release)dueCreateTimerNonRepeatingDoesNotRepeatNRE in Core dispatcher tests; basenet11.0build1501450had that leg green. Also one iOS integration job was canceled during artifact download. - Action taken: Loaded
azdo-build-investigator; confidence capped low.
Findings
No high-confidence code findings. Step 2 expert reviewer produced inline-findings.json with [].
Failure-Mode Probing
- Null converter inputs: Existing/updated converters either return default/null or throw expected
NotSupportedException/InvalidOperationException; no new NRE found. - Culture-sensitive shape parsing:
culture ??= CurrentCultureandNumberStyles.Numberare now used consistently. - PublicAPI nullability: New converter entries match nullable annotations and are not incorrectly oblivious-prefixed.
Verdict: NEEDS_DISCUSSION
Confidence: low
Summary: Code review found no remaining blocking code issues, and prior review findings appear fixed. I cannot LGTM while required CI is red and not confidently unrelated; the PR needs human/CI follow-up on the Helix failure/canceled leg before merge.
🛠️ Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix | Accept the legacy apostrophe separator by trimming trailing ' before enum parsing. |
✅ PASS | 1 file | Works, but preserves malformed legacy output and broadens accepted syntax. |
| 2 | try-fix | Emit CSS-style space-separated tokens (Bold Italic) from ConvertTo. |
✅ PASS | 1 file | Works via existing parser branch, but changes serialized output away from enum/XAML comma style. |
| 3 | try-fix | Replace manual flag list with attr.ToString() for non-None values. |
✅ PASS | 1 file | Best alternative: smaller than PR fix, preserves comma-style output, automatically handles future flags. |
| PR | PR #30875 | Manually build known flag names and join with ", "; includes broader nullable converter/PublicAPI updates. |
✅ PASSED (Gate) | 18 implementation/API + 1 test | Original PR. |
Expert Review / Learn Loop
| Candidate | Expert-review input | Learned outcome |
|---|---|---|
| 1 | Code-review skill + MAUI expert rules found no remaining blocking converter issue; candidate probed parser-side tolerance. | Passing but not preferred because the bad legacy output remains observable. |
| 2 | Candidate incorporated candidate 1 tradeoff by fixing output instead of parser tolerance. | Passing but not preferred because output switches to CSS-style space tokens. |
| 3 | Candidate incorporated candidate 2 tradeoff by keeping comma-style output while removing manual known-flag enumeration. | Passing and selected as best alternative. |
Test command used for candidates: dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter FontAttributeConverterUnitTests --logger "console;verbosity=minimal"
Environment note: The main worktree had unrelated dirty changes that blocked EstablishBrokenBaseline.ps1. Candidate implementation/testing used an isolated temporary worktree created from PR HEAD, then established the broken baseline there with -BaseBranch net11.0. Gate verification was not re-run and gate/content.md was not modified.
Exhausted: Yes — three meaningfully different root-cause approaches were tested: parser tolerance, alternate output contract, and runtime enum flag formatting. Candidate 3 passes all targeted regression tests and is demonstrably better than the PR's current manual List<string> fix.
Selected Fix: Candidate #3 — Enum.ToString() formatting. It is the smallest passing change, maintains the intended comma-separated flag output, and avoids future maintenance bugs if FontAttributes gains additional named flags.
📝 Recommended PR Title & Description
Assessment: ✏️ Recommend updating — the current title is vague/noisy and the description overstates broad refactoring while missing the actual winning fix and the key FontAttributesConverter round-trip behavior.
Recommended title
[Controls] Converters: Annotate remaining types for nullability and fix FontAttributes round-trip
Recommended description
### Description of Change
Enables nullable reference type annotations across the remaining `Microsoft.Maui.Controls` converter-related classes and updates their `TypeConverter` override signatures to match nullable `System.ComponentModel.TypeConverter` contracts.
The converter updates include:
- `BindablePropertyConverter`
- `ButtonContentTypeConverter`
- `FontAttributesConverter`
- `ListStringTypeConverter`
- `RowDefinitionCollectionTypeConverter`
- `ColumnDefinitionCollectionTypeConverter`
- `GridLengthTypeConverter`
- `ResourceDictionary.RDSourceTypeConverter`
- `StrokeShapeTypeConverter`
- `ShellContentConverter`
- `ShellItemConverter`
- `ShellSectionConverter`
- `ShellNavigationStateTypeConverter`
- `TextAlignmentConverter`
The winning fix for the `FontAttributesConverter` round-trip regression is to return `FontAttributes.ToString()` for non-`None` values. This emits the standard comma-separated flags format (for example, `Bold, Italic`) that the existing comma-separated parser already accepts, instead of the legacy apostrophe-separated output that did not round-trip.
Public API annotations were updated in each `PublicAPI.Unshipped.txt` file for the nullable converter override signatures.
### Key Technical Details
- `FontAttributes.None` continues to convert to an empty string.
- Non-`None` `FontAttributes` values use enum flag formatting rather than manually listing known flags, so future named flags will format consistently without additional converter changes.
- Existing malformed comma-separated inputs should continue to fail fast rather than being silently accepted.
### Issues Fixed
Fixes #
🏁 Report — Final Recommendation
Comparative Candidate Report — PR #30875
Candidates
| Candidate | Result | Assessment |
|---|---|---|
pr |
✅ Gate passed | Fixes the FontAttributesConverter.ConvertTo round-trip bug, but expert review found a blocking parser regression: malformed comma-separated values such as ",", ",,", and "Bold,,Italic" are now silently accepted because of StringSplitOptions.RemoveEmptyEntries. |
pr-plus-reviewer |
✅ Targeted sandbox tests passed | Preserves the PR's broader nullability/PublicAPI changes and fixes the expert-review finding by restoring fail-fast comma parsing. This is the best PR-shaped candidate if the broader converter nullability annotation work is required. |
try-fix-1 |
✅ Passed | Parser-side tolerance for the legacy apostrophe output works, but it preserves malformed serialized output and broadens accepted syntax. It is ranked below output-side fixes. |
try-fix-2 |
✅ Passed | Emits CSS-style space-separated tokens, which round-trip through the existing parser, but changes serialized output away from enum/XAML comma style. |
try-fix-3 |
✅ Passed | Uses FontAttributes.ToString() for non-None values. This produces the same comma-separated style needed for round-trip compatibility, preserves the existing comma parser behavior, and avoids hard-coding every known flag. |
Ranking
try-fix-3— best isolated fix for the proven regression. It is the smallest passing change, preserves the expected comma-separated enum/XAML output, avoids the raw PR's parser-leniency regression, and is more future-proof than manually listingBoldandItalic.pr-plus-reviewer— best PR-shaped option. It keeps the PR's broader nullability annotation and PublicAPI changes and addresses the expert reviewer's blocking feedback, but itsConvertToimplementation remains more manual than necessary.try-fix-2— passes, but changes the output contract to CSS-style space-separated tokens.try-fix-1— passes, but fixes the symptom by tolerating legacy malformed output rather than correcting output generation.pr— passes the supplied gate, but ranks below all passing alternatives because it introduces a newly confirmed malformed-input parsing regression.
Winner
Winner: try-fix-3
try-fix-3 is the strongest candidate for the specific regression covered by the gate: it fixes round-tripping by delegating flag formatting to the runtime enum formatter, preserves comma-separated output, avoids accepting malformed comma input, and naturally handles future FontAttributes flags without additional code changes. No candidate failed regression tests, so the ranking is based on correctness, behavioral compatibility, and maintenance risk.
🧭 Next Steps — alternative fix proposed (try-fix-3)
Automated review — alternative fix proposed
The expert-reviewer evaluation compared the PR fix against automatically generated candidates and selected try-fix-3 as the strongest fix.
Why: try-fix-3 wins because it is the smallest passing fix for the FontAttributes round-trip regression, emits the expected comma-separated enum format, preserves existing malformed comma-input failures, and avoids manual flag enumeration.
Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.
Candidate diff (try-fix-3)
diff --git a/src/Controls/src/Core/FontAttributes.cs b/src/Controls/src/Core/FontAttributes.cs
--- a/src/Controls/src/Core/FontAttributes.cs
+++ b/src/Controls/src/Core/FontAttributes.cs
@@ -69,12 +69,7 @@ namespace Microsoft.Maui.Controls
throw new NotSupportedException();
if (attr == FontAttributes.None)
return "";
- var parts = new List<string>();
- if ((attr & FontAttributes.Bold) == FontAttributes.Bold)
- parts.Add(nameof(FontAttributes.Bold));
- if ((attr & FontAttributes.Italic) == FontAttributes.Italic)
- parts.Add(nameof(FontAttributes.Italic));
- return string.Join("' ", parts);
+ return attr.ToString();
}
}
}
● Fresh AI review completed on Gate: ✓ PASSED — Final Recommendation: ✗ not yet APPROVE — Confidence Low. The expert-reviewer pass found one blocking parser regression that keeps this from a clean LGTM:
ℹ Path to APPROVE — the reviewer ranked candidate - var parts = new List<string>();
- if ((attr & FontAttributes.Bold) == FontAttributes.Bold)
- parts.Add(nameof(FontAttributes.Bold));
- if ((attr & FontAttributes.Italic) == FontAttributes.Italic)
- parts.Add(nameof(FontAttributes.Italic));
- return string.Join("' ", parts);
+ return attr.ToString();This is the smallest passing change, preserves the expected comma-separated output, avoids hard-coding each flag, and — paired with rejecting empty split entries in @NirmalKumarYuvaraj — pushing that update will auto re-trigger the review workflow and re-evaluate. Once the parser-strictness finding is resolved, the next round should reach APPROVE. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
Test Failure Review: Not ready - click to expandOverall verdict: Not ready. The deterministic gate flags 154 UITest legs as red on this PR but green across the 5 recent
Coverage: 141 checks · 124 passing · 16 failing · 1 pending · 0 inaccessible · 1 unmapped · 24 unexplained build legs · 0 unaccounted failing checks · 3 aborted failing checks · 0 canceled-build checks · 6 device-test unverified · 38 unattributed · 154 regressed-vs-base. Deterministic ceiling: Not ready — 154 legs regressed vs base plus a pending check and 24 unexplained build legs. Builds (this PR): maui-pr 1514757, maui-pr-devicetests 1514760, maui-pr-uitests 1514758. Base sampling (net11.0, 5 recent builds per definition): maui-pr 1501450, maui-pr-devicetests 1501451, maui-pr-uitests 1501538. Recommended actionHave a human confirm whether the 154 regressed-vs-base UITest legs are a genuine regression or an Appium harness/infrastructure flake (rerun the |
kubaflo
left a comment
There was a problem hiding this comment.
Can you please resolve conflicts?
Resolve PublicAPI.Unshipped.txt conflicts while retaining both converter annotations and current net11 API additions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a6db2315-d16d-4f19-94ec-2e5a7cbccda6
Reject malformed FontAttributes tokens, retain exponent-aware StrokeShape parsing, and align the compiled converter with runtime behavior. Add runtime, XamlC, and SourceGen regression coverage and restore final newlines in touched files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a6db2315-d16d-4f19-94ec-2e5a7cbccda6
Cover invalid BindableProperty values, whitespace-only font attributes, and invariant compiled StrokeShape parsing under a non-invariant build culture. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a6db2315-d16d-4f19-94ec-2e5a7cbccda6
Preserve specific VisualState parent errors while guarding every truncated chain, annotate the nullable type lookup, document StrokeShape culture semantics, and record the SourceGen fallback prerequisite. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a6db2315-d16d-4f19-94ec-2e5a7cbccda6
Restore the test culture explicitly and cover every specific VisualState parent-chain diagnostic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a6db2315-d16d-4f19-94ec-2e5a7cbccda6
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
src/Controls/src/Core/FontAttributes.cs:53
- When parsing space-delimited (CSS/single-value) inputs,
strValue.Split(' ')will produce empty tokens for repeated spaces (e.g., "bold italic"), which then throws inParseSingleAttribute. Since this converter already trims and treats whitespace-only input asNone, it should also ignore empty tokens caused by repeated spaces by usingStringSplitOptions.RemoveEmptyEntries.
// CSS or single value
foreach (var part in strValue.Split(' '))
{
attributes |= ParseSingleAttribute(part, strValue);
}
src/Controls/tests/Core.UnitTests/FontAttributeConverterUnitTests.cs:20
Assert.Equalexpects(expected, actual); the current argument order is reversed, which makes failures harder to interpret.
Assert.Equal(conv.ConvertFromInvariantString(input), expected);
|
/azp run maui-pr |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run maui-pr |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Annotates the remaining .NET MAUI Controls type converters for nullable reference types and updates the seven platform PublicAPI ledgers to match their actual override contracts.
The review also uncovered and fixes several converter failure paths:
StrokeShapeTypeConverterTypeConvertercalls.RoundRectanglefor a numeric radius instead of constructing aRectangleand invoking aRoundRectanglesetter on it.FontAttributesConverterFontAttributes.None.BindablePropertyConverternullrather than throwing aNullReferenceExceptionfor unresolved direct-converter type names.XamlParseExceptionwith the most specific available diagnostic.TextAlignmentConverter.Root Cause
Several converters still used nullable-oblivious override signatures. While annotating them, tests exposed assumptions that were hidden by the old implementation: build-time parsing depended on the build host's culture, the compiled numeric
StrokeShapefallback emitted the wrong shape type,FontAttributesused a non-round-trippable separator, andBindablePropertyresolution indexed parent chains without checking their length.Compatibility Notes
TypeConverter.ConvertFrom(context, culture, value)calls honor the supplied culture.What NOT to Do
FontAttributestokens; malformed comma-delimited values must remain errors.StrokeShapeConverteruntil its numericRoundRectanglefallback is implemented.Validation
dotnet cake --target=dotnet-build --configuration=Release --verbosity=normalIssues Fixed
No linked issue.