I have met many times this problem, but not always met.
Solution: 1. Remove the block of DesignMvpService. 2. Move the block of DesignMvpService to try-catch block. 3.Refactor code for ProfilePhoto:
ImageSource retSource = null;
bool useDefault = false;
byte[] bytes=default(byte[]);
if (StoreImageBase64Str != null)
{
try
{
bytes = Convert.FromBase64String(StoreImageBase64Str);
}
catch
{
useDefault = true;
}
}
else
{
useDefault = true;
}
if (useDefault)
{
bytes = Convert.FromBase64String(CommonConstants.DefaultPhoto);
}
retSource = ImageSource.FromStream(() => new System.IO.MemoryStream(bytes));
return retSource;
I have met many times this problem, but not always met. Solution: 1. Remove the block of DesignMvpService. 2. Move the block of DesignMvpService to try-catch block. 3.Refactor code for ProfilePhoto: ImageSource retSource = null; bool useDefault = false; byte[] bytes=default(byte[]); if (StoreImageBase64Str != null) {
try { bytes = Convert.FromBase64String(StoreImageBase64Str); } catch { useDefault = true; } } else { useDefault = true; }
if (useDefault) { bytes = Convert.FromBase64String(CommonConstants.DefaultPhoto);
} retSource = ImageSource.FromStream(() => new System.IO.MemoryStream(bytes)); return retSource;