microsoft / mvp

Microsoft MVP Program GitHub Repository
https://microsoft.github.io/mvp/
69 stars 31 forks source link

App crash when use DesignService #81

Closed seiya1223 closed 7 years ago

seiya1223 commented 7 years ago

I have met many times this problem, but not always met. image 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;