Пример #1
0
        private void StartLauncher(object param)
        {
            string configStr        = (string)param;
            Type   launcherType     = typeof(AppDomainTestLauncher);
            string launcherFullName = $"{launcherType.Namespace}.{launcherType.Name}";

            try
            {
                _appDomain.Load(launcherType.Assembly.GetName());
                AppDomainTestLauncher launcherInstance = (AppDomainTestLauncher)_appDomain.CreateInstanceFromAndUnwrap(
                    launcherType.Assembly.Location, launcherFullName, false, BindingFlags.Instance | BindingFlags.Public,
                    null,
                    new object[] { configStr }, CultureInfo.CurrentCulture, null);
                launcherInstance.Start();
            }
            catch (ThreadAbortException ex)
            {
                ILogService logService = TestflowRunner.GetInstance().LogService;
                logService.Print(LogLevel.Warn, CommonConst.PlatformLogSession, "Appdomain thread aborted.");
            }
            catch (Exception ex)
            {
                ILogService logService = TestflowRunner.GetInstance().LogService;
                logService.Print(LogLevel.Error, CommonConst.PlatformLogSession, ex, "Exception raised in appdomain thread.");
            }
        }
Пример #2
0
        private void StartLauncher(object param)
        {
            string configStr        = (string)param;
            Type   launcherType     = typeof(AppDomainTestLauncher);
            string launcherFullName = $"{launcherType.Namespace}.{launcherType.Name}";
            AppDomainTestLauncher launcherInstance = (AppDomainTestLauncher)_appDomain.CreateInstanceAndUnwrap(
                launcherType.Assembly.GetName().Name, launcherFullName, new object[] { configStr });

            launcherInstance.Start();
        }