Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageFormatException when loading GIF image on Android with Hybrid AOT mode #1338

Closed
tranb3r opened this issue Sep 3, 2020 · 14 comments
Closed
Labels
area:aot upstream-issue Issue depends on upstream dependency fix.

Comments

@tranb3r
Copy link

tranb3r commented Sep 3, 2020

Description

When enabling Hybrid AOT mode on Android, GIF images cannot be loaded by ImageSharp (ImageFormatException).

Steps to Reproduce

Load GIF image in a Xamarin app on android.
Make sure to enable hybrid aot mode in csproj (requires VS 2019 16.8 preview because of a regression in 16.7.*).

System Configuration

  • ImageSharp version: 1.0.1
  • Environment : Xamarin Android
@JimBobSquarePants
Copy link
Member

Do you have a stacktrace?

@antonfirsov
Copy link
Member

The Gif would be also very helpful.

@tranb3r
Copy link
Author

tranb3r commented Sep 3, 2020

Any gif. For example, base_1x4.gif from the test suite.

Here is the stacktrace:

SixLabors.ImageSharp.UnknownImageFormatException: Image cannot be loaded. Available decoders:
- GIF : GifDecoder
- JPEG : JpegDecoder
- BMP : BmpDecoder
- PNG : PngDecoder
- TGA : TgaDecoder

 at SixLabors.ImageSharp.Image.Load(SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream, SixLabors.ImageSharp.Formats.IImageFormat& format)
 at SixLabors.ImageSharp.Image.Load(System.IO.Stream stream, SixLabors.ImageSharp.Formats.IImageFormat& format)
 at ....

@JimBobSquarePants
Copy link
Member

And it's only Gifs yeah?

All other image formats work ok and use the same stream loading pipeline?

@tranb3r
Copy link
Author

tranb3r commented Sep 3, 2020

Yes ,this exception is only happening for GIF images.
With PNG files I'm also having an issue when enabling Hybrid AOT, but it's probably something else and I'm working on it to provide more details.

@tranb3r
Copy link
Author

tranb3r commented Sep 3, 2020

About PNG files:
Image.Load does not throw any exception
The loaded image object has correct width and height.
However, the loaded image is totally blank !

@brianpopow
Copy link
Collaborator

@tranb3r i have just tried to reproduce this, but i was able to load the base_1x4.gif fine.

I have just added to the project file:

<AotAssemblies>true</AotAssemblies>
<AndroidAotMode>Hybrid</AndroidAotMode>

Is that all what's needed or do i miss something? Maybe you could you share your project file?

Im using VS Version 16.8.0 Preview 2.1

@tranb3r
Copy link
Author

tranb3r commented Sep 5, 2020

@brianpopow Thank you for testing.
Yes, that's all you need to add to the project file (in the Release section of course).

@brianpopow
Copy link
Collaborator

@tranb3r i really did placed it in the debug section instead of the Release one 😬

Unfortunately i still cannot reproduce the issue. The app now crashes immediately when started.
My experience with app's is very limited, so im not sure why that's happening. I have just added the two lines mentioned above to a blank xamarin project.

@tranb3r
Copy link
Author

tranb3r commented Sep 6, 2020

I think hybrid aot is limited to 64bit arch. Which device are you testing on ?

@brianpopow
Copy link
Collaborator

ok so that may be the reason then, my device has a ARMv7, so its 32bit. Is it possible to reproduce this with an emulator?

@tranb3r
Copy link
Author

tranb3r commented Sep 6, 2020

I'm not sure it'll work on the emulator. I think it's only for arm64-v8a devices.

@JimBobSquarePants JimBobSquarePants added upstream-issue Issue depends on upstream dependency fix. and removed needs triage labels Oct 13, 2020
@JimBobSquarePants
Copy link
Member

We need someone to raise an issue upstream here for us to track. We can't fix issues with the AOT compiler.

@JimBobSquarePants
Copy link
Member

I'm going to close this. It's been several years without any update on upstream issues raised..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:aot upstream-issue Issue depends on upstream dependency fix.
Projects
None yet
Development

No branches or pull requests

4 participants