Open tipa opened 1 month ago
I think I met the same/related issue on another example (WASDK v1.6, AOT enabled):
SelectionChangedEventArgs args = new([], []);
Throws invalidcastexception: "specified cast is not valid".
@manodasanW Does this look related to the collection expression marshaling issue?
I'm also seeing crashes when setting an IEnumerable
as ItemSource, like this:
comboBox.ItemsSource = Enumerable.Range(0, 10).Select(x => new TestItem(x));
No crash when using .ToList()
comboBox.ItemsSource = Enumerable.Range(0, 10).Select(x => new TestItem(x)).ToList();
If this is a separate issue and you want me to open a new issue, please let me know
Describe the bug
When building the app with
PublishAot=true
, getting a string array fromApplicationData.Current.LocalSettings
and casting it to thestring[]
type I get:System.InvalidCastException: 'Unable to cast object of type 'WinRT.IInspectable' to type 'System.String[]'.'
Steps to reproduce the bug
Set in csproj:
<PublishAot>true</PublishAot>
Expected behavior
No crash
Screenshots
NuGet package version
Windows App SDK 1.6.0: 1.6.240829007
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
Example project: Test.zip