示例#1
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            Type       tp = (Type)e.Argument;
            TextWriter tw = Console.Out;

            Console.SetOut(new GUITextWriter(this));
            RunMe.RunTutorial(tp);
            Console.SetOut(tw);
        }
示例#2
0
        public void AbortWhileGet()
        {
            // "System.Net.HttpListener Exception : The I/O operation has been aborted
            // because of either a thread exit or an application request
            //   at System.Net.HttpListener.GetContext()
            //   at MonoTests.System.Net.HttpListenerTest.CloseWhileGet()

            HttpListener listener = NetworkHelpers.CreateAndStartHttpListener("http://127.0.0.1:", out var _, "/abortwhileget/");
            RunMe        rm       = new RunMe(1000, new ThreadStart(listener.Abort), new object [0]);

            rm.Start();
            HttpListenerContext ctx = listener.GetContext();
        }
    public void CloseWhileGet ()
    {
        // "System.Net.HttpListener Exception : The I/O operation has been aborted
        // because of either a thread exit or an application request
        //   at System.Net.HttpListener.GetContext()
        //   at MonoTests.System.Net.HttpListenerTest.CloseWhileGet()

        HttpListener listener = new HttpListener ();
        listener.Prefixes.Add ("http://127.0.0.1:9001/closewhileget/");
        listener.Start ();
        RunMe rm = new RunMe (1000, new ThreadStart (listener.Close), new object [0]);
        rm.Start ();
        HttpListenerContext ctx = listener.GetContext ();
    }
        public static void RunCodeInNewAppDomain()
        {
            AppDomain myOwnAppDomain = AppDomain.CreateDomain("MyOwnAppDomain");
            // print out our current AppDomain name
            RunMe rm = new RunMe();

            rm.PrintCurrentAppDomainName();

            // Create our RunMe class in the new appdomain
            Type         adType = typeof(RunMe);
            ObjectHandle objHdl =
                myOwnAppDomain.CreateInstance(adType.Module.Assembly.FullName, adType.FullName);
            // unwrap the reference
            RunMe adRunMe = (RunMe)objHdl.Unwrap();

            // make a call on the toolbox
            adRunMe.PrintCurrentAppDomainName();

            // now unload the appdomain
            AppDomain.Unload(myOwnAppDomain);
        }
示例#5
0
		public void AbortWhileGet ()
		{
			// "System.Net.HttpListener Exception : The I/O operation has been aborted
			// because of either a thread exit or an application request
			//   at System.Net.HttpListener.GetContext()
			//   at MonoTests.System.Net.HttpListenerTest.CloseWhileGet()

			HttpListener listener = new HttpListener ();
			listener.Prefixes.Add ("http://127.0.0.1:9001/abortwhileget/");
			listener.Start ();
			RunMe rm = new RunMe (1000, new ThreadStart (listener.Abort), new object [0]);
			rm.Start ();
			HttpListenerContext ctx = listener.GetContext ();
		}