Exemple #1
0
        /// <summary>
        /// Sets a global fault session. This enables fault injection for all .NET
        /// processes launched after the creation of the global session. This functionality is often
        /// useful when testing server .NET  applications, where one application typically consists of
        /// and launches many processes.
        /// </summary>
        public static void SetGlobalFault(FaultSession session)
        {
            session.NotifyRuleChanges();

            SetEnvironmentVariable(session, EnvironmentVariableTarget.Process);
            SetEnvironmentVariable(session, EnvironmentVariableTarget.Machine);
        }
Exemple #2
0
        private static void SetEnvironmentVariable(FaultSession session, EnvironmentVariableTarget target)
        {
            // Enable Profiling Callback implemented by Engine
            Environment.SetEnvironmentVariable(EnvironmentVariable.EnableProfiling, "1", target);
            Environment.SetEnvironmentVariable(EnvironmentVariable.Proflier, ComRegistrar.Clsid, target);

            // Set method filter file name for Engine
            Environment.SetEnvironmentVariable(EnvironmentVariable.MethodFilter, session.methodFilterFileName, target);
            // Set serialization file name for Dispatcher
            Environment.SetEnvironmentVariable(EnvironmentVariable.RuleRepository, session.serializationFileName, target);
            // Set log directory for Engine and Dispatcher
            Environment.SetEnvironmentVariable(EnvironmentVariable.LogDirectory, session.LogDirectory, target);
        }
Exemple #3
0
        private static void SetProcessEnvironmentVariables(FaultSession session, ProcessStartInfo processStartInfo)
        {
            // Enable Profiling Callback implemented by Engine
            processStartInfo.EnvironmentVariables.Add(EnvironmentVariable.EnableProfiling, "1");
            processStartInfo.EnvironmentVariables.Add(EnvironmentVariable.Proflier, ComRegistrar.Clsid);

            // Set method filter file name for Engine
            processStartInfo.EnvironmentVariables.Add(EnvironmentVariable.MethodFilter, session.methodFilterFileName);
            // Set serialization file name for Dispatcher
            processStartInfo.EnvironmentVariables.Add(EnvironmentVariable.RuleRepository, session.serializationFileName);
            // Set log directory for Engine and Dispatcher
            processStartInfo.EnvironmentVariables.Add(EnvironmentVariable.LogDirectory, session.LogDirectory);
        }