Skip to content

Fixed crash in Toolkit SfButton due to VisualStateManager API changes in NET 11#398

Merged
PaulAndersonS merged 1 commit into
mainfrom
VisualState_NET11
Jul 2, 2026
Merged

Fixed crash in Toolkit SfButton due to VisualStateManager API changes in NET 11#398
PaulAndersonS merged 1 commit into
mainfrom
VisualState_NET11

Conversation

@TameemAnsari-SF4702

@TameemAnsari-SF4702 TameemAnsari-SF4702 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Root Cause of the Issue

Application crash occurs when using SfButton in .NET MAUI during .NET 11 compatibility testing. The crash is triggered by the call to VisualStateManager.GetVisualStateGroups(this);

The issue occurs due to framework changes in .NET 11, where the return type of visual state group retrieval has been modified.
Previously:
public static IList<VisualStateGroup> GetVisualStateGroups(VisualElement visualElement)
Now
public static VisualStateGroupList GetVisualStateGroups(VisualElement visualElement)
Framework PR: dotnet/maui#33849

Description of Change

Resolved the issue by removing the GetVisualStateGroups implementations:

var stateGroup = VisualStateManager.GetVisualStateGroups(this);

from both SfButton, avoiding the incompatible API usage and preventing the crash.

@PaulAndersonS PaulAndersonS merged commit 20b0ba4 into main Jul 2, 2026
@PaulAndersonS PaulAndersonS added this to the v1.0.11 milestone Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants