Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] Visual State Manager crashes application when using controltemplate #10710

@SFSteve

Description

@SFSteve

Description

When using Visual State Manager, if the VisualStateGroup is placed on a parent element with a TargetName on a page that uses a control template, the application crashes when Setter.Apply fires.

The issue seems to be caused by the TargetName property of the Setter, in that line 58 of Xamarin.Forms.Core/Setter.cs is throwing a null exception when trying to perform element.FindByName(TargetName)
Commenting out the ControlTemplate in the ContentView results in everything working as expected, as seen in the provided example app.

VSMTestApp.zip

Steps to Reproduce

  1. Create an app with a page that uses a control template
  2. Add a stacklayout with one or more child elements
  3. Apply a visual state group to the stacklayout and make the TargetName of the setter the child element
  4. Fire the GoToState method against the stacklayout

Expected Behavior

The child element property is set

Actual Behavior

The application crashes with a null value exception

Basic Information

  • Version with issue: All
  • Last known good version: None
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:
    • Android: 9.0
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

Reproduction Link

Workaround

Metadata

Metadata

Assignees

No one assigned

    Labels

    a/VSMe/3 🕒3i/highCompletely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less oftent/bug 🐛

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions