Beispiel #1
0
        protected override Process StartProcess()
        {
            if (!Path.IsPathRooted(this.ExeName))
            {
                this.ExeName = this.Project.GetFullPath(this.ExeName);
            }
            this._CreateNCoverInfo();
            if (this._registerProfiler)
            {
                this.Log(Level.Verbose, "Registering profiler");
                NCoverUtilities.RegisterNCover(Path.GetDirectoryName(this.ExeName), this._ncoverInfo.VersionNumber);
            }
            Process process = base.StartProcess();

            process.Exited += new EventHandler(this._OnProcessExited);
            return(process);
        }
        protected override void ExecuteTask()
        {
            this.CreateNCoverInfo();
            if (this._registerProfiler)
            {
                this.Log(Level.Verbose, "Registering profiler");
                NCoverUtilities.RegisterNCover(Path.GetDirectoryName(this.ExeName), this._ncoverInfo.VersionNumber);
            }
            this.Prepare();

            Evidence       securityInfo = new Evidence(AppDomain.CurrentDomain.Evidence);
            AppDomainSetup setup        = new AppDomainSetup();

            setup.ApplicationBase = Path.GetDirectoryName(this.ExeName);

            NCoverAppDomain = AppDomain.CreateDomain("NCover", securityInfo, setup);

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(this.AssemblyResolveHandler);

            NCoverAssembly = NCoverAppDomain.Load(Assembly.LoadFile(this.ExeName).GetName().Name);

            ConsoleMain = null;

            foreach (Type type in NCoverAssembly.GetTypes())
            {
                if (type.Name == "ConsoleMain")
                {
                    ConsoleMain = type;
                    break;
                }
            }

            this.SubvertConsoleOutput();

            Thread NCoverWorker = new Thread(new ThreadStart(Run));

            NCoverWorker.Start();
        }