App crashes (Unhandled Exception) when API is offline
Hello,
I tried to install Wallcat today but had issues as the site appears offline so I downloaded latest from GitHub. However when I tried to launch it, the icon would appear then disappear. According to Event Viewer:
Application: Wallcat.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at Wallcat.MyCustomApplicationContext+<SelectChannel>d__8.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0(System.Object)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
I fired up Visual Studio and ran it in Debug mode, and found Program.cs:152
var wallpaper = await _wallcatService.GetWallpaper(channel.id);
is making a call to service to download wallpaper, but because site is down, the wallpaper object is null, and without error handling it throws an unhandled exception.
I would like to kindly suggest adding error handling or checking for site connectivity prior to making calls and always expecting results to always be returned.
@PrimerFender Yup, not a bad idea to add some error handling. Sorry about that!
@dustinsenos guessing you already know the service is down?
@PaitoAnderson down as in temporarily or down forever?
@oriolgual just temporarily down! Service is back up :)