dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.98k stars 1.71k forks source link

Problems when sharing an image #20434

Open cagriy opened 7 months ago

cagriy commented 7 months ago

Description

Hello,

I am trying to share an image from a .NET 8 Maui application. I am using following code:

        await Share.Default.RequestAsync(new ShareFileRequest
        {
            Title = "Share Image",
            File = new ShareFile(targetFile)
        });

I am having two issues which are likely to be related

On other apps, when an image is shared the thumbnail is displayed correctly and file type .png is not displayed, as it is recognised. Please see attached both screenshots, the one with the missing thumbnail is from Maui application.

Expected behaviour: Maui application to not to give errors, recognise the file as an image correctly and display the thumbnail.

image image

Steps to Reproduce

1 - Download the sample app from the public repository and run it 2 - Click button to share 3 - Confirm missing thumbnail, unrecognised file type 4 - Confirm error logs 5 - Continue and save the file locally 6 - Now try to share the saved file from Files application 7 - Confirm that the file is correctly recognised as a PNG and the thumbnail is displayed correctly

Link to public reproduction project repository

https://github.com/cagriy/ShareDemo

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

iOs 16.4, Android 33

Did you find any workaround?

No

Relevant log output

2024-02-07 19:47:23.790186+0000 ShareDemo[98172:11339500] [ShareSheet] Failed to request default share mode for fileURL:file:///Users/user/Library/Developer/CoreSimulator/Devices/6AD9722D-9EDB-45F8-808F-7F835E62F556/data/Containers/Data/Application/C33C5D72-8A38-459C-80B6-83DC4323B68F/Library/dotnet_bot.png error:Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=1538, _LSFunction=runEvaluator}
2024-02-07 19:47:23.838994+0000 ShareDemo[98172:11339500] [ShareSheet] Only support loading options for CKShare and SWY types.
2024-02-07 19:47:23.858938+0000 ShareDemo[98172:11339500] [ShareSheet] error fetching item for URL:file:///Users/user/Library/Developer/CoreSimulator/Devices/6AD9722D-9EDB-45F8-808F-7F835E62F556/data/Containers/Data/Application/C33C5D72-8A38-459C-80B6-83DC4323B68F/Library/dotnet_bot.png : (null)
2024-02-07 19:47:23.869153+0000 ShareDemo[98172:11339500] [ShareSheet] error fetching file provider domain for URL:file:///Users/user/Library/Developer/CoreSimulator/Devices/6AD9722D-9EDB-45F8-808F-7F835E62F556/data/Containers/Data/Application/C33C5D72-8A38-459C-80B6-83DC4323B68F/Library/dotnet_bot.png : (null)
2024-02-07 19:47:23.941317+0000 ShareDemo[98172:11339773] [ShareSheet] error loading metadata for documentURL:file:///Users/user/Library/Developer/CoreSimulator/Devices/6AD9722D-9EDB-45F8-808F-7F835E62F556/data/Containers/Data/Application/C33C5D72-8A38-459C-80B6-83DC4323B68F/Library/dotnet_bot.png error:Error Domain=NSFileProviderInternalErrorDomain Code=0 "No valid file provider found from URL file:///Users/user/Library/Developer/CoreSimulator/Devices/6AD9722D-9EDB-45F8-808F-7F835E62F556/data/Containers/Data/Application/C33C5D72-8A38-459C-80B6-83DC4323B68F/Library/dotnet_bot.png." UserInfo={NSLocalizedDescription=No valid file provider found from URL file:///Users/user/Library/Developer/CoreSimulator/Devices/6AD9722D-9EDB-45F8-808F-7F835E62F556/data/Containers/Data/Application/C33C5D72-8A38-459C-80B6-83DC4323B68F/Library/dotnet_bot.png.}
2024-02-07 19:47:24.159342+0000 ShareDemo[98172:11339500] Unknown platform linking against CloudDocs framework 7
2024-02-07 19:47:24.350609+0000 ShareDemo[98172:11339500] WARNING: This app's CFBundleDevelopmentRegion is not a string value. This can lead to unexpected results at runtime. Please change CFBundleDevelopmentRegion in your Info.plist to a string value.
2024-02-07 19:47:24.403703+0000 ShareDemo[98172:11339500] [LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: <_UIActivityContentFooterView: 0x15beb3e30; baseClass = UICollectionReusableView; frame = (16 405; 361 52); layer = <CALayer: 0x6000031cf660>>
2024-02-07 19:47:24.439184+0000 ShareDemo[98172:11339500] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600001837b60 _UIActivityActionCellTitleLabel:0x15beab5f0.height >= 22   (active)>",
    "<NSLayoutConstraint:0x600001837610 _UICollectionViewListCellContentView:0x15bea9e80.height >= _UIActivityActionCellTitleLabel:0x15beab5f0.height + 30   (active)>",
    "<NSLayoutConstraint:0x600001867070 'UIView-Encapsulated-Layout-Height' _UICollectionViewListCellContentView:0x15bea9e80.height == 30   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600001837b60 _UIActivityActionCellTitleLabel:0x15beab5f0.height >= 22   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2024-02-07 19:47:24.439664+0000 ShareDemo[98172:11339500] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x6000018312c0 _UIActivityActionCellTitleLabel:0x15beb16f0.height >= 22   (active)>",
    "<NSLayoutConstraint:0x600001830d70 _UICollectionViewListCellContentView:0x15beaff80.height >= _UIActivityActionCellTitleLabel:0x15beb16f0.height + 30   (active)>",
    "<NSLayoutConstraint:0x600001867430 'UIView-Encapsulated-Layout-Height' _UICollectionViewListCellContentView:0x15beaff80.height == 30   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000018312c0 _UIActivityActionCellTitleLabel:0x15beb16f0.height >= 22   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2024-02-07 19:47:24.439938+0000 ShareDemo[98172:11339500] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x6000018362b0 _UIActivityActionCellTitleLabel:0x15bea5550.height >= 22   (active)>",
    "<NSLayoutConstraint:0x600001835d60 _UICollectionViewListCellContentView:0x15bea26b0.height >= _UIActivityActionCellTitleLabel:0x15bea5550.height + 30   (active)>",
    "<NSLayoutConstraint:0x600001867570 'UIView-Encapsulated-Layout-Height' _UICollectionViewListCellContentView:0x15bea26b0.height == 30   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000018362b0 _UIActivityActionCellTitleLabel:0x15bea5550.height >= 22   (active)>
ghost commented 7 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

XamlTest commented 5 months ago

Verified this on VS 17.10.0 Preview 2.0(8.0.7). Repro on iOS 17.2 with below Project: ShareDemo.zip