Skip to content

Multiple ToolkitBoolOptions causes crash #20

@niels9001

Description

@niels9001

Describe the bug

There seems to be an issue that whenever defining two ToolkitBoolOptions the source generator throws an error. Seems that whenever the second bool is bind to it crashes. Probably due to changes made in: CommunityToolkit/Labs-Windows#336

<labs:SettingsExpander IsExpanded="{x:Bind IsCardEnabled, Mode=OneWay}"/>

This works:

[ToolkitSampleBoolOption("IsCardEnabled", true, Title = "Is Enabled")]
[ToolkitSampleBoolOption("IsCardExpanded", false, Title = "Is Expanded")]

This does not (see change in order):

[ToolkitSampleBoolOption("IsCardExpanded", false, Title = "Is Expanded")]
[ToolkitSampleBoolOption("IsCardEnabled", true, Title = "Is Enabled")]

Tested with two ToolkitTextOptions and that seemed to work fine.

System.InvalidOperationException: Sequence contains no matching element at System.Linq.Enumerable.First[TSource](IEnumerable1 source, Func2 predicate) at SettingsControlsExperiment.Samples.SettingsExpanderSample.get_IsCardEnabled() in C:\Repos\Labs-Windows\labs\SettingsControls\samples\SettingsControls.Samples\CommunityToolkit.Labs.Core.SourceGenerators\CommunityToolkit.Labs.Core.SourceGenerators.ToolkitSampleOptionGenerator\SettingsControlsExperiment.Samples.SettingsExpanderSample.Property.IsCard

@Arlodotexe FYI

Steps to reproduce

- Open the SettingsControls experiment on main
- Run samples, navigate to "SettingsExpanderSample"
- Crash

Expected behavior

Not crash

Screenshots

No response

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Additional context

No response

Help us help you

Yes, but only if others can assist.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions