[System.ServiceModel] Prevent crash in Dispatcher.ListenerLoopManager… (#7136)
[mono-project.git] / mono / tests / appdomain-unload-doesnot-raise-pending-events.cs
blob7884be7a6e196f9dcbd13818777c53e4fb138332
1 using System;
2 using System.IO;
3 using System.Net;
4 using System.Net.Sockets;
5 using System.Threading;
8 class Driver {
9 static void AppDomainMethod () {
10 Console.WriteLine ("two");
11 var socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
12 IPEndPoint ep = new IPEndPoint(IPAddress.Any, 0);
13 socket.Bind (ep);
14 socket.Listen (10);
15 socket.BeginAccept ( delegate {
16 Console.WriteLine ("Delegate should not be called!");
17 Environment.Exit (1);
18 }, socket);
21 static int Main () {
22 var da = AppDomain.CreateDomain ("le domain");
23 da.DoCallBack (delegate { AppDomainMethod ();});
24 Console.WriteLine ("unloading");
25 AppDomain.Unload (da);
26 Console.WriteLine ("done");
27 return 0;