/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="errRegService"></param>
        /// <param name="reportingSettings"></param>
        /// <param name="syncOrchestrator"></param>
        public ErrorRoutingAlgorithm(
            ErrorRegistrationService errRegService,
            BM.ReportingSettings reportingSettings,
            SyncOrchestrator syncOrchestrator)
        {
            m_errRegService     = errRegService;
            m_reportingSettings = reportingSettings;

            // add default EventLog Channel
            m_routingChannels.Add(new EventLogChannel());
            m_routingChannels.Add(new TraceLogChannel());

            if (null != m_reportingSettings &&
                (reportingSettings.EnableDebugAssertion ||
                 reportingSettings.ReportingLevel >= (int)ReportingLevel.RaiseDebugAssertion))
            {
                // configured to add DebugAssertion Channel
                // todo: remove this when we want to cleanly rely on build flavor to enable
                // debug failure
                m_routingChannels.Add(new DebugAssertChannel());
            }

            bool blockingSessionEnabledByDefault =
                (null != m_reportingSettings && reportingSettings.ReportingLevel >= (int)ReportingLevel.BlockSessionGroup);

            m_routingChannels.Add(new BlockingSessionGroupChannel(syncOrchestrator, blockingSessionEnabledByDefault));
        }
 private void Initialize(
     BM.ErrorManagement configuration,
     SyncOrchestrator syncOrchestrator)
 {
     m_errRegService    = new ErrorRegistrationService(configuration.ErrorRouters);
     m_routingAlgorithm = new ErrorRoutingAlgorithm(m_errRegService, configuration.ReportingSettings, syncOrchestrator);
     m_syncOrchestrator = syncOrchestrator;
 }
Esempio n. 3
0
        /// <summary>
        /// Registers the wildcard error routing policies; must be called after all other
        /// errors are registered
        /// </summary>
        public static void RegisterImplicitDefaultErrors(ErrorRegistrationService service)
        {
            service.RegisterError(
                new ErrorSignatureOneLevelException(ErrorSignatureBase.WildcardAny),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.DefaultMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureTwoLevelException(ErrorSignatureBase.WildcardAny, ErrorSignatureBase.WildcardAny),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.DefaultMaxOccurrence));
        }
Esempio n. 4
0
        /// <summary>
        /// Registers the default errors such as OOM, NullReference, etc.
        /// </summary>
        public static void RegisterDefaultErrors(ErrorRegistrationService service)
        {
            #region instantly blocking errors
            //service.RegisterError(
            //    new ErrorSignatureOneLevelException(typeof(InitializationException)),
            //    new MaxOccurrenceErrorRoutingPolicy(1));

            //service.RegisterError(
            //        new ErrorSignatureOneLevelException(typeof(AddinException)),
            //        new MaxOccurrenceErrorRoutingPolicy(1));

            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(System.IO.IOException), MigrationToolkitResources.ErrReport_Exception_Message_NotEnoughSpaceOnDisk),
                new MaxOccurrenceErrorRoutingPolicy(1));

            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(System.NotSupportedException), MigrationToolkitResources.ErrReport_Exception_Message_WorkspaceIsRequired),
                new MaxOccurrenceErrorRoutingPolicy(1));

            service.RegisterError(
                new ErrorSignatureOneLevelException("Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException"),
                new MaxOccurrenceErrorRoutingPolicy(1));
            #endregion

            #region less tolerable errors
            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(OutOfMemoryException)),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.DefaultMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(NullReferenceException)),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.DefaultMaxOccurrence));
            #endregion

            #region tolerable environmental errors
            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(System.Data.EntityCommandExecutionException)),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureTwoLevelException(typeof(System.Data.EntityCommandExecutionException), string.Empty, typeof(System.Data.SqlClient.SqlException),
                                                    MigrationToolkitResources.ErrReport_Exception_Message_Deadlock),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(System.Data.EntityException)),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureTwoLevelException(typeof(System.Data.EntityException), string.Empty, typeof(System.Data.SqlClient.SqlException),
                                                    MigrationToolkitResources.ErrReport_Exception_Message_Timeout),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(System.Data.SqlClient.SqlException)),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(System.Data.UpdateException)),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException(typeof(System.Transactions.TransactionAbortedException)),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException("Microsoft.TeamFoundation.Framework.Client.DatabaseConnectionException"),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException("Microsoft.TeamFoundation.Framework.Client.DatabaseOperationTimeoutException"),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException("Microsoft.TeamFoundation.TeamFoundationServerInvalidResponseException"),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException("Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException"),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));

            service.RegisterError(
                new ErrorSignatureOneLevelException("Microsoft.TeamFoundation.VersionControl.Client.RepositoryNotFoundException"),
                new MaxOccurrenceErrorRoutingPolicy(MaxOccurrenceErrorRoutingPolicy.EnvironmentalErrorMaxOccurrence));
            #endregion
        }