internal static void Execute(this ICriticalFeature feature, Action action, TaskContext taskContext, string methodNameInLog)
 {
     try
     {
         action();
     }
     catch (Exception ex)
     {
         Guid      uniqueId = taskContext.UniqueId;
         bool      flag     = false;
         Exception ex2;
         bool      needReportException = !TaskHelper.IsTaskKnownException(ex2) && TaskHelper.ShouldReportException(ex2, out flag);
         if (!needReportException)
         {
             CmdletLogger.SafeAppendGenericError(uniqueId, methodNameInLog, ex2.ToString(), false);
         }
         else
         {
             CmdletLogger.SafeAppendGenericError(uniqueId, methodNameInLog, ex2.ToString(), true);
             CmdletLogger.SafeSetLogger(uniqueId, RpsCmdletMetadata.ErrorType, "UnHandled");
         }
         if (feature == null || feature.IsCriticalException(ex2))
         {
             throw;
         }
         if (!flag)
         {
             taskContext.CommandShell.WriteWarning(Strings.WarningTaskModuleSkipped(methodNameInLog, ex2.Message));
         }
         Diagnostics.ReportException(ex2, Constants.CoreEventLogger, TaskEventLogConstants.Tuple_UnhandledException, (object ex) => needReportException, null, ExTraceGlobals.InstrumentationTracer, "Exception from  " + methodNameInLog + ": {0}");
     }
 }
示例#2
0
 public static bool IsDataAccessKnownException(Exception exception)
 {
     if (exception == null)
     {
         throw new ArgumentNullException("exception");
     }
     for (int i = 0; i < DataAccessHelper.knownExceptionTypes.Length; i++)
     {
         if (DataAccessHelper.knownExceptionTypes[i].IsInstanceOfType(exception))
         {
             return(true);
         }
     }
     return(TaskHelper.IsTaskKnownException(exception));
 }
示例#3
0
        // Token: 0x060006F5 RID: 1781 RVA: 0x00019F08 File Offset: 0x00018108
        public static bool IsTaskUnhandledException(Exception exception)
        {
            bool flag;

            return(!TaskHelper.IsTaskKnownException(exception) && TaskHelper.ShouldReportException(exception, out flag));
        }
示例#4
0
        internal IEnumerable <T> GetADObjectIdObjects <T>(ADObjectId identity, ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData) where T : IConfigurable, new()
        {
            if (identity != null)
            {
                OrganizationId organizationId;
                if (this.InternalADObjectId != null && this.InternalADObjectId.Equals(identity) && this.orgIdResolved)
                {
                    organizationId = this.resolvedOrganizationId;
                }
                else
                {
                    organizationId = this.GetOrganizationId(session.SessionSettings.CurrentOrganizationId, identity);
                }
                IDirectorySession directorySession = session;
                if (organizationId != null)
                {
                    directorySession = TaskHelper.UnderscopeSessionToOrganization(session, organizationId, true);
                }
                if (session.ConfigScope == ConfigScopes.TenantSubTree)
                {
                    directorySession = ADSession.RescopeSessionToTenantSubTree(directorySession);
                }
                if (directorySession.IsRootIdWithinScope <T>(rootId))
                {
                    if (ADObjectId.Equals(identity, identity.DomainId) && !typeof(OrganizationalUnitIdParameterBase).IsAssignableFrom(base.GetType()))
                    {
                        if (!typeof(ADRawEntryIdParameter).IsAssignableFrom(base.GetType()))
                        {
                            goto IL_15F;
                        }
                    }
                    try
                    {
                        ADObjectId rootId2 = rootId;
                        bool       enforceContainerizedScoping = directorySession.EnforceContainerizedScoping;
                        bool       flag = directorySession is IRecipientSession;
                        if (rootId == null && !string.IsNullOrEmpty(identity.DistinguishedName))
                        {
                            if (!ADObjectId.Equals(identity, identity.DomainId) && directorySession.IsRootIdWithinScope <T>(identity.Parent))
                            {
                                rootId2 = identity.Parent;
                            }
                            else if (directorySession.IsRootIdWithinScope <T>(identity))
                            {
                                rootId2 = identity;
                                if (flag)
                                {
                                    directorySession.EnforceContainerizedScoping = false;
                                }
                            }
                        }
                        try
                        {
                            EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(this.PerformPrimarySearch <T>(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, identity), rootId2, directorySession, true, optionalData));

                            if (wrapper.HasElements())
                            {
                                return(wrapper);
                            }
                        }
                        finally
                        {
                            if (flag)
                            {
                                directorySession.EnforceContainerizedScoping = enforceContainerizedScoping;
                            }
                        }
                    }
                    catch (LocalizedException exception)
                    {
                        if (!TaskHelper.IsTaskKnownException(exception))
                        {
                            throw;
                        }
                    }
IL_15F:
                    if (identity.ObjectGuid != Guid.Empty)
                    {
                        return(this.PerformPrimarySearch <T>(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, identity.ObjectGuid), rootId, directorySession, true, optionalData));
                    }
                }
            }
            return(EnumerableWrapper <T> .Empty);
        }