ShareTarget icon shows up as blank, at least in some cases (Android + .net 8.0)
Description
Issue is that since .net 8.0 the share target icon is no longer rendering for me. Except for when I use the template AppIcon.svg (.net 8) foreground + background. I think the bug popped up in the previews already, but it's definitely not fixed in the current GA release 8.0.3
It used to work fine in .net 7.0 // MAUI for .net7. I've just confirmed this by installing the app I uploaded to the store which was on SR6 I believe (yay, my icon was back!), so it's not related to anything that happened on my phone in the meantime.
The AppIcon itself is fine and shows up in the app drawer and such, and some applications like Firefox have integrated their own type of sharing blade it seems, it also shows up there. But when using most apps, like Whatsapp or the Gallery app, it doesn't.
I've tried many things, including resizing the original png file and including it as png instead of svg, generated by Dall-E by the way, I've tried giving it the name of the template svg.
This is a case where it's not showing up:
I've uploaded an example of the case where it's not working. This is
- basically a new MAUI app for .net 8, straight from the template, => with adjustment in MainActivity to make it show up as a share target for all files (in MainActivity.cs)
And I've included my icon, beamoflightsvg.svg , as a MauiIcon.
Note that this is different from the other MauiIcon issue I found https://github.com/dotnet/maui/issues/19448, as this issue was present before .net 8.0
I suspect it has something to do with that my svg is a single file, and the template one uses two svgs: A foreground and a background?
Steps to Reproduce
- Clone repo at https://github.com/jkommeren/ShareTargetTester
- Deploy or debug at Android device
- Open "affected" app, like "My Files" or "Whatsapp"
- Select a file, an image for example
- Select Share
- (Click More to show all apps)
- App is listed, but icon is blank
Link to public reproduction project repository
https://github.com/jkommeren/ShareTargetTester
Version with bug
8.0.3
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
7.0 SR6
Affected platforms
Android
Affected platform versions
Android 14 (Samsung phone)
Did you find any workaround?
- Downgrade to .net 7.0.
- Possibly converting the image into something else? If anyone has tips on that I'd be happy with it as a workaround.
- Use the default svg icon which says ".NET". But my app got rejected before because my app icon was the default template svg xd
Relevant log output
No response
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.
Update: Found a workaround.
By using MauiImage of the svg instead of MauiIcon, resizing still works, just the generation of the _round bit does not.
So added the svg under different name as MauiImage (to keep other platforms working)and referred to it as @drawable/nameofsvg in the android manifest under Icon (instead of @mipmap/). Now I have a square icon in some cases, but that'll do for me for now.
Im also pretty confident now the bug is specific to MauiIcon.
Also tried generating and using android vector, but resizeter does not work with that so i got ugly borders in some cases.
I would love to have a go at fixing the issue, if someone could point me towards the code where this stuff is happening.