xamarin/Xamarin.Forms

ImageSource.FromFile strange work

オープン

#5,631 opened on 2019/03/20

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)C# (1,926 件のフォーク)batch import
3.3.0e/3 :clock3:help wantedi/lowi/regressioninactivep/Androidt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Description

Setting image source from file path works differently depending on file location and on Xamarin Forms version. The following code in xaml leads to different image sizes (see screenshots) with different Xamarin Forms versions.

<StackLayout Orientation="Vertical"> <Image Source="Octocat.png" Aspect="AspectFit"/> <Image Source= "/data/user/0/com.companyname.ImageSourceExample.Android/files/Octocat.png" Aspect="AspectFit"/> </StackLayout>

Images in drawable folder and in app folder are the same, but using Xamarin.Forms version 3.2.0.871581 (or lower) I get 2 same sized images and in version 3.3.0.912540 (or higher) I get second image much smaller.

I can reproduce this behavior only on Visual Studio Emulator for android, on real devices I have no such problem.

Steps to Reproduce

  1. Create new Xamarin Forms project in Visual Studio
  2. Add the same image to drawable folder and to the app folder on a virtual device
  3. Add two images with source from files from step 2.
  4. Start app on Visual Studio Android Emulator with different Xamarin Forms (3.2.0.871581 and 3.3.0.912540) versions.

Expected Behavior

Get same images sizes for the same code independently from Xamarin Forms version.

Actual Behavior

Different images sizes for the same code for different Xamarin Forms version

Basic Information

  • Version with issue:3.3.0.912540
  • Last known good version: 3.2.0.871581
  • IDE: Visual Studio 2017, ver. 15.9.7
  • Platform Target Frameworks:
  • Affected Devices: Visual Studio Emulator for Android

Screenshots

imgsource_fine imgsource_wrong

Reproduction Link

https://github.com/dronishe/XamarinImagFromSourceExample

I’ve created a simple repo for reproduction. Last commit – same image size with older version of Xamarin Forms. Second to last commit – same code, differs only with Xamarin Forms version. Images have different size.

コントリビューターガイド