Closed mcocaroUX closed 9 months ago
@mcocaroUX Is there any specific reason why you're using the
var window = (Application.Current as App)?.Window;
...
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(window);
WinRT.Interop.InitializeWithWindow.Initialize(fileOpenPicker, hwnd);
What is the result you get when calling the picker with this code?
public async ValueTask PickImage(CancellationToken ct)
{
var fileOpenPicker = new FileOpenPicker
{
SuggestedStartLocation = PickerLocationId.ComputerFolder
};
string[] fileTypes = { ".jpg", ".jpeg", ".png", ".gif" };
fileOpenPicker.FileTypeFilter.AddRange(fileTypes);
var ret = await fileOpenPicker.PickSingleFileAsync();
if (ret?.Path != null)
{
// Do something with the file
}
else
{
// User cancelled
}
}
@ajpinedam Thanks for your answer. As described on the documentation those lines are needed in order to the code wont fail.
I tested the code you sent and the outcome remains the same
@ajpinedam Thanks for your answer. As described on the documentation those lines are needed in order to the code wont fail.
I tested the code you sent and the outcome remains the same
Thanks for the reply. Yes, I re-ran the sample you provided and was able to reproduce the issue you reported.
We pushed a fix yesterday, which should have already been merged and made available in one of the latest Uno versions.
cc: @mcocaroUX
The backport is now available in 5.1.64.
@jeromelaban @ajpinedam This fix doesn't seem to be available on 5.1.64
, I'm still getting the same issue
@mcocaroUX make sure to validate that the output binaries contain the right uno versions. You can check that by looking at the assembly versions.
@jeromelaban Thanks. I always clean my projects when having this kind of issues. Anyways I checked the binaries and they seem to have the correct version
@mcocaroUX Can you provide a new stack trace of the issue?
@jeromelaban We solved it, it was some missing entitlement on our side. Thanks for your help!
Thanks. Can you tell which entitlement you were missing? We may be able to enhance our docs with it.
Current behavior
When calling
FileOpenPicker.PickSingleFileAsync
it throws:Expected behavior
FileOpenPicker.PickSingleFileAsync
should open file picker correctlyHow to reproduce it (as minimally and precisely as possible)
Repro project: MacIssue.zip
Workaround
I tried using
UIKit.UIApplication.SharedApplication.InvokeOnMainThread
but I got the same result.Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
Affected platforms
Mac Catalyst
IDE
Visual Studio Code
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response