Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppCrash with Combination: SettingsExpander, WinUI3, No Debugger Attached #302

Closed
3 of 24 tasks
c3rebro opened this issue Dec 15, 2023 · 6 comments
Closed
3 of 24 tasks

Comments

@c3rebro
Copy link

c3rebro commented Dec 15, 2023

Describe the bug

Hello,

i got an AppCrash when trying to run my App. EventVwr shows a often produced error:

...
Name of Module: KERNELBASE.dll, Version: 10.0.19041.3636,
Ausnahmecode: 0xc000027b
Offset: 0x000000000012db22
...

I never had this issue before. What i had changed was: I wanted to get rid of the dependency from "winuicommunity" package. I had made use of their settingscontrols package. So i recreated my project with all usercontrol elements in "Communitytoolkit.winui". The App seems to crash befor a single
try { } catch() { }
has been executed.

Steps to reproduce

One can reproduced the error as follows: 
(P.S: Markdowneditor is not working here. Is this a wanted behaviour?)

1. Install a WinUI3 Template from TemplateStudio. Select: blank page, mvvm, navigation and a SettingsPage
2. Add <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> to the csproj File to make it compile
3. Add Packages: 
- Communitytoolkit.WinUI 7.1.2
- CommunityToolkit.WinUI.Controls.SettingsControls 8.0.230907
- Communitytoolkit.WinUI.UI 7.1.2
- Communitytoolkit.WinUI.UI.Controls 7.1.2
5. Add a Settingsexpander around the Themeselector on the Settingspage like so:

xmlns:controls="using:CommunityToolkit.WinUI.Controls"

                <controls:SettingsExpander 
                    IsExpanded="False"
                    Description="Ansichteinstellungen"
                    Header="Thema">
                    <controls:SettingsExpander.HeaderIcon>
                        <FontIcon Glyph="&#xE1A5;"/>
                    </controls:SettingsExpander.HeaderIcon>
<controls:SettingsExpander.Items>
    <StackPanel Margin="{StaticResource XSmallTopMargin}">
...

6. Compile and run the App with Debugger Attached
7. Go to "Settings", see the Expander working.
8. Run the app again, without the debugger attached and visit the settingspage again
9. expand the expander

Expected behavior

The Expander is expanding

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 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • 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)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

17.8.3

Device form factor

Desktop

Additional context

P.S. Markdown Editor is Missing in the "Steps to reproduce" section...

Help us help you

No, I'm unable to contribute a solution.

@c3rebro
Copy link
Author

c3rebro commented Dec 15, 2023

I have the latest Win AppSDK Version 1.4.231115000 already installed.

@niels9001
Copy link
Collaborator

@c3rebro Could you try wrapping the StackPanel in a SettingsCard? The SettingsExpander.Items is expecting a SettingsCard.

You can then set the ContentAlignment on the SettingsCard to Left or Vertical and set the Horizontal(Content)Alignment to Stretch to let the StackPanel stretch. Check out the samples in the Windows Community Toolkit Gallery app (in the Store) to see more of those examples.

@c3rebro
Copy link
Author

c3rebro commented Dec 15, 2023

Whoa. That did the Trick. Thank you so much. 🥇

@Poker-sang
Copy link
Contributor

Poker-sang commented Sep 29, 2024

Could you try wrapping the StackPanel in a SettingsCard? The SettingsExpander.Items is expecting a SettingsCard.

@niels9001 Is it possible to hint that SettingsCard should be passed into Items by writing xmldoc or restricting the type?

@Arlodotexe
Copy link
Member

@c3rebro Could you try wrapping the StackPanel in a SettingsCard? The SettingsExpander.Items is expecting a SettingsCard.

You can then set the ContentAlignment on the SettingsCard to Left or Vertical and set the Horizontal(Content)Alignment to Stretch to let the StackPanel stretch. Check out the samples in the Windows Community Toolkit Gallery app (in the Store) to see more of those examples.

I wonder if we could build an analyzer for this? Seems like something IntelliSense should handle.

@vilgotf
Copy link

vilgotf commented Nov 17, 2024

Could you try wrapping the StackPanel in a SettingsCard? The SettingsExpander.Items is expecting a SettingsCard.

niels9001 Is it possible to hint that SettingsCard should be passed into Items by writing xmldoc or restricting the type?

Brought up again in #560

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

No branches or pull requests

5 participants