Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

ImageSource.FromFile behaves differently on Android 10 to 9 #12897

Open
Confusedfish opened this issue Nov 18, 2020 · 1 comment
Open

ImageSource.FromFile behaves differently on Android 10 to 9 #12897

Confusedfish opened this issue Nov 18, 2020 · 1 comment

Comments

@Confusedfish
Copy link

Description

When displaying an image using a file based image source the behaviour is different between Android 9 & Android 10. iOS behaves close to Android 9 but is also different.

Possibly related to issue #5631

Steps to Reproduce

  1. Create a plain Xamarin project
  2. Add an image using a URL source to the MainForm.xslx
  3. Add an image without a source and give it a name on the MainForm.xlsx
  4. Using code, download a the same URL to the local file system and use ImageSource.FromFile to reference the binary file
  5. Set both images to have the same HeightRequest

Alternatively see attached example reproduction solution and compare output on Android 9/10/iOS

Expected Behavior

The two images to be identical

Actual Behavior

The images are of different widths & heights on Android 10 and iOS 14.1

Basic Information

  • Version with issue: Xamarin.Forms.4.8.0.1451 (same behaviour in 5.0.0.1709-pre4)
  • Last known good version: Unknown
  • Platform Target Frameworks:
    • iOS: 14.1
    • Android: 9 / 10
    • UWP: Untested
  • Android Support Library / AndroidX Version:
  • NuGet Packages: Xamarin.Essentials.v1.5.3.2
  • Affected Devices:

Environment

Microsoft Visual Studio Enterprise 2019
Version 16.8.1
VisualStudio.16.Release/16.8.1+30711.63
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Enterprise

Visual C++ 2019   00435-60000-00000-AA662
Microsoft Visual C++ 2019

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.8.550.19892
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019   16.8.550.19892
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.8.550.19892
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.8.550.19892
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node   2.6.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.6.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.8.43 (00471f8)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   5.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Snapshot Debugging Extension   1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.62010.06180
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.21016.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   16.8.000.255 (d16-8@d002176)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.8.0.507 (remotes/origin/d16-8@e87b24884)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.8.112 (86385a3)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.1.0.17 (d16-8/c0e2b8e)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: be2226b
    Java.Interop: xamarin/java.interop/d16-8@79d9533
    ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
    SQLite: xamarin/sqlite/3.32.1@1a3276b
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc


Xamarin.iOS and Xamarin.Mac SDK   14.4.1.3 (e30c41de3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

See example solution

Screenshots

Android 9

Screenshot_1605727675

Android 10

Screenshot_1605727951

iOS 14.1

2020-11-18_07-30-34-PM

Reproduction Link

XamarinTestImageSizing.zip

Workaround

Setting both the image HeightRequest and WidthRequest seems to get round the problem but is impractical.

@Confusedfish Confusedfish added s/unverified New report that has yet to be verified t/bug 🐛 labels Nov 18, 2020
@samhouts samhouts added this to New in Triage Nov 18, 2020
@jsuarezruiz
Copy link
Contributor

Thanks for the attached sample. Seems to be the same or related with #5631

@jsuarezruiz jsuarezruiz added e/3 🕒 3 and removed s/unverified New report that has yet to be verified labels Nov 19, 2020
@jsuarezruiz jsuarezruiz moved this from New to Ready For Work in Triage Nov 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Triage
  
Ready For Work
Development

No branches or pull requests

2 participants