New test.
[mono.git] / mcs / class / corlib / Test / System / AppDomainTest.cs
1 //
2 // AppDomainTest.cs - NUnit Test Cases for AppDomain
3 //
4 // Author:
5 //      Sebastien Pouliot (sebastien@ximian.com)
6 //
7 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using NUnit.Framework;
30 using System;
31 using System.Collections;
32 using System.Globalization;
33 using System.IO;
34 using System.Reflection;
35 using System.Reflection.Emit;
36 using System.Security;
37 using System.Security.Permissions;
38 using System.Security.Policy;
39 using System.Security.Principal;
40
41 namespace MonoTests.System
42 {
43         [TestFixture]
44         public class AppDomainTest
45         {
46                 private AppDomain ad;
47                 private ArrayList files = new ArrayList ();
48                 private string tempDir = Path.Combine (Path.GetTempPath (), "MonoTests.System.AppDomainTest");
49
50                 [SetUp]
51                 public void SetUp ()
52                 {
53                         if (!Directory.Exists (tempDir)) {
54                                 Directory.CreateDirectory (tempDir);
55                         }
56                 }
57
58                 [TearDown]
59                 public void TearDown ()
60                 {
61                         if (ad != null) {
62                                 try {
63                                         AppDomain.Unload (ad);
64                                         ad = null;
65                                 } catch { } // do not affect unit test results in TearDown
66                         }
67                         foreach (string fname in files) {
68                                 File.Delete (fname);
69                         }
70                         files.Clear ();
71                 }
72
73                 [Test]
74                 public void SetThreadPrincipal ()
75                 {
76                         IIdentity i = new GenericIdentity ("sebastien@ximian.com", "rfc822");
77                         IPrincipal p = new GenericPrincipal (i, null);
78                         ad = AppDomain.CreateDomain ("SetThreadPrincipal");
79                         ad.SetThreadPrincipal (p);
80                 }
81
82                 [Test]
83                 [ExpectedException (typeof (ArgumentNullException))]
84                 public void SetThreadPrincipalNull ()
85                 {
86                         AppDomain.CurrentDomain.SetThreadPrincipal (null);
87                 }
88
89                 [Test]
90                 [ExpectedException (typeof (PolicyException))]
91                 public void SetThreadPrincipalTwice ()
92                 {
93                         IIdentity i = new GenericIdentity ("sebastien@ximian.com", "rfc822");
94                         IPrincipal p = new GenericPrincipal (i, null);
95                         ad = AppDomain.CreateDomain ("SetThreadPrincipalTwice");
96                         ad.SetThreadPrincipal (p);
97                         // you only live twice (or so James told me ;-)
98                         ad.SetThreadPrincipal (p);
99                 }
100
101                 [Test]
102                 [ExpectedException (typeof (AppDomainUnloadedException))]
103                 public void SetThreadPrincipalUnloaded ()
104                 {
105                         ad = AppDomain.CreateDomain ("Ximian");
106                         AppDomain.Unload (ad);
107                         IIdentity i = new GenericIdentity ("sebastien@ximian.com", "rfc822");
108                         IPrincipal p = new GenericPrincipal (i, null);
109                         ad.SetThreadPrincipal (p);
110                 }
111
112                 [Test]
113                 public void SetPrincipalPolicy_NoPrincipal ()
114                 {
115                         AppDomain.CurrentDomain.SetPrincipalPolicy (PrincipalPolicy.NoPrincipal);
116                 }
117
118                 [Test]
119                 public void SetPrincipalPolicy_UnauthenticatedPrincipal ()
120                 {
121                         AppDomain.CurrentDomain.SetPrincipalPolicy (PrincipalPolicy.UnauthenticatedPrincipal);
122                 }
123
124                 [Test]
125                 public void SetPrincipalPolicy_WindowsPrincipal ()
126                 {
127                         AppDomain.CurrentDomain.SetPrincipalPolicy (PrincipalPolicy.WindowsPrincipal);
128                 }
129
130                 [Test]
131                 [ExpectedException (typeof (AppDomainUnloadedException))]
132                 public void SetPrincipalPolicyUnloaded ()
133                 {
134                         ad = AppDomain.CreateDomain ("Ximian");
135                         AppDomain.Unload (ad);
136                         ad.SetPrincipalPolicy (PrincipalPolicy.NoPrincipal);
137                 }
138
139                 [Test]
140                 public void CreateDomain_String ()
141                 {
142                         ad = AppDomain.CreateDomain ("CreateDomain_String");
143                         Assert.IsNotNull (ad.Evidence, "Evidence");
144                         // Evidence are copied (or referenced?) from default app domain
145                         // we can't get default so we use the current (which should have copied the default)
146                         Assert.AreEqual (AppDomain.CurrentDomain.Evidence.Count, ad.Evidence.Count, "Evidence.Count");
147                 }
148
149                 [Test]
150                 [ExpectedException (typeof (ArgumentNullException))]
151                 public void CreateDomain_String_Null ()
152                 {
153                         ad = AppDomain.CreateDomain (null);
154                 }
155
156                 [Test]
157                 [Category ("NotDotNet")]
158                 public void CreateDomain_StringEvidence ()
159                 {
160                         Evidence e = new Evidence ();
161                         ad = AppDomain.CreateDomain ("CreateDomain_StringEvidence", e);
162                         Assert.IsNotNull (ad.Evidence, "Evidence");
163                         Assert.AreEqual (0, ad.Evidence.Count, "Evidence.Count");
164
165                         e.AddHost (new Zone (SecurityZone.MyComputer));
166                         Assert.AreEqual (0, ad.Evidence.Count, "Evidence.Count");
167                         // evidence isn't copied but referenced
168                 }
169
170                 [Test]
171                 [ExpectedException (typeof (ArgumentNullException))]
172                 public void CreateDomain_StringNullEvidence ()
173                 {
174                         ad = AppDomain.CreateDomain (null, new Evidence ());
175                 }
176
177                 [Test]
178                 public void CreateDomain_StringEvidenceNull ()
179                 {
180                         ad = AppDomain.CreateDomain ("CreateDomain_StringEvidenceNull", null);
181                         Assert.IsNotNull (ad.Evidence, "Evidence");
182                         // Evidence are copied (or referenced?) from default app domain
183                         // we can't get default so we use the current (which should have copied the default)
184                         Evidence e = AppDomain.CurrentDomain.Evidence;
185                         Assert.AreEqual (e.Count, ad.Evidence.Count, "Evidence.Count-1");
186                         e.AddHost (new Zone (SecurityZone.MyComputer));
187                         Assert.AreEqual (e.Count - 1, ad.Evidence.Count, "Evidence.Count-2");
188                         // evidence are copied
189                 }
190
191                 [Test]
192                 [Category ("NotDotNet")]
193                 public void CreateDomain_StringEvidenceAppDomainSetup ()
194                 {
195                         Evidence e = new Evidence ();
196                         AppDomainSetup info = new AppDomainSetup ();
197                         info.ApplicationName = "ApplicationName";
198
199                         ad = AppDomain.CreateDomain ("CreateDomain_StringEvidenceAppDomainSetup", e, info);
200                         Assert.IsNotNull (ad.Evidence, "Evidence");
201                         Assert.AreEqual (0, ad.Evidence.Count, "Evidence.Count");
202                         Assert.IsNotNull (ad.SetupInformation, "SetupInformation");
203                         Assert.AreEqual ("ApplicationName", ad.SetupInformation.ApplicationName);
204
205                         e.AddHost (new Zone (SecurityZone.MyComputer));
206                         Assert.AreEqual (0, ad.Evidence.Count, "Evidence.Count");
207                         // evidence isn't copied but referenced
208                 }
209
210                 [Test]
211                 [ExpectedException (typeof (ArgumentNullException))]
212                 public void CreateDomain_StringNullEvidenceAppDomainSetup ()
213                 {
214                         AppDomainSetup info = new AppDomainSetup ();
215                         ad = AppDomain.CreateDomain (null, new Evidence (), info);
216                 }
217
218                 [Test]
219                 public void CreateDomain_StringEvidenceNullAppDomainSetup ()
220                 {
221                         AppDomainSetup info = new AppDomainSetup ();
222                         info.ApplicationName = "ApplicationName";
223                         ad = AppDomain.CreateDomain ("CreateDomain_StringEvidenceNullAppDomainSetup", null, info);
224                         Assert.IsNotNull (ad.Evidence, "Evidence");
225                         // Evidence are copied (or referenced?) from default app domain
226                         // we can't get default so we use the current (which should have copied the default)
227                         Assert.AreEqual (AppDomain.CurrentDomain.Evidence.Count, ad.Evidence.Count, "Evidence.Count");
228                         Assert.AreEqual ("ApplicationName", ad.SetupInformation.ApplicationName, "ApplicationName-1");
229                         info.ApplicationName = "Test";
230                         Assert.AreEqual ("Test", info.ApplicationName, "ApplicationName-2");
231                         Assert.AreEqual ("ApplicationName", ad.SetupInformation.ApplicationName, "ApplicationName-3");
232                         // copied
233                 }
234
235                 [Test]
236                 [Category ("NotDotNet")]
237                 public void CreateDomain_StringEvidenceAppDomainSetupNull ()
238                 {
239                         Evidence e = new Evidence ();
240                         ad = AppDomain.CreateDomain ("CreateDomain_StringEvidenceAppDomainSetupNull", e, null);
241                         Assert.IsNotNull (ad.Evidence, "Evidence");
242                         Assert.AreEqual (0, ad.Evidence.Count, "Evidence.Count");
243                         // SetupInformation is copied from default app domain
244                         Assert.IsNotNull (ad.SetupInformation, "SetupInformation");
245                 }
246
247                 [Test] // bug #79720
248                 [Category ("NotWorking")]
249                 public void Load_Loaded_Ignore ()
250                 {
251                         int assemblyStartCount = AppDomain.CurrentDomain.GetAssemblies ().Length;
252
253                         // PART A
254
255                         string assemblyFile = Path.Combine (tempDir, "bug79720A.dll");
256                         AssemblyName aname = new AssemblyName ();
257                         aname.Name = "bug79720A";
258                         aname.Version = new Version (2, 4);
259
260                         GenerateAssembly (aname, assemblyFile);
261
262                         Assert.AreEqual (assemblyStartCount, AppDomain.CurrentDomain.GetAssemblies ().Length, "#A1");
263
264                         aname = new AssemblyName ();
265                         aname.Name = "bug79720A";
266                         try {
267                                 AppDomain.CurrentDomain.Load (aname);
268                                 Assert.Fail ("#A2");
269                         } catch (FileNotFoundException) {
270                         }
271
272                         aname = new AssemblyName ();
273                         aname.Name = "bug79720A";
274                         aname.Version = new Version (0, 0, 0, 0);
275                         try {
276                                 AppDomain.CurrentDomain.Load (aname);
277                                 Assert.Fail ("#A3");
278                         } catch (FileNotFoundException) {
279                         }
280
281                         aname = new AssemblyName ();
282                         aname.Name = "bug79720A";
283                         aname.Version = new Version (2, 4);
284                         try {
285                                 AppDomain.CurrentDomain.Load (aname);
286                                 Assert.Fail ("#A4");
287                         } catch (FileNotFoundException) {
288                         }
289
290                         Assert.AreEqual (assemblyStartCount, AppDomain.CurrentDomain.GetAssemblies ().Length, "#A5");
291
292                         Assembly.LoadFrom (assemblyFile);
293
294                         Assert.AreEqual (assemblyStartCount + 1, AppDomain.CurrentDomain.GetAssemblies ().Length, "#A6");
295
296                         aname = new AssemblyName ();
297                         aname.Name = "bug79720A";
298                         try {
299                                 AppDomain.CurrentDomain.Load (aname);
300                                 Assert.Fail ("#A7");
301                         } catch (FileNotFoundException) {
302                         }
303
304                         aname = new AssemblyName ();
305                         aname.Name = "bug79720A";
306                         aname.Version = new Version (0, 0, 0, 0);
307                         try {
308                                 AppDomain.CurrentDomain.Load (aname);
309                                 Assert.Fail ("#A8");
310                         } catch (FileNotFoundException) {
311                         }
312
313                         aname = new AssemblyName ();
314                         aname.Name = "bug79720A";
315                         aname.Version = new Version (2, 4);
316                         try {
317                                 AppDomain.CurrentDomain.Load (aname);
318                                 Assert.Fail ("#A9");
319                         } catch (FileNotFoundException) {
320                         }
321
322                         aname = new AssemblyName ();
323                         aname.Name = "bug79720A";
324                         aname.Version = new Version (2, 4);
325                         aname.CultureInfo = CultureInfo.InvariantCulture;
326                         try {
327                                 AppDomain.CurrentDomain.Load (aname);
328                                 Assert.Fail ("#A10");
329                         } catch (FileNotFoundException) {
330                         }
331
332                         aname = new AssemblyName ();
333                         aname.Name = "bug79720A";
334                         aname.Version = new Version (2, 4, 0, 0);
335                         aname.CultureInfo = CultureInfo.InvariantCulture;
336                         try {
337                                 AppDomain.CurrentDomain.Load (aname);
338                                 Assert.Fail ("#A11");
339                         } catch (FileNotFoundException) {
340                         }
341
342                         Assert.AreEqual (assemblyStartCount + 1, AppDomain.CurrentDomain.GetAssemblies ().Length, "#A12");
343
344                         // PART B
345
346                         assemblyFile = Path.Combine (tempDir, "bug79720B.dll");
347                         aname = new AssemblyName ();
348                         aname.Name = "bug79720B";
349                         aname.Version = new Version (2, 4, 1);
350                         aname.CultureInfo = new CultureInfo ("nl-BE");
351
352                         GenerateAssembly (aname, assemblyFile);
353
354                         Assert.AreEqual (assemblyStartCount + 1, AppDomain.CurrentDomain.GetAssemblies ().Length, "#B1");
355
356                         aname = new AssemblyName ();
357                         aname.Name = "bug79720B";
358                         try {
359                                 AppDomain.CurrentDomain.Load (aname);
360                                 Assert.Fail ("#B2");
361                         } catch (FileNotFoundException) {
362                         }
363
364                         aname = new AssemblyName ();
365                         aname.Name = "bug79720B";
366                         aname.Version = new Version (0, 0, 0, 0);
367                         try {
368                                 AppDomain.CurrentDomain.Load (aname);
369                                 Assert.Fail ("#B3");
370                         } catch (FileNotFoundException) {
371                         }
372
373                         aname = new AssemblyName ();
374                         aname.Name = "bug79720B";
375                         aname.Version = new Version (2, 4, 1);
376                         try {
377                                 AppDomain.CurrentDomain.Load (aname);
378                                 Assert.Fail ("#B4");
379                         } catch (FileNotFoundException) {
380                         }
381
382                         aname = new AssemblyName ();
383                         aname.Name = "bug79720B";
384                         aname.Version = new Version (2, 4, 1);
385                         aname.CultureInfo = new CultureInfo ("nl-BE");
386                         try {
387                                 AppDomain.CurrentDomain.Load (aname);
388                                 Assert.Fail ("#B5");
389                         } catch (FileNotFoundException) {
390                         }
391
392                         Assert.AreEqual (assemblyStartCount + 1, AppDomain.CurrentDomain.GetAssemblies ().Length, "#B6");
393
394                         Assembly.LoadFrom (assemblyFile);
395
396                         Assert.AreEqual (assemblyStartCount + 2, AppDomain.CurrentDomain.GetAssemblies ().Length, "#B7");
397
398                         aname = new AssemblyName ();
399                         aname.Name = "bug79720B";
400                         try {
401                                 AppDomain.CurrentDomain.Load (aname);
402                                 Assert.Fail ("#B8");
403                         } catch (FileNotFoundException) {
404                         }
405
406                         aname = new AssemblyName ();
407                         aname.Name = "bug79720B";
408                         aname.Version = new Version (0, 0, 0, 0);
409                         try {
410                                 AppDomain.CurrentDomain.Load (aname);
411                                 Assert.Fail ("#B9");
412                         } catch (FileNotFoundException) {
413                         }
414
415                         aname = new AssemblyName ();
416                         aname.Name = "bug79720B";
417                         aname.Version = new Version (2, 4, 1);
418                         try {
419                                 AppDomain.CurrentDomain.Load (aname);
420                                 Assert.Fail ("#B10");
421                         } catch (FileNotFoundException) {
422                         }
423
424                         aname = new AssemblyName ();
425                         aname.Name = "bug79720B";
426                         aname.Version = new Version (2, 4, 1);
427                         aname.CultureInfo = new CultureInfo ("nl-BE");
428                         try {
429                                 AppDomain.CurrentDomain.Load (aname);
430                                 Assert.Fail ("#B11");
431                         } catch (FileNotFoundException) {
432                         }
433
434                         Assert.AreEqual (assemblyStartCount + 2, AppDomain.CurrentDomain.GetAssemblies ().Length, "#B12");
435
436                         // PART C
437
438                         assemblyFile = Path.Combine (tempDir, "bug79720C.dll");
439                         aname = new AssemblyName ();
440                         aname.Name = "bug79720C";
441                         aname.CultureInfo = new CultureInfo ("nl-BE");
442                         aname.Version = new Version (2, 4);
443                         aname.KeyPair = new StrongNameKeyPair (keyPair);
444
445                         GenerateAssembly (aname, assemblyFile);
446
447                         Assert.AreEqual (assemblyStartCount + 2, AppDomain.CurrentDomain.GetAssemblies ().Length, "#C1");
448
449                         aname = new AssemblyName ();
450                         aname.Name = "bug79720C";
451                         try {
452                                 AppDomain.CurrentDomain.Load (aname);
453                                 Assert.Fail ("#C2");
454                         } catch (FileNotFoundException) {
455                         }
456
457                         aname = new AssemblyName ();
458                         aname.Name = "bug79720C";
459                         aname.Version = new Version (0, 0, 0, 0);
460                         try {
461                                 AppDomain.CurrentDomain.Load (aname);
462                                 Assert.Fail ("#C3");
463                         } catch (FileNotFoundException) {
464                         }
465
466                         aname = new AssemblyName ();
467                         aname.Name = "bug79720C";
468                         aname.Version = new Version (2, 4, 1);
469                         try {
470                                 AppDomain.CurrentDomain.Load (aname);
471                                 Assert.Fail ("#C4");
472                         } catch (FileNotFoundException) {
473                         }
474
475                         aname = new AssemblyName ();
476                         aname.Name = "bug79720C";
477                         aname.Version = new Version (2, 4, 1);
478                         aname.CultureInfo = new CultureInfo ("nl-BE");
479                         try {
480                                 AppDomain.CurrentDomain.Load (aname);
481                                 Assert.Fail ("#C5");
482                         } catch (FileNotFoundException) {
483                         }
484
485                         aname = new AssemblyName ();
486                         aname.Name = "bug79720C";
487                         aname.Version = new Version (2, 4, 1);
488                         aname.CultureInfo = new CultureInfo ("nl-BE");
489                         aname.SetPublicKey (publicKey);
490                         try {
491                                 AppDomain.CurrentDomain.Load (aname);
492                                 Assert.Fail ("#C6");
493                         } catch (FileNotFoundException) {
494                         }
495
496                         Assert.AreEqual (assemblyStartCount + 2, AppDomain.CurrentDomain.GetAssemblies ().Length, "#C7");
497
498                         Assembly.LoadFrom (assemblyFile);
499
500                         Assert.AreEqual (assemblyStartCount + 3, AppDomain.CurrentDomain.GetAssemblies ().Length, "#C8");
501
502                         aname = new AssemblyName ();
503                         aname.Name = "bug79720C";
504                         try {
505                                 AppDomain.CurrentDomain.Load (aname);
506                                 Assert.Fail ("#C9");
507                         } catch (FileNotFoundException) {
508                         }
509
510                         aname = new AssemblyName ();
511                         aname.Name = "bug79720C";
512                         aname.Version = new Version (0, 0, 0, 0);
513                         try {
514                                 AppDomain.CurrentDomain.Load (aname);
515                                 Assert.Fail ("#C10");
516                         } catch (FileNotFoundException) {
517                         }
518
519                         aname = new AssemblyName ();
520                         aname.Name = "bug79720C";
521                         aname.Version = new Version (2, 4);
522                         try {
523                                 AppDomain.CurrentDomain.Load (aname);
524                                 Assert.Fail ("#C11");
525                         } catch (FileNotFoundException) {
526                         }
527
528                         aname = new AssemblyName ();
529                         aname.Name = "bug79720C";
530                         aname.Version = new Version (2, 4);
531                         aname.CultureInfo = new CultureInfo ("nl-BE");
532                         try {
533                                 AppDomain.CurrentDomain.Load (aname);
534                                 Assert.Fail ("#C12");
535                         } catch (FileNotFoundException) {
536                         }
537
538                         aname = new AssemblyName ();
539                         aname.Name = "bug79720C";
540                         aname.Version = new Version (2, 4);
541                         aname.CultureInfo = new CultureInfo ("nl-BE");
542                         aname.SetPublicKey (publicKey);
543                         try {
544                                 AppDomain.CurrentDomain.Load (aname);
545                                 Assert.Fail ("#C13");
546                         } catch (FileNotFoundException) {
547                         }
548
549                         Assert.AreEqual (assemblyStartCount + 3, AppDomain.CurrentDomain.GetAssemblies ().Length, "#C14");
550                 }
551
552                 [Test]
553                 [Category ("NotWorking")]
554                 public void Load_Loaded_Multiple ()
555                 {
556                         string cultureDir = Path.Combine (tempDir, "nl-BE");
557                         if (!Directory.Exists (cultureDir))
558                                 Directory.CreateDirectory (cultureDir);
559
560                         AppDomain ad = CreateTestDomain (tempDir, true);
561                         try {
562                                 CrossDomainTester cdt = CreateCrossDomainTester (ad);
563
564                                 int assemblyCount = cdt.AssemblyCount;
565
566                                 // PART A
567
568                                 AssemblyName aname = new AssemblyName ();
569                                 aname.Name = "multipleA";
570                                 aname.Version = new Version (1, 2, 3, 4);
571                                 cdt.GenerateAssembly (aname, Path.Combine (tempDir, "multipleA.dll"));
572
573                                 Assert.AreEqual (assemblyCount + 1, cdt.AssemblyCount, "#A1");
574
575                                 aname = new AssemblyName ();
576                                 aname.Name = "multipleA";
577                                 Assert.IsTrue (cdt.AssertLoad (aname), "#A2");
578
579                                 Assert.AreEqual (assemblyCount + 2, cdt.AssemblyCount, "#A3");
580
581                                 aname = new AssemblyName ();
582                                 aname.Name = "multipleA";
583                                 Assert.IsTrue (cdt.AssertLoad (aname), "#A4");
584
585                                 aname = new AssemblyName ();
586                                 aname.Name = "multipleA";
587                                 aname.CultureInfo = CultureInfo.InvariantCulture;
588                                 Assert.IsTrue (cdt.AssertLoad (aname), "#A5");
589
590                                 aname = new AssemblyName ();
591                                 aname.Name = "multipleA";
592                                 aname.CultureInfo = CultureInfo.InvariantCulture;
593                                 Assert.IsTrue (cdt.AssertLoad (aname), "#A6");
594
595                                 aname = new AssemblyName ();
596                                 aname.Name = "multipleA";
597                                 aname.CultureInfo = CultureInfo.InvariantCulture;
598                                 aname.Version = new Version (1, 2, 3, 4);
599                                 Assert.IsTrue (cdt.AssertLoad (aname), "#A7");
600
601                                 aname = new AssemblyName ();
602                                 aname.Name = "multipleA";
603                                 aname.CultureInfo = CultureInfo.InvariantCulture;
604                                 aname.Version = new Version (1, 2, 3, 4);
605                                 Assert.IsTrue (cdt.AssertLoad (aname), "#A8");
606
607                                 Assert.AreEqual (assemblyCount + 2, cdt.AssemblyCount, "#A9");
608
609                                 // PART B
610
611                                 aname = new AssemblyName ();
612                                 aname.Name = "multipleB";
613                                 aname.CultureInfo = new CultureInfo ("nl-BE");
614                                 aname.Version = new Version (2, 4, 1, 0);
615                                 cdt.GenerateAssembly (aname, Path.Combine (tempDir, "nl-BE/multipleB.dll"));
616
617                                 Assert.AreEqual (assemblyCount + 3, cdt.AssemblyCount, "#B1");
618
619                                 aname = new AssemblyName ();
620                                 aname.Name = "multipleB";
621                                 Assert.IsTrue (cdt.AssertLoad (aname), "#B2");
622
623                                 Assert.AreEqual (assemblyCount + 4, cdt.AssemblyCount, "#B3");
624
625                                 aname = new AssemblyName ();
626                                 aname.Name = "multipleB";
627                                 Assert.IsTrue (cdt.AssertLoad (aname), "#B4");
628
629                                 aname = new AssemblyName ();
630                                 aname.Name = "multipleB";
631                                 aname.CultureInfo = new CultureInfo ("nl-BE");
632                                 Assert.IsTrue (cdt.AssertLoad (aname), "#B5");
633
634                                 aname = new AssemblyName ();
635                                 aname.Name = "multipleB";
636                                 aname.CultureInfo = new CultureInfo ("nl-BE");
637                                 Assert.IsTrue (cdt.AssertLoad (aname), "#B6");
638
639                                 aname = new AssemblyName ();
640                                 aname.Name = "multipleB";
641                                 aname.CultureInfo = new CultureInfo ("nl-BE");
642                                 aname.Version = new Version (2, 4, 1, 0);
643                                 Assert.IsTrue (cdt.AssertLoad (aname), "#B7");
644
645                                 aname = new AssemblyName ();
646                                 aname.Name = "multipleB";
647                                 aname.CultureInfo = new CultureInfo ("nl-BE");
648                                 aname.Version = new Version (2, 4, 1, 0);
649                                 Assert.IsTrue (cdt.AssertLoad (aname), "#B8");
650
651                                 Assert.AreEqual (assemblyCount + 4, cdt.AssemblyCount, "#B9");
652
653                                 // PART C
654
655                                 aname = new AssemblyName ();
656                                 aname.Name = "multipleC";
657                                 aname.CultureInfo = new CultureInfo ("nl-BE");
658                                 aname.Version = new Version (2, 4, 0, 0);
659                                 aname.KeyPair = new StrongNameKeyPair (keyPair);
660                                 cdt.GenerateAssembly (aname, Path.Combine (tempDir, "nl-BE/multipleC.dll"));
661
662                                 Assert.AreEqual (assemblyCount + 5, cdt.AssemblyCount, "#C1");
663
664                                 aname = new AssemblyName ();
665                                 aname.Name = "multipleC";
666                                 aname.CultureInfo = new CultureInfo ("nl-BE");
667                                 aname.Version = new Version (2, 4, 0, 0);
668                                 aname.SetPublicKey (publicKey);
669                                 Assert.IsTrue (cdt.AssertLoad (aname), "#C2");
670
671                                 Assert.AreEqual (assemblyCount + 6, cdt.AssemblyCount, "#C3");
672
673                                 aname = new AssemblyName ();
674                                 aname.Name = "multipleC";
675                                 aname.CultureInfo = new CultureInfo ("nl-BE");
676                                 aname.Version = new Version (2, 4, 0, 0);
677                                 aname.SetPublicKey (publicKey);
678                                 Assert.IsTrue (cdt.AssertLoad (aname), "#C4");
679
680                                 Assert.AreEqual (assemblyCount + 6, cdt.AssemblyCount, "#C5");
681                         } finally {
682                                 AppDomain.Unload (ad);
683                         }
684                 }
685
686                 [Test] // bug #79522
687                 [Category ("NotWorking")]
688                 public void Load_Manifest_Mismatch ()
689                 {
690                         string assemblyFile = Path.Combine (tempDir, "bug79522A.dll");
691                         AssemblyName aname = new AssemblyName ();
692                         aname.Name = "bug79522A";
693                         aname.Version = new Version (2, 4);
694
695                         GenerateAssembly (aname, assemblyFile);
696
697                         aname = new AssemblyName ();
698                         aname.CodeBase = assemblyFile;
699                         aname.Name = "whateveryouwant";
700                         aname.Version = new Version (1, 1);
701
702                         // despite the fact that no assembly with the specified name
703                         // exists, the assembly pointed to by the CodeBase of the
704                         // AssemblyName will be loaded
705                         //
706                         // however the display name of the loaded assembly does not
707                         // match the display name of the AssemblyName, and as a result
708                         // a FileLoadException is thrown
709                         try {
710                                 AppDomain.CurrentDomain.Load (aname);
711                                 Assert.Fail ("#A1");
712                         } catch (FileLoadException) {
713                         }
714
715                         // if we set CodeBase to some garbage, then we'll get a
716                         // FileNotFoundException instead
717                         aname.CodeBase = "whatever";
718                         try {
719                                 AppDomain.CurrentDomain.Load (aname);
720                                 Assert.Fail ("#A2");
721                         } catch (FileNotFoundException) {
722                         }
723
724                         aname = new AssemblyName ();
725                         aname.Name = "bug79522A";
726                         aname.CodeBase = assemblyFile;
727 #if NET_2_0
728                         AppDomain.CurrentDomain.Load (aname);
729 #else
730                         try {
731                                 AppDomain.CurrentDomain.Load (aname);
732                                 Assert.Fail ("#A3");
733                         } catch (FileLoadException) {
734                         }
735 #endif
736
737                         aname = new AssemblyName ();
738                         aname.Name = "bug79522A";
739                         aname.CodeBase = assemblyFile;
740                         aname.Version = new Version (2, 5);
741 #if NET_2_0
742                         // the version number is not considered when comparing the manifest
743                         // of the assembly found using codebase
744                         AppDomain.CurrentDomain.Load (aname);
745 #else
746                         try {
747                                 AppDomain.CurrentDomain.Load (aname);
748                                 Assert.Fail ("#A4");
749                         } catch (FileLoadException) {
750                         }
751 #endif
752
753                         aname = new AssemblyName ();
754                         aname.Name = "bug79522A";
755                         aname.CodeBase = assemblyFile;
756                         aname.Version = new Version (2, 4, 1);
757 #if NET_2_0
758                         // the version number is not considered when comparing the manifest
759                         // of the assembly found using codebase
760                         AppDomain.CurrentDomain.Load (aname);
761 #else
762                         try {
763                                 AppDomain.CurrentDomain.Load (aname);
764                                 Assert.Fail ("#A5");
765                         } catch (FileLoadException) {
766                         }
767 #endif
768
769                         // if version is set, then culture must also be set
770                         aname = new AssemblyName ();
771                         aname.Name = "bug79522A";
772                         aname.CodeBase = assemblyFile;
773                         aname.Version = new Version (2, 4);
774 #if NET_2_0
775                         AppDomain.CurrentDomain.Load (aname);
776 #else
777                         try {
778                                 AppDomain.CurrentDomain.Load (aname);
779                                 Assert.Fail ("#A6");
780                         } catch (FileLoadException) {
781                         }
782 #endif
783
784                         // version number does not need to be set
785                         aname = new AssemblyName ();
786                         aname.Name = "bug79522A";
787                         aname.CodeBase = assemblyFile;
788                         aname.CultureInfo = CultureInfo.InvariantCulture;
789                         AppDomain.CurrentDomain.Load (aname);
790
791                         // if set, the version number must match exactly
792                         aname = new AssemblyName ();
793                         aname.Name = "bug79522A";
794                         aname.CodeBase = assemblyFile;
795                         aname.CultureInfo = CultureInfo.InvariantCulture;
796                         aname.Version = new Version (2, 4);
797                         AppDomain.CurrentDomain.Load (aname);
798
799                         // if both culture and version are set, then the version diff
800                         // is ignored
801                         aname = new AssemblyName ();
802                         aname.Name = "bug79522A";
803                         aname.CodeBase = assemblyFile;
804                         aname.CultureInfo = CultureInfo.InvariantCulture;
805                         aname.Version = new Version (2, 5);
806                         AppDomain.CurrentDomain.Load (aname);
807
808                         // loaded assembly is not signed
809                         aname = new AssemblyName ();
810                         aname.Name = "bug79522A";
811                         aname.CodeBase = assemblyFile;
812                         aname.CultureInfo = CultureInfo.InvariantCulture;
813                         aname.Version = new Version (2, 4);
814                         aname.SetPublicKey (publicKey);
815                         try {
816                                 AppDomain.CurrentDomain.Load (aname);
817                                 Assert.Fail ("#A7");
818                         } catch (FileLoadException) {
819                         }
820
821                         // if set, the culture must match
822                         aname = new AssemblyName ();
823                         aname.Name = "bug79522A";
824                         aname.CodeBase = assemblyFile;
825                         aname.Version = new Version (2, 4);
826                         aname.CultureInfo = new CultureInfo ("en-US");
827                         try {
828                                 AppDomain.CurrentDomain.Load (aname);
829                                 Assert.Fail ("#A8");
830                         } catch (FileLoadException) {
831                         }
832
833                         // PART B
834
835                         assemblyFile = Path.Combine (tempDir, "bug79522B.dll");
836                         aname = new AssemblyName ();
837                         aname.Name = "bug79522B";
838                         aname.CultureInfo = new CultureInfo ("nl-BE");
839                         aname.Version = new Version (2, 4, 1);
840
841                         GenerateAssembly (aname, assemblyFile);
842
843                         aname = new AssemblyName ();
844                         aname.CodeBase = assemblyFile;
845                         aname.Name = "whateveryouwant";
846                         aname.CultureInfo = new CultureInfo ("nl-BE");
847                         aname.Version = new Version (1, 1);
848
849                         // despite the fact that no assembly with the specified name
850                         // exists, the assembly pointed to by the CodeBase of the
851                         // AssemblyName will be loaded
852                         //
853                         // however the display name of the loaded assembly does not
854                         // match the display name of the AssemblyName, and as a result
855                         // a FileLoadException is thrown
856                         try {
857                                 AppDomain.CurrentDomain.Load (aname);
858                                 Assert.Fail ("#B1");
859                         } catch (FileLoadException) {
860                         }
861
862                         // if we set CodeBase to some garbage, then we'll get a
863                         // FileNotFoundException instead
864                         aname.CodeBase = "whatever";
865                         try {
866                                 AppDomain.CurrentDomain.Load (aname);
867                                 Assert.Fail ("#B2");
868                         } catch (FileNotFoundException) {
869                         }
870
871                         aname = new AssemblyName ();
872                         aname.Name = "bug79522B";
873                         aname.CodeBase = assemblyFile;
874 #if NET_2_0
875                         // the version number is not considered when comparing the manifest
876                         // of the assembly found using codebase
877                         AppDomain.CurrentDomain.Load (aname);
878 #else
879                         try {
880                                 AppDomain.CurrentDomain.Load (aname);
881                                 Assert.Fail ("#B3");
882                         } catch (FileLoadException) {
883                         }
884 #endif
885
886                         aname = new AssemblyName ();
887                         aname.Name = "bug79522B";
888                         aname.CodeBase = assemblyFile;
889                         aname.Version = new Version (5, 5);
890 #if NET_2_0
891                         // the version number is not considered when comparing the manifest
892                         // of the assembly found using codebase
893                         AppDomain.CurrentDomain.Load (aname);
894 #else
895                         try {
896                                 AppDomain.CurrentDomain.Load (aname);
897                                 Assert.Fail ("#B3");
898                         } catch (FileLoadException) {
899                         }
900 #endif
901
902                         aname = new AssemblyName ();
903                         aname.Name = "bug79522B";
904                         aname.CodeBase = assemblyFile;
905                         aname.Version = new Version (2, 4, 1);
906 #if NET_2_0
907                         AppDomain.CurrentDomain.Load (aname);
908 #else
909                         // when the loaded assembly has a specific culture, then that
910                         // culture must be set if you set the Version on the aname
911                         try {
912                                 AppDomain.CurrentDomain.Load (aname);
913                                 Assert.Fail ("#B4");
914                         } catch (FileLoadException) {
915                         }
916 #endif
917
918                         // version does not need to be set
919                         aname = new AssemblyName ();
920                         aname.Name = "bug79522B";
921                         aname.CodeBase = assemblyFile;
922                         aname.CultureInfo = new CultureInfo ("nl-BE");
923                         AppDomain.CurrentDomain.Load (aname);
924
925                         // if both culture and version are set, then the version diff
926                         // is ignored
927                         aname = new AssemblyName ();
928                         aname.Name = "bug79522B";
929                         aname.CodeBase = assemblyFile;
930                         aname.CultureInfo = new CultureInfo ("nl-BE");
931                         aname.Version = new Version (6, 5);
932                         AppDomain.CurrentDomain.Load (aname);
933
934                         // loaded assembly is not signed
935                         aname = new AssemblyName ();
936                         aname.Name = "bug79522B";
937                         aname.CodeBase = assemblyFile;
938                         aname.CultureInfo = new CultureInfo ("nl-BE");
939                         aname.SetPublicKey (publicKey);
940                         try {
941                                 AppDomain.CurrentDomain.Load (aname);
942                                 Assert.Fail ("#B5");
943                         } catch (FileLoadException) {
944                         }
945
946                         // if set, the culture must match
947                         aname = new AssemblyName ();
948                         aname.Name = "bug79522B";
949                         aname.CodeBase = assemblyFile;
950                         aname.Version = new Version (2, 4, 1);
951                         aname.CultureInfo = new CultureInfo ("en-US");
952                         try {
953                                 AppDomain.CurrentDomain.Load (aname);
954                                 Assert.Fail ("#B6");
955                         } catch (FileLoadException) {
956                         }
957
958                         // PART C
959
960                         assemblyFile = Path.Combine (tempDir, "bug79522C.dll");
961                         aname = new AssemblyName ();
962                         aname.Name = "bug79522C";
963                         aname.CultureInfo = new CultureInfo ("nl-BE");
964                         aname.Version = new Version (2, 4);
965                         aname.KeyPair = new StrongNameKeyPair (keyPair);
966
967                         GenerateAssembly (aname, assemblyFile);
968
969                         aname = new AssemblyName ();
970                         aname.CodeBase = assemblyFile;
971                         aname.Name = "whateveryouwant";
972                         aname.CultureInfo = new CultureInfo ("nl-BE");
973                         aname.Version = new Version (1, 1);
974                         aname.SetPublicKey (publicKey);
975
976                         // despite the fact that no assembly with the specified name
977                         // exists, the assembly pointed to by the CodeBase of the
978                         // AssemblyName will be loaded
979                         //
980                         // however the display name of the loaded assembly does not
981                         // match the display name of the AssemblyName, and as a result
982                         // a FileLoadException is thrown
983                         try {
984                                 AppDomain.CurrentDomain.Load (aname);
985                                 Assert.Fail ("#C1");
986                         } catch (FileLoadException) {
987                         }
988
989                         // if we set CodeBase to some garbage, then we'll get a
990                         // FileNotFoundException instead
991                         aname.CodeBase = "whatever";
992                         try {
993                                 AppDomain.CurrentDomain.Load (aname);
994                                 Assert.Fail ("#C2");
995                         } catch (FileNotFoundException) {
996                         }
997
998                         aname = new AssemblyName ();
999                         aname.Name = "bug79522C";
1000                         aname.CodeBase = assemblyFile;
1001 #if NET_2_0
1002                         AppDomain.CurrentDomain.Load (aname);
1003 #else
1004                         try {
1005                                 AppDomain.CurrentDomain.Load (aname);
1006                                 Assert.Fail ("#C3");
1007                         } catch (FileLoadException) {
1008                         }
1009 #endif
1010
1011                         aname = new AssemblyName ();
1012                         aname.Name = "bug79522C";
1013                         aname.CodeBase = assemblyFile;
1014                         aname.Version = new Version (5, 5);
1015                         try {
1016                                 AppDomain.CurrentDomain.Load (aname);
1017                                 Assert.Fail ("#C3");
1018                         } catch (FileLoadException) {
1019                         }
1020
1021                         aname = new AssemblyName ();
1022                         aname.Name = "bug79522C";
1023                         aname.CodeBase = assemblyFile;
1024                         aname.Version = new Version (2, 4);
1025 #if NET_2_0
1026                         AppDomain.CurrentDomain.Load (aname);
1027 #else
1028                         // when the loaded assembly has a specific culture/publickey,
1029                         // then that culture/publickey must be set if you set the
1030                         // Version on the aname
1031                         try {
1032                                 AppDomain.CurrentDomain.Load (aname);
1033                                 Assert.Fail ("#C4");
1034                         } catch (FileLoadException) {
1035                         }
1036 #endif
1037
1038                         aname = new AssemblyName ();
1039                         aname.Name = "bug79522C";
1040                         aname.CodeBase = assemblyFile;
1041                         aname.CultureInfo = new CultureInfo ("nl-BE");
1042                         aname.Version = new Version (2, 4);
1043 #if NET_2_0
1044                         AppDomain.CurrentDomain.Load (aname);
1045 #else
1046                         // if loaded assembly is signed, then the public key must be set
1047                         try {
1048                                 AppDomain.CurrentDomain.Load (aname);
1049                                 Assert.Fail ("#C5");
1050                         } catch (FileLoadException) {
1051                         }
1052 #endif
1053
1054                         aname = new AssemblyName ();
1055                         aname.Name = "bug79522C";
1056                         aname.CodeBase = assemblyFile;
1057                         aname.CultureInfo = new CultureInfo ("nl-BE");
1058                         aname.SetPublicKey (publicKey);
1059 #if NET_2_0
1060                         AppDomain.CurrentDomain.Load (aname);
1061 #else
1062                         // if public key is set, then version must be set
1063                         try {
1064                                 AppDomain.CurrentDomain.Load (aname);
1065                                 Assert.Fail ("#C6");
1066                         } catch (FileLoadException) {
1067                         }
1068 #endif
1069
1070                         aname = new AssemblyName ();
1071                         aname.Name = "bug79522C";
1072                         aname.CodeBase = assemblyFile;
1073                         aname.CultureInfo = new CultureInfo ("nl-BE");
1074 #if NET_2_0
1075                         AppDomain.CurrentDomain.Load (aname);
1076 #else
1077                         try {
1078                                 AppDomain.CurrentDomain.Load (aname);
1079                                 Assert.Fail ("#C7");
1080                         } catch (FileLoadException) {
1081                         }
1082 #endif
1083
1084                         // if culture and version are set, then the version must match
1085                         aname = new AssemblyName ();
1086                         aname.Name = "bug79522C";
1087                         aname.CodeBase = assemblyFile;
1088                         aname.CultureInfo = new CultureInfo ("nl-BE");
1089                         aname.SetPublicKey (publicKey);
1090                         aname.Version = new Version (5, 6);
1091                         try {
1092                                 AppDomain.CurrentDomain.Load (aname);
1093                                 Assert.Fail ("#C8");
1094                         } catch (FileLoadException) {
1095                         }
1096
1097                         // publickey must match
1098                         aname = new AssemblyName ();
1099                         aname.Name = "bug79522C";
1100                         aname.CodeBase = assemblyFile;
1101                         aname.CultureInfo = new CultureInfo ("nl-BE");
1102                         aname.Version = new Version (2, 4);
1103                         aname.SetPublicKey (publicKey2);
1104                         try {
1105                                 AppDomain.CurrentDomain.Load (aname);
1106                                 Assert.Fail ("#C9");
1107 #if NET_2_0
1108                         } catch (SecurityException) {
1109                                 // Invalid assembly public key
1110                         }
1111 #else
1112                         } catch (FileLoadException) {
1113                         }
1114 #endif
1115
1116                         aname = new AssemblyName ();
1117                         aname.Name = "bug79522C";
1118                         aname.CodeBase = assemblyFile;
1119                         aname.SetPublicKey (publicKey);
1120                         aname.CultureInfo = new CultureInfo ("nl-BE");
1121                         aname.Version = new Version (2, 4);
1122                         AppDomain.CurrentDomain.Load (aname);
1123                 }
1124
1125                 [Test] // bug #79715
1126                 public void Load_PartialVersion ()
1127                 {
1128                         AppDomain ad = CreateTestDomain (tempDir, true);
1129                         try {
1130                                 CrossDomainTester cdt = CreateCrossDomainTester (ad);
1131
1132                                 AssemblyName aname = new AssemblyName ();
1133                                 aname.Name = "bug79715";
1134                                 aname.Version = new Version (1, 2, 3, 4);
1135                                 cdt.GenerateAssembly (aname, Path.Combine (tempDir, "bug79715.dll"));
1136
1137                                 aname = new AssemblyName ();
1138                                 aname.Name = "bug79715";
1139                                 aname.Version = new Version (1, 2);
1140                                 Assert.IsTrue (cdt.AssertLoad (aname), "#A1");
1141                                 Assert.IsTrue (cdt.AssertLoad (aname.FullName), "#A2");
1142
1143                                 aname = new AssemblyName ();
1144                                 aname.Name = "bug79715";
1145                                 aname.Version = new Version (1, 2, 3);
1146                                 Assert.IsTrue (cdt.AssertLoad (aname), "#B1");
1147                                 Assert.IsTrue (cdt.AssertLoad (aname.FullName), "#B2");
1148
1149                                 aname = new AssemblyName ();
1150                                 aname.Name = "bug79715";
1151                                 aname.Version = new Version (1, 2, 3, 4);
1152                                 Assert.IsTrue (cdt.AssertLoad (aname), "#C1");
1153                                 Assert.IsTrue (cdt.AssertLoad (aname.FullName), "#C2");
1154                         } finally {
1155                                 AppDomain.Unload (ad);
1156                         }
1157                 }
1158
1159                 [Test]
1160                 public void SetAppDomainPolicy ()
1161                 {
1162                         ad = AppDomain.CreateDomain ("SetAppDomainPolicy_Null");
1163                         ad.SetAppDomainPolicy (PolicyLevel.CreateAppDomainLevel ());
1164                         // not much to see
1165                 }
1166
1167                 [Test]
1168                 [ExpectedException (typeof (ArgumentNullException))]
1169                 public void SetAppDomainPolicy_Null ()
1170                 {
1171                         ad = AppDomain.CreateDomain ("SetAppDomainPolicy_Null");
1172                         ad.SetAppDomainPolicy (null);
1173                 }
1174
1175                 [Test]
1176                 [ExpectedException (typeof (PolicyException))]
1177                 public void SetAppDomainPolicy_Dual ()
1178                 {
1179                         ad = AppDomain.CreateDomain ("SetAppDomainPolicy_Dual");
1180                         PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
1181                         PermissionSet ps = new PermissionSet (PermissionState.Unrestricted);
1182                         pl.RootCodeGroup.PolicyStatement = new PolicyStatement (ps);
1183                         ad.SetAppDomainPolicy (pl);
1184
1185                         // only one time!
1186                         pl = PolicyLevel.CreateAppDomainLevel ();
1187                         ps = new PermissionSet (PermissionState.None);
1188                         pl.RootCodeGroup.PolicyStatement = new PolicyStatement (ps);
1189                         ad.SetAppDomainPolicy (pl);
1190                 }
1191
1192                 [Test]
1193                 [ExpectedException (typeof (AppDomainUnloadedException))]
1194                 public void SetAppDomainPolicy_Unloaded ()
1195                 {
1196                         ad = AppDomain.CreateDomain ("SetAppDomainPolicy_Unloaded");
1197                         AppDomain.Unload (ad);
1198                         ad.SetAppDomainPolicy (PolicyLevel.CreateAppDomainLevel ());
1199                 }
1200
1201                 [Test]
1202                 [ExpectedException (typeof (ArgumentNullException))]
1203                 public void GetData_Null ()
1204                 {
1205                         AppDomain.CurrentDomain.GetData (null);
1206                 }
1207
1208                 [Test]
1209                 public void SetData ()
1210                 {
1211                         AppDomain.CurrentDomain.SetData ("data", "data");
1212                         Assert.AreEqual ("data", AppDomain.CurrentDomain.GetData ("data"), "GetData");
1213                         AppDomain.CurrentDomain.SetData ("data", null);
1214                         Assert.IsNull (AppDomain.CurrentDomain.GetData ("data"), "GetData-Null");
1215                 }
1216
1217                 [Test]
1218                 [ExpectedException (typeof (ArgumentNullException))]
1219                 public void SetData_Null ()
1220                 {
1221                         AppDomain.CurrentDomain.SetData (null, "data");
1222                 }
1223
1224 #if NET_2_0
1225                 [Test]
1226                 public void ApplyPolicy ()
1227                 {
1228                         ad = AppDomain.CreateDomain ("ApplyPolicy");
1229                         string fullname = Assembly.GetExecutingAssembly ().FullName;
1230                         string result = ad.ApplyPolicy (fullname);
1231                         Assert.AreEqual (fullname, result, "ApplyPolicy");
1232                         // doesn't even requires an assembly name
1233                         Assert.AreEqual ("123", ad.ApplyPolicy ("123"), "Invalid FullName");
1234                 }
1235
1236                 [Test]
1237                 [ExpectedException (typeof (ArgumentException))]
1238                 public void ApplyPolicy_Empty ()
1239                 {
1240                         ad = AppDomain.CreateDomain ("ApplyPolicy_Empty");
1241                         ad.ApplyPolicy (String.Empty);
1242                 }
1243
1244                 [Test]
1245                 [ExpectedException (typeof (ArgumentNullException))]
1246                 public void ApplyPolicy_Null ()
1247                 {
1248                         ad = AppDomain.CreateDomain ("ApplyPolicy_Null");
1249                         ad.ApplyPolicy (null);
1250                 }
1251
1252                 [Test]
1253                 public void DomainManager ()
1254                 {
1255                         Assert.IsNull (AppDomain.CurrentDomain.DomainManager, "CurrentDomain.DomainManager");
1256                         ad = AppDomain.CreateDomain ("DomainManager");
1257                         Assert.IsNull (ad.DomainManager, "ad.DomainManager");
1258                 }
1259
1260                 [Test]
1261                 public void IsDefaultAppDomain ()
1262                 {
1263                         ad = AppDomain.CreateDomain ("ReflectionOnlyGetAssemblies");
1264                         Assert.IsFalse (ad.IsDefaultAppDomain (), "IsDefaultAppDomain");
1265                         // we have no public way to get the default appdomain
1266                 }
1267
1268                 [Test]
1269                 public void ReflectionOnlyGetAssemblies ()
1270                 {
1271                         ad = AppDomain.CreateDomain ("ReflectionOnlyGetAssemblies");
1272                         Assembly [] a = ad.ReflectionOnlyGetAssemblies ();
1273                         Assert.IsNotNull (a, "ReflectionOnlyGetAssemblies");
1274                         Assert.AreEqual (0, a.Length, "Count");
1275                 }
1276 #endif
1277
1278                 private static AppDomain CreateTestDomain (string baseDirectory, bool assemblyResolver)
1279                 {
1280                         AppDomainSetup setup = new AppDomainSetup ();
1281                         setup.ApplicationBase = baseDirectory;
1282                         setup.ApplicationName = "testdomain";
1283
1284                         AppDomain ad = AppDomain.CreateDomain ("testdomain",
1285                                 AppDomain.CurrentDomain.Evidence, setup);
1286
1287                         if (assemblyResolver) {
1288                                 Assembly ea = Assembly.GetExecutingAssembly ();
1289                                 ad.CreateInstanceFrom (ea.CodeBase,
1290                                         typeof (AssemblyResolveHandler).FullName,
1291                                         false,
1292                                         BindingFlags.Public | BindingFlags.Instance,
1293                                         null,
1294                                         new object [] { ea.Location, ea.FullName },
1295                                         CultureInfo.InvariantCulture,
1296                                         null,
1297                                         null);
1298                         }
1299
1300                         return ad;
1301                 }
1302
1303                 private static CrossDomainTester CreateCrossDomainTester (AppDomain domain)
1304                 {
1305                         Type testerType = typeof (CrossDomainTester);
1306                         return (CrossDomainTester) domain.CreateInstanceAndUnwrap (
1307                                 testerType.Assembly.FullName, testerType.FullName, false,
1308                                 BindingFlags.Public | BindingFlags.Instance, null, new object [0],
1309                                 CultureInfo.InvariantCulture, new object [0], null);
1310                 }
1311
1312                 private static void GenerateAssembly (AssemblyName aname, string path)
1313                 {
1314                         AppDomain ad = CreateTestDomain (AppDomain.CurrentDomain.BaseDirectory,
1315                                 false);
1316                         try {
1317                                 CrossDomainTester cdt = CreateCrossDomainTester (ad);
1318                                 cdt.GenerateAssembly (aname, path);
1319                         } finally {
1320                                 AppDomain.Unload (ad);
1321                         }
1322                 }
1323
1324                 private class CrossDomainTester : MarshalByRefObject
1325                 {
1326                         public void GenerateAssembly (AssemblyName aname, string path)
1327                         {
1328                                 AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1329                                         aname, AssemblyBuilderAccess.Save, Path.GetDirectoryName (path));
1330                                 ab.Save (Path.GetFileName (path));
1331                         }
1332
1333                         public int AssemblyCount {
1334                                 get {
1335                                         return AppDomain.CurrentDomain.GetAssemblies ().Length;
1336                                 }
1337                         }
1338
1339                         public void Load (AssemblyName assemblyRef)
1340                         {
1341                                 AppDomain.CurrentDomain.Load (assemblyRef);
1342                         }
1343
1344                         public void LoadFrom (string assemblyFile)
1345                         {
1346                                 Assembly.LoadFrom (assemblyFile);
1347                         }
1348
1349                         public bool AssertLoad (AssemblyName assemblyRef)
1350                         {
1351                                 try {
1352                                         AppDomain.CurrentDomain.Load (assemblyRef);
1353                                         return true;
1354                                 } catch {
1355                                         return false;
1356                                 }
1357                         }
1358
1359                         public bool AssertLoad (string assemblyString)
1360                         {
1361                                 try {
1362                                         AppDomain.CurrentDomain.Load (assemblyString);
1363                                         return true;
1364                                 } catch {
1365                                         return false;
1366                                 }
1367                         }
1368
1369                         public bool AssertFileLoadException (AssemblyName assemblyRef)
1370                         {
1371                                 try {
1372                                         AppDomain.CurrentDomain.Load (assemblyRef);
1373                                         return false;
1374                                 } catch (FileLoadException) {
1375                                         return true;
1376                                 }
1377                         }
1378
1379                         public bool AssertFileNotFoundException (AssemblyName assemblyRef)
1380                         {
1381                                 try {
1382                                         AppDomain.CurrentDomain.Load (assemblyRef);
1383                                         return false;
1384                                 } catch (FileNotFoundException) {
1385                                         return true;
1386                                 }
1387                         }
1388                 }
1389
1390                 [Serializable ()]
1391                 private class AssemblyResolveHandler
1392                 {
1393                         public AssemblyResolveHandler (string assemblyFile, string assemblyName)
1394                         {
1395                                 _assemblyFile = assemblyFile;
1396                                 _assemblyName = assemblyName;
1397
1398                                 AppDomain.CurrentDomain.AssemblyResolve +=
1399                                         new ResolveEventHandler (ResolveAssembly);
1400                         }
1401
1402                         private Assembly ResolveAssembly (Object sender, ResolveEventArgs args)
1403                         {
1404                                 if (args.Name == _assemblyName)
1405                                         return Assembly.LoadFrom (_assemblyFile);
1406
1407                                 return null;
1408                         }
1409
1410                         private readonly string _assemblyFile;
1411                         private readonly string _assemblyName;
1412                 }
1413
1414                 static byte [] keyPair = {
1415                         0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41,
1416                         0x32, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD,
1417                         0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B,
1418                         0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9,
1419                         0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78,
1420                         0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68,
1421                         0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E,
1422                         0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F,
1423                         0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D,
1424                         0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB,
1425                         0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5,
1426                         0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56,
1427                         0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00,
1428                         0x4A, 0xF8, 0xFF, 0xA4, 0xCB, 0x73, 0xC0, 0x6A, 0x62, 0xB4, 0xB7,
1429                         0xC8, 0x92, 0x58, 0x87, 0xCD, 0x07, 0x0C, 0x7D, 0x6C, 0xC1, 0x4A,
1430                         0xFC, 0x82, 0x57, 0x0E, 0x43, 0x85, 0x09, 0x75, 0x98, 0x51, 0xBB,
1431                         0x35, 0xF5, 0x64, 0x83, 0xC7, 0x79, 0x89, 0x5C, 0x55, 0x36, 0x66,
1432                         0xAB, 0x27, 0xA4, 0xD9, 0xD4, 0x7E, 0x6B, 0x67, 0x64, 0xC1, 0x54,
1433                         0x4E, 0x37, 0xF1, 0x4E, 0xCA, 0xB3, 0xE5, 0x63, 0x91, 0x57, 0x12,
1434                         0x14, 0xA6, 0xEA, 0x8F, 0x8F, 0x2B, 0xFE, 0xF3, 0xE9, 0x16, 0x08,
1435                         0x2B, 0x86, 0xBC, 0x26, 0x0D, 0xD0, 0xC6, 0xC4, 0x1A, 0x72, 0x43,
1436                         0x76, 0xDC, 0xFF, 0x28, 0x52, 0xA1, 0xDE, 0x8D, 0xFA, 0xD5, 0x1F,
1437                         0x0B, 0xB5, 0x4F, 0xAF, 0x06, 0x79, 0x11, 0xEE, 0xA8, 0xEC, 0xD3,
1438                         0x74, 0x55, 0xA2, 0x80, 0xFC, 0xF8, 0xD9, 0x50, 0x69, 0x48, 0x01,
1439                         0xC2, 0x5A, 0x04, 0x56, 0xB4, 0x3E, 0x24, 0x32, 0x20, 0xB5, 0x2C,
1440                         0xDE, 0xBB, 0xBD, 0x13, 0xFD, 0x13, 0xF7, 0x03, 0x3E, 0xE3, 0x37,
1441                         0x84, 0x74, 0xE7, 0xD0, 0x5E, 0x9E, 0xB6, 0x26, 0xAE, 0x6E, 0xB0,
1442                         0x55, 0x6A, 0x52, 0x63, 0x6F, 0x5A, 0x9D, 0xF2, 0x67, 0xD6, 0x61,
1443                         0x4F, 0x7A, 0x45, 0xEE, 0x5C, 0x3D, 0x2B, 0x7C, 0xB2, 0x40, 0x79,
1444                         0x54, 0x84, 0xD1, 0xBE, 0x61, 0x3E, 0x5E, 0xD6, 0x18, 0x8E, 0x14,
1445                         0x98, 0xFC, 0x35, 0xBF, 0x5F, 0x1A, 0x20, 0x2E, 0x1A, 0xD8, 0xFF,
1446                         0xC4, 0x6B, 0xC0, 0xC9, 0x7D, 0x06, 0xEF, 0x09, 0xF9, 0xF3, 0x69,
1447                         0xFC, 0xBC, 0xA2, 0xE6, 0x80, 0x22, 0xB9, 0x79, 0x7E, 0xEF, 0x57,
1448                         0x9F, 0x49, 0xE1, 0xBC, 0x0D, 0xB6, 0xA1, 0xFE, 0x8D, 0xBC, 0xBB,
1449                         0xA3, 0x05, 0x02, 0x6B, 0x04, 0x45, 0xF7, 0x5D, 0xEE, 0x43, 0x06,
1450                         0xD6, 0x9C, 0x94, 0x48, 0x1A, 0x0B, 0x9C, 0xBC, 0xB4, 0x4E, 0x93,
1451                         0x60, 0x87, 0xCD, 0x58, 0xD6, 0x9A, 0x39, 0xA6, 0xC0, 0x7F, 0x8E,
1452                         0xFF, 0x25, 0xC1, 0xD7, 0x2C, 0xF6, 0xF4, 0x6F, 0x24, 0x52, 0x0B,
1453                         0x39, 0x42, 0x1B, 0x0D, 0x04, 0xC1, 0x93, 0x2A, 0x19, 0x1C, 0xF0,
1454                         0xB1, 0x9B, 0xC1, 0x24, 0x6D, 0x1B, 0x0B, 0xDA, 0x1C, 0x8B, 0x72,
1455                         0x48, 0xF0, 0x3E, 0x52, 0xBF, 0x0A, 0x84, 0x3A, 0x9B, 0xC8, 0x6D,
1456                         0x13, 0x1E, 0x72, 0xF4, 0x46, 0x93, 0x88, 0x1A, 0x5F, 0x4C, 0x3C,
1457                         0xE5, 0x9D, 0x6E, 0xBB, 0x4E, 0xDD, 0x5D, 0x1F, 0x11, 0x40, 0xF4,
1458                         0xD7, 0xAF, 0xB3, 0xAB, 0x9A, 0x99, 0x15, 0xF0, 0xDC, 0xAA, 0xFF,
1459                         0x9F, 0x2D, 0x9E, 0x56, 0x4F, 0x35, 0x5B, 0xBA, 0x06, 0x99, 0xEA,
1460                         0xC6, 0xB4, 0x48, 0x51, 0x17, 0x1E, 0xD1, 0x95, 0x84, 0x81, 0x18,
1461                         0xC0, 0xF1, 0x71, 0xDE, 0x44, 0x42, 0x02, 0x06, 0xAC, 0x0E, 0xA8,
1462                         0xE2, 0xF3, 0x1F, 0x96, 0x1F, 0xBE, 0xB6, 0x1F, 0xB5, 0x3E, 0xF6,
1463                         0x81, 0x05, 0x20, 0xFA, 0x2E, 0x40, 0x2E, 0x4D, 0xA0, 0x0E, 0xDA,
1464                         0x42, 0x9C, 0x05, 0xAA, 0x9E, 0xAF, 0x5C, 0xF7, 0x3A, 0x3F, 0xBB,
1465                         0x91, 0x73, 0x45, 0x27, 0xA8, 0xA2, 0x07, 0x4A, 0xEF, 0x59, 0x1E,
1466                         0x97, 0x9D, 0xE0, 0x30, 0x5A, 0x83, 0xCE, 0x1E, 0x57, 0x32, 0x89,
1467                         0x43, 0x41, 0x28, 0x7D, 0x14, 0x8D, 0x8B, 0x41, 0x1A, 0x56, 0x76,
1468                         0x43, 0xDB, 0x64, 0x86, 0x41, 0x64, 0x8D, 0x4C, 0x91, 0x83, 0x4E,
1469                         0xF5, 0x6C };
1470
1471                 static byte [] publicKey2 = {
1472                         0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41,
1473                         0x32, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7F, 0x7C,
1474                         0xEA, 0x4A, 0x28, 0x33, 0xD8, 0x3C, 0x86, 0x90, 0x86, 0x91, 0x11,
1475                         0xBB, 0x30, 0x0D, 0x3D, 0x69, 0x04, 0x4C, 0x48, 0xF5, 0x4F, 0xE7,
1476                         0x64, 0xA5, 0x82, 0x72, 0x5A, 0x92, 0xC4, 0x3D, 0xC5, 0x90, 0x93,
1477                         0x41, 0xC9, 0x1D, 0x34, 0x16, 0x72, 0x2B, 0x85, 0xC1, 0xF3, 0x99,
1478                         0x62, 0x07, 0x32, 0x98, 0xB7, 0xE4, 0xFA, 0x75, 0x81, 0x8D, 0x08,
1479                         0xB9, 0xFD, 0xDB, 0x00, 0x25, 0x30, 0xC4, 0x89, 0x13, 0xB6, 0x43,
1480                         0xE8, 0xCC, 0xBE, 0x03, 0x2E, 0x1A, 0x6A, 0x4D, 0x36, 0xB1, 0xEB,
1481                         0x49, 0x26, 0x6C, 0xAB, 0xC4, 0x29, 0xD7, 0x8F, 0x25, 0x11, 0xA4,
1482                         0x7C, 0x81, 0x61, 0x97, 0xCB, 0x44, 0x2D, 0x80, 0x49, 0x93, 0x48,
1483                         0xA7, 0xC9, 0xAB, 0xDB, 0xCF, 0xA3, 0x34, 0xCB, 0x6B, 0x86, 0xE0,
1484                         0x4D, 0x27, 0xFC, 0xA7, 0x4F, 0x36, 0xCA, 0x13, 0x42, 0xD3, 0x83,
1485                         0xC4, 0x06, 0x6E, 0x12, 0xE0, 0xA1, 0x3D, 0x9F, 0xA9, 0xEC, 0xD1,
1486                         0xC6, 0x08, 0x1B, 0x3D, 0xF5, 0xDB, 0x4C, 0xD4, 0xF0, 0x2C, 0xAA,
1487                         0xFC, 0xBA, 0x18, 0x6F, 0x48, 0x7E, 0xB9, 0x47, 0x68, 0x2E, 0xF6,
1488                         0x1E, 0x67, 0x1C, 0x7E, 0x0A, 0xCE, 0x10, 0x07, 0xC0, 0x0C, 0xAD,
1489                         0x5E, 0xC1, 0x53, 0x70, 0xD5, 0xE7, 0x25, 0xCA, 0x37, 0x5E, 0x49,
1490                         0x59, 0xD0, 0x67, 0x2A, 0xBE, 0x92, 0x36, 0x86, 0x8A, 0xBF, 0x3E,
1491                         0x17, 0x04, 0xFB, 0x1F, 0x46, 0xC8, 0x10, 0x5C, 0x93, 0x02, 0x43,
1492                         0x14, 0x96, 0x6A, 0xD9, 0x87, 0x17, 0x62, 0x7D, 0x3A, 0x45, 0xBE,
1493                         0x35, 0xDE, 0x75, 0x0B, 0x2A, 0xCE, 0x7D, 0xF3, 0x19, 0x85, 0x4B,
1494                         0x0D, 0x6F, 0x8D, 0x15, 0xA3, 0x60, 0x61, 0x28, 0x55, 0x46, 0xCE,
1495                         0x78, 0x31, 0x04, 0x18, 0x3C, 0x56, 0x4A, 0x3F, 0xA4, 0xC9, 0xB1,
1496                         0x41, 0xED, 0x22, 0x80, 0xA1, 0xB3, 0xE2, 0xC7, 0x1B, 0x62, 0x85,
1497                         0xE4, 0x81, 0x39, 0xCB, 0x1F, 0x95, 0xCC, 0x61, 0x61, 0xDF, 0xDE,
1498                         0xF3, 0x05, 0x68, 0xB9, 0x7D, 0x4F, 0xFF, 0xF3, 0xC0, 0x0A, 0x25,
1499                         0x62, 0xD9, 0x8A, 0x8A, 0x9E, 0x99, 0x0B, 0xFB, 0x85, 0x27, 0x8D,
1500                         0xF6, 0xD4, 0xE1, 0xB9, 0xDE, 0xB4, 0x16, 0xBD, 0xDF, 0x6A, 0x25,
1501                         0x9C, 0xAC, 0xCD, 0x91, 0xF7, 0xCB, 0xC1, 0x81, 0x22, 0x0D, 0xF4,
1502                         0x7E, 0xEC, 0x0C, 0x84, 0x13, 0x5A, 0x74, 0x59, 0x3F, 0x3E, 0x61,
1503                         0x00, 0xD6, 0xB5, 0x4A, 0xA1, 0x04, 0xB5, 0xA7, 0x1C, 0x29, 0xD0,
1504                         0xE1, 0x11, 0x19, 0xD7, 0x80, 0x5C, 0xEE, 0x08, 0x15, 0xEB, 0xC9,
1505                         0xA8, 0x98, 0xF5, 0xA0, 0xF0, 0x92, 0x2A, 0xB0, 0xD3, 0xC7, 0x8C,
1506                         0x8D, 0xBB, 0x88, 0x96, 0x4F, 0x18, 0xF0, 0x8A, 0xF9, 0x31, 0x9E,
1507                         0x44, 0x94, 0x75, 0x6F, 0x78, 0x04, 0x10, 0xEC, 0xF3, 0xB0, 0xCE,
1508                         0xA0, 0xBE, 0x7B, 0x25, 0xE1, 0xF7, 0x8A, 0xA8, 0xD4, 0x63, 0xC2,
1509                         0x65, 0x47, 0xCC, 0x5C, 0xED, 0x7D, 0x8B, 0x07, 0x4D, 0x76, 0x29,
1510                         0x53, 0xAC, 0x27, 0x8F, 0x5D, 0x78, 0x56, 0xFA, 0x99, 0x45, 0xA2,
1511                         0xCC, 0x65, 0xC4, 0x54, 0x13, 0x9F, 0x38, 0x41, 0x7A, 0x61, 0x0E,
1512                         0x0D, 0x34, 0xBC, 0x11, 0xAF, 0xE2, 0xF1, 0x8B, 0xFA, 0x2B, 0x54,
1513                         0x6C, 0xA3, 0x6C, 0x09, 0x1F, 0x0B, 0x43, 0x9B, 0x07, 0x95, 0x83,
1514                         0x3F, 0x97, 0x99, 0x89, 0xF5, 0x51, 0x41, 0xF6, 0x8E, 0x5D, 0xEF,
1515                         0x6D, 0x24, 0x71, 0x41, 0x7A, 0xAF, 0xBE, 0x81, 0x71, 0xAB, 0x76,
1516                         0x2F, 0x1A, 0x5A, 0xBA, 0xF3, 0xA6, 0x65, 0x7A, 0x80, 0x50, 0xCE,
1517                         0x23, 0xC3, 0xC7, 0x53, 0xB0, 0x7C, 0x97, 0x77, 0x27, 0x70, 0x98,
1518                         0xAE, 0xB5, 0x24, 0x66, 0xE1, 0x60, 0x39, 0x41, 0xDA, 0x54, 0x01,
1519                         0x64, 0xFB, 0x10, 0x33, 0xCE, 0x8B, 0xBE, 0x27, 0xD4, 0x21, 0x57,
1520                         0xCC, 0x0F, 0x1A, 0xC1, 0x3D, 0xF3, 0xCC, 0x39, 0xF0, 0x2F, 0xAE,
1521                         0xF1, 0xC0, 0xCD, 0x3B, 0x23, 0x87, 0x49, 0x7E, 0x40, 0x32, 0x6A,
1522                         0xD3, 0x96, 0x4A, 0xE5, 0x5E, 0x6E, 0x26, 0xFD, 0x8A, 0xCF, 0x7E,
1523                         0xFC, 0x37, 0xDE, 0x39, 0x0C, 0x53, 0x81, 0x75, 0x08, 0xAF, 0x6B,
1524                         0x39, 0x6C, 0xFB, 0xC9, 0x79, 0xC0, 0x9B, 0x5F, 0x34, 0x86, 0xB2,
1525                         0xDE, 0xC4, 0x19, 0x84, 0x5F, 0x0E, 0xED, 0x9B, 0xB8, 0xD3, 0x17,
1526                         0xDA, 0x78 };
1527
1528                 static byte [] publicKey = {
1529                         0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00,
1530                         0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53,
1531                         0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3d,
1532                         0xbd, 0x72, 0x08, 0xc6, 0x2b, 0x0e, 0xa8, 0xc1, 0xc0, 0x58, 0x07,
1533                         0x2b, 0x63, 0x5f, 0x7c, 0x9a, 0xbd, 0xcb, 0x22, 0xdb, 0x20, 0xb2,
1534                         0xa9, 0xda, 0xda, 0xef, 0xe8, 0x00, 0x64, 0x2f, 0x5d, 0x8d, 0xeb,
1535                         0x78, 0x02, 0xf7, 0xa5, 0x36, 0x77, 0x28, 0xd7, 0x55, 0x8d, 0x14,
1536                         0x68, 0xdb, 0xeb, 0x24, 0x09, 0xd0, 0x2b, 0x13, 0x1b, 0x92, 0x6e,
1537                         0x2e, 0x59, 0x54, 0x4a, 0xac, 0x18, 0xcf, 0xc9, 0x09, 0x02, 0x3f,
1538                         0x4f, 0xa8, 0x3e, 0x94, 0x00, 0x1f, 0xc2, 0xf1, 0x1a, 0x27, 0x47,
1539                         0x7d, 0x10, 0x84, 0xf5, 0x14, 0xb8, 0x61, 0x62, 0x1a, 0x0c, 0x66,
1540                         0xab, 0xd2, 0x4c, 0x4b, 0x9f, 0xc9, 0x0f, 0x3c, 0xd8, 0x92, 0x0f,
1541                         0xf5, 0xff, 0xce, 0xd7, 0x6e, 0x5c, 0x6f, 0xb1, 0xf5, 0x7d, 0xd3,
1542                         0x56, 0xf9, 0x67, 0x27, 0xa4, 0xa5, 0x48, 0x5b, 0x07, 0x93, 0x44,
1543                         0x00, 0x4a, 0xf8, 0xff, 0xa4, 0xcb };
1544         }
1545 }