Example #1
0
 /// <exclude />
 public static void RunInWriterLockScope(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
 {
     using (GlobalInitializerFacade.CoreLockScope)
     {
         runInWriterLockScopeDelegate();
     }
 }
 /// <exclude />
 public static void RunInWriterLockScope(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
 {
     using (CoreLockScope)
     {
         runInWriterLockScopeDelegate();
     }
 }
        internal static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate, bool initializeHooksInTheSameThread)
        {
            if (_hookingFacadeThread != null)
            {
                _hookingFacadeThread.Join(TimeSpan.FromSeconds(30));
                if (_hookingFacadeException != null)
                {
                    throw new InvalidOperationException("The initialization of the HookingFacade failed before this reinitialization was issued", _hookingFacadeException);
                }
            }

            using (CoreLockScope)
            {
                IsReinitializingTheSystem = true;

                runInWriterLockScopeDelegate();

                _coreInitialized = false;
                _initializing    = false;
                _exceptionThrownDuringInitialization = null;

                Verify.That(_fatalErrorFlushCount <= 1, "Failed to reload the system. See the log for the details.");

                InitializeTheSystem();

                IsReinitializingTheSystem = false;
            }
        }
Example #4
0
        /// <exclude />
        public static void UninitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
        {
            using (GlobalInitializerFacade.CoreLockScope)
            {
                using (new LogExecutionTime(LogTitle, "Uninitializing the system"))
                {
                    runInWriterLockScopeDelegate();
                }

                _coreInitialized = false;
                _initializing    = false;
                _exceptionThrownDuringInitialization = null;
            }
        }
Example #5
0
        internal static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate, bool initializeHooksInTheSameThread)
        {
            if (_hookingFacadeThread != null)
            {
                _hookingFacadeThread.Join(TimeSpan.FromSeconds(30));
                if (_hookingFacadeException != null)
                {
                    throw new InvalidOperationException("The initialization of the HookingFacade failed before this reinitialization was issued", _hookingFacadeException);
                }
            }

            using (GlobalInitializerFacade.CoreLockScope)
            {
                IsReinitializingTheSystem = true;

                runInWriterLockScopeDelegate();

                _coreInitialized = false;
                _initializing    = false;
                _exceptionThrownDuringInitialization = null;

                Verify.That(_fatalErrorFlushCount <= 1, "Failed to reload the system. See the log for the details.");

                InitializeTheSystem();

                if (!SystemSetupFacade.SetupIsRunning)
                {
                    // Updating "hooks" either in the same thread, or in another
                    if (initializeHooksInTheSameThread)
                    {
                        object threadStartParameter = new KeyValuePair <TimeSpan, StackTrace>(TimeSpan.Zero, new StackTrace());
                        EnsureHookingFacade(threadStartParameter);
                    }
                    else
                    {
                        _hookingFacadeThread = new Thread(EnsureHookingFacade)
                        {
                            Name = "EnsureHookingFacade"
                        };
                        _hookingFacadeThread.Start(new KeyValuePair <TimeSpan, StackTrace>(TimeSpan.FromSeconds(1), new StackTrace()));
                    }
                }


                IsReinitializingTheSystem = false;
            }
        }
Example #6
0
 /// <exclude />
 public static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
 {
     ReinitializeTheSystem(runInWriterLockScopeDelegate, false);
 }
        internal static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate, bool initializeHooksInTheSameThread)
        {
            if (_hookingFacadeThread != null)
            {
                _hookingFacadeThread.Join(TimeSpan.FromSeconds(30));
                if (_hookingFacadeException != null)
                {
                    throw new InvalidOperationException("The initialization of the HookingFacade failed before this reinitialization was issued", _hookingFacadeException);
                }
            }

            using (GlobalInitializerFacade.CoreLockScope)
            {
                IsReinitializingTheSystem = true;

                runInWriterLockScopeDelegate();

                _coreInitialized = false;
                _initializing = false;
                _exceptionThrownDuringInitialization = null;

                Verify.That(_fatalErrorFlushCount <= 1, "Failed to reload the system. See the log for the details.");

                InitializeTheSystem();

                if (!SystemSetupFacade.SetupIsRunning)
                {
                    // Updating "hooks" either in the same thread, or in another
                    if (initializeHooksInTheSameThread)
                    {
                        object threadStartParameter = new KeyValuePair<TimeSpan, StackTrace>(TimeSpan.Zero, new StackTrace());
                        EnsureHookingFacade(threadStartParameter);
                    }
                    else
                    {
                        _hookingFacadeThread = new Thread(EnsureHookingFacade) {Name = "EnsureHookingFacade"};
                        _hookingFacadeThread.Start(new KeyValuePair<TimeSpan, StackTrace>(TimeSpan.FromSeconds(1), new StackTrace()));
                    }
                }

                IsReinitializingTheSystem = false;
            }
        }
        /// <exclude />
        public static void UninitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
        {
            using (GlobalInitializerFacade.CoreLockScope)
            {
                using (new LogExecutionTime(LogTitle, "Uninitializing the system"))
                {
                    runInWriterLockScopeDelegate();
                }

                _coreInitialized = false;
                _initializing = false;
                _exceptionThrownDuringInitialization = null;
            }
        }
 /// <exclude />
 public static void RunInWriterLockScope(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
 {
     using (GlobalInitializerFacade.CoreLockScope)
     {
         runInWriterLockScopeDelegate();
     }
 }
 /// <exclude />
 public static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
 {
     ReinitializeTheSystem(runInWriterLockScopeDelegate, false);
 }