-
Notifications
You must be signed in to change notification settings - Fork 693
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
MediaPlayerElement
created from C++/WinRT crashes when AreTransportControlsEnabled
is set to true
#9265
Comments
Does it work if you set AreTransportControlsEnabled to true after you set the MediaPlayerElement as the content of the window? |
@DarranRowe Thanks for the suggestions! All of these also cause a crash unfortunately: MediaPlayerElement player;
Window window;
window.Content(player);
player.AreTransportControlsEnabled(true);
window.Activate(); MediaPlayerElement player;
player.AreTransportControlsEnabled(true);
Grid grid;
grid.Children().Append(player);
Window window;
window.Content(grid);
window.Activate(); MediaPlayerElement player;
player.AreTransportControlsEnabled(true);
StackPanel panel;
panel.Children().Append(player);
Window window;
window.Content(panel);
window.Activate(); |
Just to be sure, is your App definition a properly defined App with the metadata being generated by the Xaml compiler? --Edit-- A properly set up project works. I suspect that you are not implementing IXamlMetadataProvider in App. You would either need to manually implement it as an extra interface, or enable the Xaml compiler in your project. |
@DarranRowe Implementing For reference, this is the adjusted struct App : public ApplicationT<App, IXamlMetadataProvider> {
void
OnLaunched (LaunchActivatedEventArgs const &) {
Resources().MergedDictionaries().Append(XamlControlsResources());
MediaPlayerElement player;
player.AreTransportControlsEnabled(true);
Window window;
window.Content(player);
window.Activate();
}
XamlControlsXamlMetaDataProvider provider;
IXamlType
GetXamlType (hstring const &name) {
return provider.GetXamlType(name);
}
IXamlType
GetXamlType (TypeName const &type) {
return provider.GetXamlType(type);
}
com_array<XmlnsDefinition>
GetXmlnsDefinitions () {
return provider.GetXmlnsDefinitions();
}
}; As an addendum, I'm working on a cross-platform GUI library built and consumed using CMake, hence why I want to stick to plain C++. It's not that I don't think XAML is a worthwhile technology, I simply don't want to push additional build tooling requirements to downstream consumers. Thanks again! |
Yes. The unfortunate thing is that it is documented in the IXamlType documentation. There is a brief explanation in IXamlMetadataProvider too. The issue is that you have to know about this to find the documentation. It would be nice if this was mentioned in the Application documentation. The other big issue is that the exact requirements are not fully documented. The application's side of the generated code is fully visible though. So it is possible to figure it out from this code. |
Describe the bug
Consider the following C++ application:
For some reason, the above application immediately crashes with the following error:
If I remove
player.AreTransportControlsEnabled(true)
it doesn't crash, but I also don't get any transport controls.Steps to reproduce the bug
Expected behavior
No response
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.4.4: 1.4.231219000
Windows version
Windows 11 (22H2): Build 22621
Additional context
If relevant, this is the manifest used:
The text was updated successfully, but these errors were encountered: