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

[Bug] NullReference Exception thrown when load image from ImageSource in Xamarin Forms UWP #13109

Closed
KarthikRaja26 opened this issue Dec 11, 2020 · 1 comment · Fixed by #13135
Assignees
Labels
4.8.0 regression on 4.8.0 a/image blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/1 🕐 1 i/regression in-progress This issue has an associated pull request that may resolve it! p/UWP t/bug 🐛
Milestone

Comments

@KarthikRaja26
Copy link

Description

NullReference Exception thrown when load image from ImageSource in Xamarin Forms UWP.

CallStackDetails :
Xamarin.Forms.Platform.UAP.dll!Xamarin.Forms.Platform.UWP.PlatformConfigurationExtensions.OnThisPlatform<Xamarin.Forms.Application>(Xamarin.Forms.Application element) Unknown
Xamarin.Forms.Platform.UAP.dll!Xamarin.Forms.Platform.UWP.FileImageSourceHandler.UpdateImageDirectory(Xamarin.Forms.FileImageSource fileSource) Unknown
Xamarin.Forms.Platform.UAP.dll!Xamarin.Forms.Platform.UWP.FileImageSourceHandler.LoadImageAsync(Xamarin.Forms.ImageSource imagesource, System.Threading.CancellationToken cancellationToken) Unknown

UWPApp.UWP.exe!UWPApp.UWP.ImageHandler.GetImage(Xamarin.Forms.ImageSource source) Line 35 C#
UWPApp.UWP.exe!UWPApp.UWP.CloseIconHelper.Reports.View.ICloseIconHelper.SetImage(Xamarin.Forms.ImageSource imageSource) Line 20 C#
Reports.dll!Reports.View.CloseIcon.CloseIcon() Line 41 C#
Reports.dll!Reports.View.ReportsPage.ReportsPage() Line 18 C#
UWPApp.UWP.exe!UWPApp.UWP.ReportsPage.ReportsClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e) Line 34 C#

Steps to Reproduce

  1. Run the attached sample
  2. Click the report button to load image from imagesource.
  3. Note the Null Reference exception thrown when load image from imagesouce.

Expected Behavior

The exception should not be thrown when load images from imagesource.

Actual Behavior

NullReference Exception thrown when load image from imagesource.

Basic Information

  • Version with issue: 4.8.0.1687
  • Last known good version: 3.6.0.709228
  • Platform Target Frameworks:
    • UWP:
  • Android Support Library / AndroidX Version:
  • NuGet Packages:
  • Affected Devices:

Environment

Build Logs

Screenshots

Reproduction Link

XamUWPApp_66841f7f.zip

Workaround

@KarthikRaja26 KarthikRaja26 added s/unverified New report that has yet to be verified t/bug 🐛 labels Dec 11, 2020
@samhouts samhouts added this to New in Triage Dec 11, 2020
@PureWeen PureWeen added 4.8.0 regression on 4.8.0 i/regression blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. labels Dec 11, 2020
@PureWeen PureWeen added this to To do in vNext+1 (5.0.0) via automation Dec 11, 2020
@PureWeen PureWeen moved this from New to Ready For Work in Triage Dec 11, 2020
@PureWeen PureWeen added this to the 5.0.0 milestone Dec 11, 2020
@PureWeen PureWeen removed the s/unverified New report that has yet to be verified label Dec 11, 2020
@PureWeen
Copy link
Contributor

var imageDirectory = Application.Current.OnThisPlatform().GetImageDirectory();

Needs a null check

@PureWeen PureWeen added the e/1 🕐 1 label Dec 11, 2020
@jsuarezruiz jsuarezruiz self-assigned this Dec 11, 2020
@jsuarezruiz jsuarezruiz added the in-progress This issue has an associated pull request that may resolve it! label Dec 14, 2020
@jsuarezruiz jsuarezruiz moved this from To do to Blockers in vNext+1 (5.0.0) Dec 14, 2020
@jsuarezruiz jsuarezruiz moved this from Blockers to In Progress in vNext+1 (5.0.0) Dec 14, 2020
Triage automation moved this from Ready For Work to Closed Dec 23, 2020
vNext+1 (5.0.0) automation moved this from In Progress to Done Dec 23, 2020
rmarinho added a commit that referenced this issue Dec 23, 2020
* Fixed NRE load image from ImageSource in UWP

* Added UITest

* Fix build error

* Execute the issue UITest only in Windows

* Update Issue13109.cs

Co-authored-by: Rui Marinho <me@ruimarinho.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.8.0 regression on 4.8.0 a/image blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/1 🕐 1 i/regression in-progress This issue has an associated pull request that may resolve it! p/UWP t/bug 🐛
Projects
Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

3 participants