summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/UriImageSource.cs
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-07-18 23:16:47 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-07-18 23:16:47 (GMT)
commit272033723ea275ceb8a288fa605eafd035c79f2d (patch)
treeabc639d0f5627f3877f9e237e473bda168e9e030 /Xamarin.Forms.Core/UriImageSource.cs
parentc9da550ce4987e01c1bbce9d0a17b860e1d300b3 (diff)
downloadxamarin-forms-272033723ea275ceb8a288fa605eafd035c79f2d.zip
xamarin-forms-272033723ea275ceb8a288fa605eafd035c79f2d.tar.gz
xamarin-forms-272033723ea275ceb8a288fa605eafd035c79f2d.tar.bz2
Windows image loader error handling (#260)
* Repros for various image issues * Log image loading errors * Better repro instructions and user interface * Image loading tests now running on WinRT/UWP phone/tablet/desktop * Move FailImageSource into shared project * Move FailImageSource into shared project * Update docs
Diffstat (limited to 'Xamarin.Forms.Core/UriImageSource.cs')
-rw-r--r--Xamarin.Forms.Core/UriImageSource.cs16
1 files changed, 9 insertions, 7 deletions
diff --git a/Xamarin.Forms.Core/UriImageSource.cs b/Xamarin.Forms.Core/UriImageSource.cs
index a313f27..8055116 100644
--- a/Xamarin.Forms.Core/UriImageSource.cs
+++ b/Xamarin.Forms.Core/UriImageSource.cs
@@ -68,7 +68,8 @@ namespace Xamarin.Forms
{
OnLoadingStarted();
userToken.Register(CancellationTokenSource.Cancel);
- Stream stream = null;
+ Stream stream;
+
try
{
stream = await GetStreamAsync(Uri, CancellationTokenSource.Token);
@@ -78,14 +79,13 @@ namespace Xamarin.Forms
{
OnLoadingCompleted(true);
throw;
-#if DEBUG
}
- catch (Exception e)
+ catch (Exception ex)
{
- Debug.WriteLine(e);
+ Log.Warning("Image Loading", $"Error getting stream for {Uri}: {ex}");
throw;
-#endif
}
+
return stream;
}
@@ -121,8 +121,9 @@ namespace Xamarin.Forms
{
stream = await Device.GetStreamAsync(uri, cancellationToken).ConfigureAwait(false);
}
- catch (Exception)
+ catch (Exception ex)
{
+ Log.Warning("Image Loading", $"Error getting stream for {Uri}: {ex}");
stream = null;
}
}
@@ -166,8 +167,9 @@ namespace Xamarin.Forms
if (stream == null)
return null;
}
- catch (Exception)
+ catch (Exception ex)
{
+ Log.Warning("Image Loading", $"Error getting stream for {Uri}: {ex}");
return null;
}