-
Notifications
You must be signed in to change notification settings - Fork 80
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
Avoid 0xc000027b Application Crash when no DataTemplate is provided for ItemsSource Bindings in SettingsExpander #191
Comments
@RobertK66 Could you try moving the |
Ok, I will try. But i think it does not matter because my original problem was happening in a SettingsPage.xaml which was navigated to by MainWindow containing a NavigationView. Shall I also use a separate ViewModel class? I am not sure if using the code behind as the INotifyPropertyChanged implementation is a wise design decision ;-) ... |
Moved code into SettingsPage Class and XML StackPanel into the grid proposed by the Empty Page template.
Same behaviour:
What's interesting: If I delete the list before clicking the first expand (So the Observable collection is empty) then the empty list opens and no crash! When Adding an Item -> crash! |
Next Version, I tried to use a DataContext object with its own Class in the SettingsPage and changed the Binding to No change. Crashes when started from Windows. Works when started from Visual Studio. Is there any way I can get more crash info!? ( I did use the 'delayed Start' feature from Visual Studio, Started from Windows Start Menu -> VS Debuger gets attached -> everything works without problems again ....) |
@RobertK66 just to be sure, could you try adding a Windows/components/SettingsControls/samples/SettingsExpanderItemsSourceSample.xaml Line 24 in 1609407
And would you mind creating minimal repro (zipped as attachment is fine)? |
There is my repo https://github.com/RobertK66/SettingsExpanderExample/tree/master |
Tried To use an ItemTemlate. Was not sure how to make a DataBinding to System.String. So I changed my ObservableCollection to have MyLine - Objects as content and used this template: no change, again it crashes when used without VS!
|
@RobertK66 I just tried this, and it seems to be solving the issue: <labs:SettingsExpander
MinWidth="200"
Header="My String List"
HeaderIcon="PreviewLink"
ItemsSource="{Binding Path=MyList, Mode=TwoWay}">
<labs:SettingsExpander.ItemTemplate>
<DataTemplate x:DataType="x:String">
<labs:SettingsCard Description="{Binding}" Header="{Binding}">
<HyperlinkButton Content="{Binding}" />
</labs:SettingsCard>
</DataTemplate>
</labs:SettingsExpander.ItemTemplate>
</labs:SettingsExpander> Are you seeing the same? I bet this is because we are doing some things here and the |
Ok, I didn't catch that there have to be SettingCards only in the Expander !!! Yes this now removes the crash. But this is not easy to find and debug...... What I also wonder is, Why the hell does it work so 'normaly' in a Debugger hosted environment started from VS! And Thx. for your fast reply 😄 ! |
@RobertK66 That's great feedback.. would you mind creating a new issue for your latest comment so we can pick up the discussion there? |
Here you are #199 |
Ok, I got the point of closing #199. But the really dis-encouraging thing here is: As a newbie playing around with XAML GUI I do get a 'satisfying result' (ok not nicely rendered but running!) during development and debug. But it is a fatal bug when delivered and installed! Thinking of using WinUi3 (as first serious successor to WPF) in a professional setting one is forced to introduce a really thorough test step on the installed product to find this sort of problems. I saw the video provided with the documentation about the 'Stowed Exception C000027B'. As a senior developer with 30+ years I do understand the complexities of your 'runtime environment'. That said, this now is not about this specific issue ( misuse of component -> better doku ) anymore. I do appreciate your work and seeing Microsofts turnaround from closed to open source is really amazing. Getting a feedback channel from developer to developer is very encouraging and this is how it should be. Thx. a lot and greetings from Vienna, Austria 😄 ! |
Having @michael-hawker s comment on #199 in my head
, while strolling around in several repositories, I found this 😄 : Yes this is an old commit, but I just have a gut feeling that this TextBlock could be the reason that I could run my original code in VS. Maybe having a DefaultTemplate available to avoid fatal situations is not that bad idea at all 😉 ... |
Not sure if this was discussed already somewhere else ...
But (now) I use the prerelease v8.0.230823-rc of this repository (Same issue occurred with last 'experimental' version 0.0.18 from the 'CommunityToolkit.Labs' package).
When binding an ObservableCollection to the ItemsSource attribute of a SettingsExpander, everything works as expected - when started from VisualStudio IDE.
However, when I start the installed App from Windows Start Menu the Application crashes with the first click on the Expander. The Windows Event Logger shows Application Error code 0xc000027b.
Steps to reproduce:
I am using Visual Studio 2022 Version 17.7.2 with AppSdk and Build Tools installed. Made a fresh Solution with "WinUI 3 Desctop - packaged" - Template.
My XAML:
My Code behind:
My (Test) Project XML:
The text was updated successfully, but these errors were encountered: