/// <summary>
 /// Executes a delegate, catching any thrown exceptions and converting them to HRESULTs.
 /// </summary>
 private HResult HrInvoke(Func <Task <HResult> > asyncAction, bool registerProjectFaultHandlerService = false)
 {
     return(HResult.Invoke(
                delegate
     {
         return ThreadingService.ExecuteSynchronously(asyncAction);
     },
                Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider,
                registerProjectFaultHandlerService ? ProjectFaultHandlerService : null,
                UnconfiguredProject));
 }
 /// <summary>
 /// Executes a delegate, catching any thrown exceptions and converting them to HRESULTs.
 /// </summary>
 internal HResult HrInvoke(Action action)
 {
     return(HResult.Invoke(action, Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider));
 }