1

Closed

NagForReview Causes NullReferenceException if Run in Application_Launching

description

Thanks for the work that has been done in NorthernLights.
 
If I call NagForReview.Check in MainPage(), it works fine, but if I call it from Application_Launching, I get the exception below. At first I thought it was because I don't have an AppBar, but the code on CodePlex for HandleBackKeyAndAppBar() checks for a null condition first, so I'm not sure what the cause could be.
 
System.NullReferenceException was unhandled
Message=NullReferenceException
StackTrace:
   at NorthernLights.Controls.Tools.NotificationTool.HandleBackKeyAndAppBar()
   at NorthernLights.Controls.Tools.NotificationTool.<OpenPopup>b__4()
   at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
   at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at System.Delegate.DynamicInvokeOne(Object[] args)
   at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
   at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
   at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
   at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)
   at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)
Closed Nov 30, 2012 at 4:42 PM by southernsun
No further response from techSage, therefore closing the work item.

comments

southernsun wrote Feb 3, 2012 at 5:39 PM

Hi techSage, this is probably caused due to the fact that Rootframe is not yet set. The NotificationBox can only be shown when being part of a page. So you can't call it from Application_Launching.

What are you trying to achieve so i can perhaps hint you on how to approach your problem.

wrote Nov 30, 2012 at 4:42 PM

wrote Feb 13, 2013 at 10:48 PM

wrote May 16, 2013 at 1:17 AM