Open dotMorten opened 6 hours ago
I was under the impression that arrays are illegal to use outside of parameters in the WinRT type system.
https://learn.microsoft.com/en-us/uwp/winrt-cref/winrt-type-system#array-parameters
@dongle-the-gadget are you saying we can't store any binary data (like data encrypted with the DataProtectionProvider) in the application settings? I mean it works fine - it's only in AoT mode it doesn't. .NET Native with UWP works fine also.
It works but seems like undocumented behavior. The supported list of types in docs also doesn’t mention arrays. I suppose though that you can probably cast the object into an IPropertyValue and get the array from there.
By any chance did you disable IReference support?
By any chance did you disable IReference support?
Not that I know off? The code is in a net8.0-windows library. No explicit reference to WindowsAppSDK.
Describe the bug
To Reproduce
Replace the MainWindow.xaml.cs code with the following:
Unable to cast object of type 'WinRT.IInspectable' to type 'System.Byte[]'.
Expected behavior App settings gets the byte[].
Version Info WinAppSDK 1.6.0, CSWinRT 2.1.3
Additional context Also tried:
.As<byte[]>()
.As<IEnumerable<byte>>().ToArray()
Enumerable.Cast<byte[]>((IEnumerable)settings.Values["Test"])