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

Description
Description
Since updating from XCT 1.0.3 to 1.1.0 the application throws an exception when displaying the main page that contains an Expander.
I found out that the crash happens when I set the property Direction to a value other than Down and whether or not I define a Header. After some digging it seems to come from this line which was added by this commit.
Exception: System.InvalidOperationException: Header not initialized.
Stacktrace (not much)
[mono] System.InvalidOperationException: Header not initialized
[mono] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.7(intptr,intptr,intptr)
[mono] at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.7(intptr,intptr,intptr)
Steps to Reproduce
- Create a blank Xamarin.Forms project
- Install the Xamarin Community Toolkit 1.1.0
- Add
xmlns:xct="http://xamarin.com/schemas/2020/toolkit" to the main page
- Add a simple Expander with a Direction in the content of the main page
<xct:Expander Direction="Right">
<xct:Expander.Header>
<Label Text="header"/>
</xct:Expander.Header>
<Label Text="content"/>
</xct:Expander>
- Launch the app
Expected Behavior
The main page displays with the Expander
Actual Behavior
Visual studio catch an unhandled exception
Basic Information
- Version with issue: 1.1.0
- Last known good version: 1.0.3
- IDE: Visual Studio 2019 16.9.2
- Platform Target Frameworks:
- Android Support Library Version: None
- Nuget Packages:
- Affected Devices:
- Pixel 3XL (Android 11.0)
- Pixel 3a (Emulator, Android 9.0)
- IPhone SE (iOS 14.4)
Workaround
Set the direction to Down, then change it after InitializeComponent() is called.
Reproduction imagery
N/A
Reproduction Link
Repro project (489ko)