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.99k stars 1.72k forks source link

MauiImage resource not displaying #7234

Open olicooper opened 2 years ago

olicooper commented 2 years ago

Description

~If a MauiImage resources is added with an underscore it isn't displayed on the page.~ Originally I thought it was the image naming that was causing the issue because sometimes it would work fine, but I now think it is the way it is compiled because I couldn't consistently reproduce the issue...

The image is 500x100, but it is being reported in the device logs as 10x bigger. I have tried referencing png and jpg versions of the file. If you use an image which is 400x80 it works fine (because this is under the 4096 limit).

The device log: OpenGLRenderer Bitmap too large to be uploaded into a texture (5000x1000, max=4096x4096) The resource is defined as follows: <MauiImage Update="Resources\Images\logo_large.jpg" BaseSize="100,493" />

I can change the source to an external URL and it loads fine. ~I can also change the image file name to logolarge.jpg, update the MauiImage resource, re-compile and it works again. It seems the underscore is causing the issue.~

This was tested on Android 7.0, and the manifest versions is <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />

Steps to Reproduce

Use an image that is 500px wide by 100px high

<Image
                Source="logo_large.jpg"
                Grid.Row="0"
                HeightRequest="100"
                SemanticProperties.HeadingLevel="Level1"
                HorizontalOptions="Center"
                />

Version with bug

Release Candidate 3 (current)

Last version that worked well

Unknown

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android 7.0

Did you find any workaround?

Remove the underscore

Relevant log output

No response

XamlTest commented 2 years ago

Verified this issue with Visual Studio Enterprise 17.3.0 Preview 2.0 [32515.61.main]. Repro on Android 7, not repo on Android 12. Sample Project: MauiApp4.zip

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

DeerSteak commented 1 year ago

Every image I add toa project gets added to an ItemGroup with a tag like:

    <ItemGroup>
      <MauiImage Remove="Resources\Images\screen3.png" />
    </ItemGroup>

The fix is to unload the project, edit the project file, and reload, and everything is fine. It's annoying, though. I also have to do somethign similar for every single C# file.

AnnYang01 commented 1 year ago

Verified this on Visual Studio Enterprise 17.6.0 Preview 6.0. This issue does not repro on Android emulator (13.0-API 33) but repro on Android emulator (7.0-API 24). MauiApp5.zip