Iconize
Iconize copied to clipboard
UWP Object reference not set to an instance of an object.
Can someone help with this error ?
On the main navigation page icons are loaded but not on sub pages.
Object reference not set to an instance of an object.
at Plugin.Iconize.PlatformExtensions.<ToImageSourceAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Plugin.Iconize.IconImageRenderer.<UpdateImageAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Plugin.Iconize.IconImageRenderer.<OnElementChanged>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()
The problem seems to be the control IconImage if i changed to IconLabel it worked.
I had this same error. In my case, specifying an explicit HeightRequest and WidthRequest solved the issue. My guess is that these properties do not have a default value and the image rendering creates an empty image object when the height and width are empty.
EDIT: In the PlatformExtensions.ToImageSourceAsync method, the SKSurface.Create method does not create a surface when the size is -1 (default when no Height or Width is specified).
using (var surface = SKSurface.Create(size, size, SKImageInfo.PlatformColorType, SKAlphaType.Premul))