Skip to content

[iOS] RadioButton throws CGContextSetLineWidth - Fix#25542

Merged
PureWeen merged 2 commits intodotnet:mainfrom
kubaflo:fix-25273
Nov 9, 2024
Merged

[iOS] RadioButton throws CGContextSetLineWidth - Fix#25542
PureWeen merged 2 commits intodotnet:mainfrom
kubaflo:fix-25273

Conversation

@kubaflo
Copy link
Copy Markdown
Contributor

@kubaflo kubaflo commented Oct 26, 2024

Description of Change

The error occurred because the default value for Border.StrokeThickness was set to -1. Instead of changing this default to 0, I implemented a converter that ensures Border.StrokeThickness never receives negative values.

Issues Fixed

Fixes #25273

Before
Screenshot 2024-10-26 at 15 19 01

@kubaflo kubaflo requested a review from a team as a code owner October 26, 2024 18:04
@kubaflo kubaflo requested review from Eilon and tj-devel709 October 26, 2024 18:04
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 26, 2024
@kubaflo kubaflo added area-controls-radiobutton RadioButton, RadioButtonGroup platform/ios labels Oct 26, 2024
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo kubaflo requested a review from jsuarezruiz October 28, 2024 11:37
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

jsuarezruiz
jsuarezruiz previously approved these changes Oct 31, 2024
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

border.SetBinding(Border.StrokeThicknessProperty, static (RadioButton rb) => rb.BorderWidth, source: RelativeBindingSource.TemplatedParent);

// NonNegativeValueConverter ensures that StrokeThickness remains non-negative as the default value of -1 triggers a CGContextSetLineWidth error on iOS.
border.SetBinding(Border.StrokeThicknessProperty, static (RadioButton rb) => rb.BorderWidth, source: RelativeBindingSource.TemplatedParent, converter: new NonNegativeValueConverter());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can this be fixed inside the Border control?

So the border control could also check if this value is getting set to -1?
This fix feels isolated to only fixes RB's use of Border vs border as a larger use case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Nov 3, 2024

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen merged commit 50adaed into dotnet:main Nov 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-radiobutton RadioButton, RadioButtonGroup community ✨ Community Contribution fixed-in-9.0.21 platform/ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RadioButtonGroup/RadioButton throw CGContextSetLineWidth error on iOS 18.0/18.1.

4 participants