Merge pull request #2562 from BrzVlad/fix-drainstack-stats
authorVlad Brezae <brezaevlad@gmail.com>
Mon, 15 Feb 2016 19:04:55 +0000 (02:04 +0700)
committerVlad Brezae <brezaevlad@gmail.com>
Mon, 15 Feb 2016 19:04:55 +0000 (02:04 +0700)
[sgen] Drain the gray stack only in finish gray stack

111 files changed:
eglib/src/giconv.c
external/referencesource
mcs/build/library.make
mcs/class/Facades/System.Diagnostics.Tracing/TypeForwarders.cs
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/MessageBase.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/NtlmFlags.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/NtlmSettings.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/Type1Message.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/Type2Message.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/Type3Message.cs
mcs/class/Mono.Security/mobile_Mono.Security.dll.sources
mcs/class/System.Configuration/System.Configuration/Configuration.cs
mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
mcs/class/System.Core/System.Core-net_4_x.csproj
mcs/class/System.Core/System.Core-plaincore-net_4_x.csproj
mcs/class/System.Core/System.Security.Cryptography/CngKeyBlobFormat.cs [deleted file]
mcs/class/System.Core/common_System.Core.dll.sources
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/XmlMessagesFormatter.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel/ChannelFactory_1Test.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel/ClientBaseTest.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/AsyncMethodData.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
mcs/class/System.Windows.Forms/System.Windows.Forms_test.dll.sources
mcs/class/System.Windows.Forms/Test/System.Windows.Forms/FormThreadTest.cs [new file with mode: 0644]
mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs
mcs/class/System/Mono.Net.Security/NoReflectionHelper.cs
mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs
mcs/class/System/System.Net.Security/NegotiateStream.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Store.cs
mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
mcs/class/System/Test/System.Net.Security/SslStreamTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
mcs/class/corlib/Makefile
mcs/class/corlib/Mono/DataConverter.cs
mcs/class/corlib/System.Diagnostics.Tracing/EventAttribute.cs
mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection/MethodInfo.cs [deleted file]
mcs/class/corlib/System.Reflection/MonoMethod.cs
mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs
mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs [new file with mode: 0644]
mcs/class/corlib/Test/System.IO/FileStreamTest.cs
mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs
mcs/class/corlib/Test/System/StringTest.cs
mcs/class/corlib/corlib-net_4_x.csproj
mcs/class/corlib/corlib.dll.sources
mcs/mcs/assembly.cs
mcs/mcs/attribute.cs
mcs/mcs/delegate.cs
mcs/mcs/typemanager.cs
mcs/tests/gtest-etree-07.cs
mcs/tests/gtest-etree-31.cs [new file with mode: 0644]
mcs/tests/test-892.cs
mcs/tests/ver-il-net_4_x.xml
mcs/tools/misc/.gitattributes [deleted file]
mcs/tools/misc/EnumCheck.cs [deleted file]
mcs/tools/misc/EnumCheckAssemblyCollection.cs [deleted file]
mcs/tools/misc/GenerateDelegate.cs [deleted file]
mcs/tools/misc/IFaceDisco.cs [deleted file]
mcs/tools/misc/XMLUtil.cs [deleted file]
mcs/tools/misc/monostyle.cs [deleted file]
mcs/tools/misc/sample_cast_const.cs [deleted file]
mcs/tools/misc/serialize.cs [deleted file]
mcs/tools/misc/verifier.cs [deleted file]
mcs/tools/xbuild/data/12.0/Microsoft.Common.tasks
mcs/tools/xbuild/data/14.0/Microsoft.Common.tasks
mcs/tools/xbuild/data/4.0/Microsoft.Common.tasks
mono/io-layer/io.c
mono/io-layer/wapi-remap.h
mono/metadata/appdomain.c
mono/metadata/assembly.c
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/monitor.c
mono/metadata/monitor.h
mono/metadata/reflection-internals.h
mono/metadata/reflection.c
mono/metadata/reflection.h
mono/metadata/sgen-mono.c
mono/metadata/threads.c
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/cfold.c
mono/mini/method-to-ir.c
mono/mini/mini-llvm-cpp.cpp
mono/mini/mini-llvm-cpp.h
mono/mini/mini-llvm.c
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/mini.h
mono/profiler/Makefile.am
mono/profiler/perf_event.h [deleted file]
mono/profiler/proflog.c
mono/sgen/sgen-alloc.c
mono/sgen/sgen-conf.h
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-los.c
mono/sgen/sgen-marksweep.c
mono/sgen/sgen-memory-governor.c
mono/sgen/sgen-memory-governor.h
mono/tests/Makefile.am
mono/tests/load-exceptions.cs
mono/tests/load-missing.il
msvc/mono.def
msvc/monosgen.def
msvc/scripts/order.xml

index 61db988909bdcb399dabe675754e09113eecc5ef..a6f222dfe8727421adf50308e7f6a11638144715 100644 (file)
@@ -777,42 +777,9 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
  */
 
 /**
- * from http://home.tiscali.nl/t876506/utf8tbl.html
+ * An explanation of the conversion can be found at:
+ * http://home.tiscali.nl/t876506/utf8tbl.html
  *
- * From Unicode UCS-4 to UTF-8:
- * Start with the Unicode number expressed as a decimal number and call this ud.
- *
- * If ud <128 (7F hex) then UTF-8 is 1 byte long, the value of ud.
- *
- * If ud >=128 and <=2047 (7FF hex) then UTF-8 is 2 bytes long.
- *    byte 1 = 192 + (ud div 64)
- *    byte 2 = 128 + (ud mod 64)
- *
- * If ud >=2048 and <=65535 (FFFF hex) then UTF-8 is 3 bytes long.
- *    byte 1 = 224 + (ud div 4096)
- *    byte 2 = 128 + ((ud div 64) mod 64)
- *    byte 3 = 128 + (ud mod 64)
- *
- * If ud >=65536 and <=2097151 (1FFFFF hex) then UTF-8 is 4 bytes long.
- *    byte 1 = 240 + (ud div 262144)
- *    byte 2 = 128 + ((ud div 4096) mod 64)
- *    byte 3 = 128 + ((ud div 64) mod 64)
- *    byte 4 = 128 + (ud mod 64)
- *
- * If ud >=2097152 and <=67108863 (3FFFFFF hex) then UTF-8 is 5 bytes long.
- *    byte 1 = 248 + (ud div 16777216)
- *    byte 2 = 128 + ((ud div 262144) mod 64)
- *    byte 3 = 128 + ((ud div 4096) mod 64)
- *    byte 4 = 128 + ((ud div 64) mod 64)
- *    byte 5 = 128 + (ud mod 64)
- *
- * If ud >=67108864 and <=2147483647 (7FFFFFFF hex) then UTF-8 is 6 bytes long.
- *    byte 1 = 252 + (ud div 1073741824)
- *    byte 2 = 128 + ((ud div 16777216) mod 64)
- *    byte 3 = 128 + ((ud div 262144) mod 64)
- *    byte 4 = 128 + ((ud div 4096) mod 64)
- *    byte 5 = 128 + ((ud div 64) mod 64)
- *    byte 6 = 128 + (ud mod 64)
  **/
 gint
 g_unichar_to_utf8 (gunichar c, gchar *outbuf)
index 78dccece97d38f6e771ce039001c84fa8435349a..7d42294ca69063974d15e729ed73854734ef95c6 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 78dccece97d38f6e771ce039001c84fa8435349a
+Subproject commit 7d42294ca69063974d15e729ed73854734ef95c6
index 5954ba2e316bc5e872bf4b92d3b0bdbd337a542a..65f11f600f9a8ff790f0e59ed834655300ba1179 100644 (file)
@@ -141,7 +141,7 @@ csproj-local: csproj-library csproj-test
 intermediate_clean=$(subst /,-,$(intermediate))
 csproj-library: 
        config_file=`basename $(LIBRARY) .dll`-$(intermediate_clean)$(PROFILE).input; \
-       [[ $(thisdir) == *"Facades"* ]] && config_file=Facades_$$config_file; \
+       case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; esac; \
        echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
        (echo $(is_boot); \
        echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
index 45d99c94ea770b1db72a8e254cb6c40064d10e59..ca09028ce161abaa3b0debf09376b3f85c6a1437 100644 (file)
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventKeywords))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventLevel))]
 //[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventListener))]
-//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventOpcode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventOpcode))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSource))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceAttribute))]
 //[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceException))]
-//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventTask))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventTask))]
 //[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventWrittenEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.NonEventAttribute))]
index 770680cbb8cab51b7ffb47504fa2ef4beeaafa6b..557d024da21f8495e0dfdc804c3f030f641c13af 100644 (file)
@@ -82,6 +82,11 @@ namespace Mono.Security.Interface
                        NoReflectionHelper.SetDefaultProvider (name);
                }
 
+               public static MonoTlsProvider GetProvider (string name)
+               {
+                       return (MonoTlsProvider)NoReflectionHelper.GetProvider (name);
+               }
+
                /*
                 * Create @HttpWebRequest with the specified @provider (may be null to use the default one).
                 * 
index 5b5e74e48c10250bfef984801a0913b9081c3216..eb60c6bd086185c56c1317a29f70c1f278eeeac6 100644 (file)
@@ -46,12 +46,7 @@ using Mono.Security.Cryptography;
 namespace Mono.Security.Protocol.Ntlm {
 
        [Obsolete (Type3Message.LegacyAPIWarning)]
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       class ChallengeResponse : IDisposable {
+       public class ChallengeResponse : IDisposable {
 
                static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
 
index 747ab89c15b9a0c548ac98cebd1c54e76f607afc..abaef0e259bc57a95ab8913e903f99d8be14fae1 100644 (file)
@@ -49,12 +49,7 @@ using Mono.Security.Cryptography;
 
 namespace Mono.Security.Protocol.Ntlm {
 
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       static class ChallengeResponse2 {
+       public static class ChallengeResponse2 {
 
                static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
 
index 0e6e571bb4e2fd768d514053c7be0c5bc05b8518..d62ed40c973d02f51a13821b1c417c4e31699bce 100644 (file)
@@ -39,12 +39,7 @@ using System.Globalization;
 
 namespace Mono.Security.Protocol.Ntlm {
 
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       abstract class MessageBase {
+       public abstract class MessageBase {
 
                static private byte[] header = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00 };
                
index 2dc12129b5d9a1c7d8321b209f0cc143a9f25768..e66d5901b5b9dda3ed2d0768652a90f172159b84 100644 (file)
@@ -36,12 +36,7 @@ namespace Mono.Security.Protocol.Ntlm {
         * is LM_and_NTLM_and_try_NTLMv2_Session.
         */
        
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       enum NtlmAuthLevel {
+       public enum NtlmAuthLevel {
                /* Use LM and NTLM, never use NTLMv2 session security. */
                LM_and_NTLM,
                
index f835bd8b1456e1ad35fbc6ad14a8bbdc3369fdfd..5b5db641a4a18e5908fa11699fa55d95ef0ecb14 100644 (file)
@@ -40,12 +40,7 @@ using System;
 namespace Mono.Security.Protocol.Ntlm {
 
        [Flags]
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       enum NtlmFlags : int {
+       public enum NtlmFlags : int {
                // The client sets this flag to indicate that it supports Unicode strings.
                NegotiateUnicode = 0x00000001,
                // This is set to indicate that the client supports OEM strings.
index 7cd5c7f83275fa83a440d4bcd573919bb5b475de..02778af48e15664f0b24462074acf5ee1df4fa9e 100644 (file)
@@ -38,48 +38,13 @@ namespace Mono.Security.Protocol.Ntlm {
         * is LM_and_NTLM_and_try_NTLMv2_Session.
         */
 
-       #if INSIDE_SYSTEM
-       internal
-       #else
-       public
-       #endif
-       static class NtlmSettings {
+       public static class NtlmSettings {
 
                static NtlmAuthLevel defaultAuthLevel = NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session;
 
-               static FieldInfo GetDefaultAuthLevelField ()
-               {
-                       #if INSIDE_SYSTEM
-                       return null;
-                       #else
-                       var type = typeof (HttpWebRequest).Assembly.GetType ("Mono.Security.Protocol.Ntlm.NtlmSettings", false);
-                       if (type == null)
-                               return null;
-                       return type.GetField ("defaultAuthLevel", BindingFlags.Static | BindingFlags.NonPublic);
-                       #endif
-               }
-
-               #if INSIDE_SYSTEM
-               internal
-               #else
-               public
-               #endif
-               static NtlmAuthLevel DefaultAuthLevel {
-                       get {
-                               var field = GetDefaultAuthLevelField ();
-                               if (field != null)
-                                       return (NtlmAuthLevel)field.GetValue (null);
-                               else
-                                       return defaultAuthLevel;
-                       }
-
-                       set {
-                               var field = GetDefaultAuthLevelField ();
-                               if (field != null)
-                                       field.SetValue (null, value);
-                               else
-                                       defaultAuthLevel = value;
-                       }
+               public static NtlmAuthLevel DefaultAuthLevel {
+                       get { return defaultAuthLevel; }
+                       set { defaultAuthLevel = value; }
                }
        }
 }
index b9ef85593601087d76b40ef943222e6fa69ac186..531fce0262275983510daa57a940382110393d26 100644 (file)
@@ -39,12 +39,7 @@ using System.Text;
 
 namespace Mono.Security.Protocol.Ntlm {
 
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       class Type1Message : MessageBase {
+       public class Type1Message : MessageBase {
 
                private string _host;
                private string _domain;
index e6a89936a908e919155df942f5739b9debd354a4..a2f65e3e584b06fb618ae541beb01d8f4769db5e 100644 (file)
@@ -39,12 +39,7 @@ using System.Security.Cryptography;
 
 namespace Mono.Security.Protocol.Ntlm {
 
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       class Type2Message : MessageBase {
+       public class Type2Message : MessageBase {
 
                private byte[] _nonce;
                private string _targetName;
index 7472e719400329eba68ad4a29c2d59c870c13a06..ddb44b2dfde08ff754f5125a6375c94b2fe2d6fd 100644 (file)
@@ -39,12 +39,7 @@ using System.Text;
 
 namespace Mono.Security.Protocol.Ntlm {
 
-#if INSIDE_SYSTEM
-       internal
-#else
-       public
-#endif
-       class Type3Message : MessageBase {
+       public class Type3Message : MessageBase {
 
                private NtlmAuthLevel _level;
                private byte[] _challenge;
index 05cc4faad16b660c7fd75e70f302800576974fcb..2e938683b3a0fd5099e48d2aaa1f6eb79cf8dc3c 100644 (file)
 ./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs
 ./Mono.Security.Cryptography/TlsHMAC.cs
 ./Mono.Security.Cryptography/MD5SHA1.cs
-./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
-./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
-./Mono.Security.Protocol.Ntlm/MessageBase.cs
-./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
-./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
-./Mono.Security.Protocol.Ntlm/NtlmSettings.cs
-./Mono.Security.Protocol.Ntlm/Type1Message.cs
-./Mono.Security.Protocol.Ntlm/Type2Message.cs
-./Mono.Security.Protocol.Ntlm/Type3Message.cs
 ./Mono.Security.Protocol.Tls/Alert.cs
 ./Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
 ./Mono.Security.Protocol.Tls/CipherSuite.cs
index 760371766904e216889732ba05dc9a24cc7746b3..fb48cc9664f27b743154806f992f342e7e9a8f35 100644 (file)
@@ -133,8 +133,12 @@ namespace System.Configuration {
                                rootGroup.StreamName = streamName;
                        }
                        
-                       if (streamName != null)
-                               Load ();
+                       try {
+                               if (streamName != null)
+                                       Load ();
+                       } catch (XmlException ex) {
+                               throw new ConfigurationErrorsException (ex.Message, ex, streamName, 0);
+                       }
                }
                
                internal Configuration Parent {
index d2e1a240f6d5c59621fa35c79d182eac32151c33..7efff1dddffcf879f53a0a534b24cded54d0a213 100644 (file)
@@ -627,5 +627,23 @@ namespace MonoTests.System.Configuration {
                        Assert.AreEqual ("Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;",
                                         connString);
                }
+
+               [Test]
+               public void BadConfig ()
+               {
+                       string xml = @" badXml";
+
+                       var file = Path.Combine (tempFolder, "badConfig.config");
+                       File.WriteAllText (file, xml);
+
+                       try {
+                               var fileMap = new ConfigurationFileMap (file);
+                               var configuration = ConfigurationManager.OpenMappedMachineConfiguration (fileMap);
+                               Assert.Fail ("Exception ConfigurationErrorsException was expected.");
+                       } catch (ConfigurationErrorsException e) {
+                               Assert.AreEqual (file, e.Filename);
+                       }
+
+               }
        }
 }
index f789945f01b6cdcb57bf03b6bf45c348d10f3588..1ff7e4d05f904f6eb9836484047b931a83e61e64 100644 (file)
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Runtime\CompilerServices\ExecutionScope.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\Aes.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\AesManaged.cs" />\r
+    <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\CngKeyBlobFormat.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellman.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellmanPublicKey.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDsa.cs" />\r
index ef334979b349500834ed67ff23d5bf1c00dc244e..85e07de17a51eece6b9c0d137f1fba6922cbc2a8 100644 (file)
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Runtime\CompilerServices\ExecutionScope.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\Aes.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\AesManaged.cs" />\r
+    <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\CngKeyBlobFormat.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellman.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellmanPublicKey.cs" />\r
     <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDsa.cs" />\r
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngKeyBlobFormat.cs b/mcs/class/System.Core/System.Security.Cryptography/CngKeyBlobFormat.cs
deleted file mode 100644 (file)
index e8f184c..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-//
-// System.Security.Cryptography.CngKeyBlobFormat
-//
-// Authors:
-//      Sebastien Pouliot  <sebastien@ximian.com>
-//
-// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Serializable]
-       public sealed class CngKeyBlobFormat : IEquatable<CngKeyBlobFormat> {
-
-               private string m_format;
-
-               public CngKeyBlobFormat (string format)
-               {
-                       if (format == null)
-                               throw new ArgumentNullException ("format");
-                       if (format.Length == 0)
-                               throw new ArgumentException ("format");
-
-                       m_format = format;
-               }
-
-               public string Format {
-                       get { return m_format; }
-               }
-
-               public bool Equals (CngKeyBlobFormat other)
-               {
-                       if (other == null)
-                               return false;
-                       return m_format == other.m_format;
-               }
-
-               public override bool Equals (object obj)
-               {
-                       return Equals (obj as CngKeyBlobFormat);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return m_format.GetHashCode ();
-               }
-
-               public override string ToString ()
-               {
-                       return m_format;
-               }
-
-               // static
-
-               private static CngKeyBlobFormat opaqueTransportBlob;
-               private static CngKeyBlobFormat genericPrivateBlob;
-               private static CngKeyBlobFormat genericPublicBlob;
-               private static CngKeyBlobFormat eccPrivateBlob;
-               private static CngKeyBlobFormat eccPublicBlob;
-               private static CngKeyBlobFormat pkcs8PrivateBlob;
-
-               public static CngKeyBlobFormat OpaqueTransportBlob {
-                       get {
-                               if (opaqueTransportBlob == null)
-                                       opaqueTransportBlob = new CngKeyBlobFormat ("OpaqueTransport");
-                               return opaqueTransportBlob;
-                       }
-               }
-
-               public static CngKeyBlobFormat GenericPrivateBlob {
-                       get {
-                               if (genericPrivateBlob == null)
-                                       genericPrivateBlob = new CngKeyBlobFormat ("PRIVATEBLOB");
-                               return genericPrivateBlob;
-                       }
-               }
-
-               public static CngKeyBlobFormat GenericPublicBlob {
-                       get {
-                               if (genericPublicBlob == null)
-                                       genericPublicBlob = new CngKeyBlobFormat ("PUBLICBLOB");
-                               return genericPublicBlob;
-                       }
-               }
-
-               public static CngKeyBlobFormat EccPrivateBlob {
-                       get {
-                               if (eccPrivateBlob == null)
-                                       eccPrivateBlob = new CngKeyBlobFormat ("ECCPRIVATEBLOB");
-                               return eccPrivateBlob;
-                       }
-               }
-
-               public static CngKeyBlobFormat EccPublicBlob {
-                       get {
-                               if (eccPublicBlob == null)
-                                       eccPublicBlob = new CngKeyBlobFormat ("ECCPUBLICBLOB");
-                               return eccPublicBlob;
-                       }
-               }
-
-               public static CngKeyBlobFormat Pkcs8PrivateBlob {
-                       get {
-                               if (pkcs8PrivateBlob == null)
-                                       pkcs8PrivateBlob = new CngKeyBlobFormat ("PKCS8_PRIVATEKEY");
-                               return pkcs8PrivateBlob;
-                       }
-               }
-
-               public static bool operator == (CngKeyBlobFormat left, CngKeyBlobFormat right)
-               {
-                       if ((object)left == null)
-                               return ((object)right == null);
-                       return left.Equals (right);
-               }
-
-               public static bool operator != (CngKeyBlobFormat left, CngKeyBlobFormat right)
-               {
-                       if ((object)left == null)
-                               return ((object)right != null);
-                       return !left.Equals (right);
-               }
-       }
-}
index 455930f26f82bc136fbfc566879b9fa8f2e7bbc8..634c075073a7cc6b89b6f5131f2302463265ae8b 100644 (file)
@@ -184,6 +184,7 @@ ReferenceSources/Strings.cs
 ../../../external/referencesource/System.Core/System/Runtime/CompilerServices/ExecutionScope.cs
 
 ../../../external/referencesource/System.Core/System/Security/Cryptography/Aes.cs
+../../../external/referencesource/System.Core/System/Security/Cryptography/CngKeyBlobFormat.cs
 ../../../external/referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
 ../../../external/referencesource/System.Core/System/Security/Cryptography/ECDsa.cs
 
index 9c1df61310afc8a0a3fa858179fe59bc55847ea4..0f881358df53ba2a369eead866e706fe59de4c3b 100644 (file)
@@ -38,6 +38,7 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.Text;
 using System.Xml;
+using System.Xml.Schema;
 using System.Xml.Serialization;
 
 namespace System.ServiceModel.Dispatcher
@@ -135,6 +136,11 @@ namespace System.ServiceModel.Dispatcher
 
                        protected override void OnWriteBodyContents (XmlDictionaryWriter writer)
                        {
+                               if (writer.WriteState == WriteState.Element) {
+                                       writer.WriteXmlnsAttribute ("xsi", XmlSchema.InstanceNamespace);
+                                       writer.WriteXmlnsAttribute ("xsd", XmlSchema.Namespace);
+                               }
+
                                serializer.Serialize (writer, body);
                        }
                }
index 0a169ec364f9b637ccdf2093253623a73fb954ba..5282f954c050fb9d9a654eac6620d0e1af6937c1 100644 (file)
@@ -480,15 +480,16 @@ namespace MonoTests.System.ServiceModel
                [Test]
                public void OneWayOperationWithRequestReplyChannel ()
                {
+                       var port = NetworkHelpers.FindFreePort ();
                        var host = new ServiceHost (typeof (OneWayService));
                        host.AddServiceEndpoint (typeof (IOneWayService),
                                new BasicHttpBinding (),
-                               new Uri ("http://localhost:30158"));
+                               new Uri ("http://localhost:" + port));
                        host.Open ();
                        try {
                                var cf = new ChannelFactory<IOneWayService> (
                                        new BasicHttpBinding (),
-                                       new EndpointAddress ("http://localhost:30158"));
+                                       new EndpointAddress ("http://localhost:" + port));
                                var ch = cf.CreateChannel ();
                                ch.GiveMessage ("test");
                                
index 3c12a4646869c95eb2857abe4afd116274b18837..4d15e9138a59a25c6b006e2a50b2bfec7c52d661 100644 (file)
 using System;
 using System.Collections.ObjectModel;
 using System.IO;
+using System.Net;
 using System.Net.Sockets;
 using System.Reflection;
 using System.ServiceModel;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
+using System.Text;
+using System.Threading.Tasks;
 using System.Xml;
+using System.Xml.Serialization;
 using NUnit.Framework;
 
 using MonoTests.Helpers;
@@ -503,5 +507,82 @@ namespace MonoTests.System.ServiceModel
                        {
                        }
                }
+
+               [SerializableAttribute ()]
+               [XmlTypeAttribute (Namespace = "http://mono.com/")]
+               public class ValueWithXmlAttributes
+               {
+                       [XmlElementAttribute (ElementName = "Name")]
+                       public string FakeName;
+               }
+
+               [ServiceContractAttribute (Namespace = "http://mono.com/")]
+               public interface IXmlSerializerFormatService
+               {
+                       [OperationContractAttribute (Action = "http://mono.com/Send", ReplyAction = "*")]
+                       [XmlSerializerFormatAttribute ()]
+                       void SendValueWithXmlAttributes (ValueWithXmlAttributes v);
+               }
+
+               class XmlSerializerFormatClient : ClientBase<IXmlSerializerFormatService>
+               {
+                       public XmlSerializerFormatClient (Binding binding, EndpointAddress address)
+                               : base (binding, address)
+                       {
+                       }
+
+                       public void SendValue ()
+                       {
+                               var v = new ValueWithXmlAttributes () { FakeName = "name" };
+                               base.Channel.SendValueWithXmlAttributes (v);
+                       }
+               }
+
+               [Test]
+               public void TestXmlAttributes ()
+               {
+                       int port = NetworkHelpers.FindFreePort();
+                       var endpoint = new EndpointAddress ("http://localhost:" + port);
+                       var binding = new BasicHttpBinding ();
+                       var client = new XmlSerializerFormatClient (binding, endpoint);
+
+                       var server = new TcpListener (IPAddress.Any, port);
+                       server.Start ();
+
+                       var acceptTask = server.AcceptTcpClientAsync ();
+
+                       var t1 = new Task( () => client.SendValue ());
+                       t1.Start();
+
+                       if (!acceptTask.Wait (2000))
+                               Assert.Fail ("No request from client.");
+
+                       var netStream = acceptTask.Result.GetStream ();
+
+                       byte[] buffer = new byte [1024];
+                       int numBytesRead = 0;
+                       var message = new StringBuilder ();
+                       
+                       do {
+                               numBytesRead = netStream.Read (buffer, 0, buffer.Length);
+                               var str =  Encoding.UTF8.GetString (buffer, 0, numBytesRead);
+                               message.AppendFormat ("{0}", str);
+                               if (str.EndsWith ("</s:Envelope>", StringComparison.InvariantCulture))
+                                       break;
+                       } while (numBytesRead > 0);
+
+                       var messageStr = message.ToString ();
+                       var envelopeIndex = messageStr.IndexOf ("<s:Envelope");
+                       if (envelopeIndex < 0)
+                               Assert.Fail ("Soap envelope was not received.");
+                       
+                       var envelope = messageStr.Substring (envelopeIndex);
+
+                       var expected = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SendValueWithXmlAttributes xmlns=\"http://mono.com/\"><v><Name>name</Name></v></SendValueWithXmlAttributes></s:Body></s:Envelope>";
+
+                       Assert.AreEqual (expected, envelope);
+
+                       server.Stop ();
+               }
        }
 }
index cbfeea4c763b0a2a53cc7c469e078dacfee96248..934823502df1e8fae4b63101bf60c1529184549f 100644 (file)
@@ -35,6 +35,7 @@ namespace System.Windows.Forms {
                public object [] Args;
                public AsyncMethodResult Result;
                public ExecutionContext Context;
+               public SynchronizationContext SyncContext;
        }
 
 }
index ff2427e069041443921e17fff29bb2903512acac..eb0fecfdb87090e0a300617186eb39ca2be8f84f 100644 (file)
@@ -468,11 +468,10 @@ namespace System.Windows.Forms {
 #endregion     // XplatUI Driver Methods
        }
 
-       internal class XplatUIDriverSupport {
+       static class XplatUIDriverSupport {
                #region XplatUI Driver Support Methods
-               internal static void ExecutionCallback (object state)
+               internal static void ExecutionCallback (AsyncMethodData data)
                {
-                       AsyncMethodData data = (AsyncMethodData) state;
                        AsyncMethodResult result = data.Result;
                        
                        object ret;
@@ -492,6 +491,25 @@ namespace System.Windows.Forms {
                        }
                }
 
+               static void ExecutionCallbackInContext (object state)
+               {
+                       AsyncMethodData data = (AsyncMethodData) state;
+
+                       if (data.SyncContext == null) {
+                               ExecutionCallback (data);
+                               return;
+                       }
+
+                       var oldContext = SynchronizationContext.Current;
+                       SynchronizationContext.SetSynchronizationContext (data.SyncContext);
+
+                       try {
+                               ExecutionCallback (data);
+                       } finally {
+                               SynchronizationContext.SetSynchronizationContext (oldContext);
+                       }
+               }
+
                internal static void ExecuteClientMessage (GCHandle gchandle)
                {
                        AsyncMethodData data = (AsyncMethodData) gchandle.Target;
@@ -499,7 +517,8 @@ namespace System.Windows.Forms {
                                if (data.Context == null) {
                                        ExecutionCallback (data);
                                } else {
-                                       ExecutionContext.Run (data.Context, new ContextCallback (ExecutionCallback), data);
+                                       data.SyncContext = SynchronizationContext.Current;
+                                       ExecutionContext.Run (data.Context, new ContextCallback (ExecutionCallbackInContext), data);
                                }
                        }
                        finally {
index e541b1fdb97e8ac428e21922b014da5a404fed6f..2bb60f5ff2b90c93864181a7ee99aef966c6a5cb 100644 (file)
@@ -44,7 +44,7 @@ namespace System.Windows.Forms {
                #region Local Variables
                private static XplatUIWin32     instance;
                private static int              ref_count;
-               private static IntPtr           FosterParent;
+               private static IntPtr           FosterParentLast;
 
                internal static MouseButtons    mouse_state;
                internal static Point           mouse_position;
@@ -847,11 +847,7 @@ namespace System.Windows.Forms {
 
                        wnd_proc = new WndProc(InternalWndProc);
 
-                       FosterParent=Win32CreateWindow(WindowExStyles.WS_EX_TOOLWINDOW, "static", "Foster Parent Window", WindowStyles.WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
-
-                       if (FosterParent==IntPtr.Zero) {
-                               Win32MessageBox(IntPtr.Zero, "Could not create foster window, win32 error " + Win32GetLastError().ToString(), "Oops", 0);
-                       }
+                       FosterParentLast = IntPtr.Zero;
 
                        scroll_height = Win32GetSystemMetrics(SystemMetrics.SM_CYHSCROLL);
                        scroll_width = Win32GetSystemMetrics(SystemMetrics.SM_CXVSCROLL);
@@ -863,6 +859,19 @@ namespace System.Windows.Forms {
 
                #region Private Support Methods
 
+               private IntPtr GetFosterParent()
+               {
+                       if (!IsWindow(FosterParentLast))
+                       {
+                               FosterParentLast=Win32CreateWindow(WindowExStyles.WS_EX_TOOLWINDOW, "static", "Foster Parent Window", WindowStyles.WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
+
+                               if (FosterParentLast==IntPtr.Zero) {
+                                       Win32MessageBox(IntPtr.Zero, "Could not create foster window, win32 error " + Win32GetLastError().ToString(), "Oops", 0);
+                               }
+                       }
+                       return FosterParentLast;
+               }
+
                private string RegisterWindowClass (int classStyle)
                {
                        string class_name;
@@ -1616,13 +1625,13 @@ namespace System.Windows.Forms {
 
                        if ((ParentHandle==IntPtr.Zero) && (cp.Style & (int)(WindowStyles.WS_CHILD))!=0) {
                                // We need to use our foster parent window until this poor child gets it's parent assigned
-                               ParentHandle = FosterParent;
+                               ParentHandle = GetFosterParent();
                        }
 
                        if ( ((cp.Style & (int)(WindowStyles.WS_CHILD | WindowStyles.WS_POPUP))==0) && ((cp.ExStyle & (int)WindowExStyles.WS_EX_APPWINDOW) == 0)) {
                                // If we want to be hidden from the taskbar we need to be 'owned' by 
                                // something not on the taskbar. FosterParent is just that
-                               ParentHandle = FosterParent;
+                               ParentHandle = GetFosterParent();
                        }
 
                        Point location;
@@ -2265,7 +2274,7 @@ namespace System.Windows.Forms {
                        
                        if (parent == IntPtr.Zero) {
                                new_style = style & ~WindowStyles.WS_CHILD;
-                               result = Win32SetParent (handle, FosterParent);
+                               result = Win32SetParent (handle, GetFosterParent());
                        } else {
                                new_style = style | WindowStyles.WS_CHILD;
                                result = Win32SetParent (handle, parent);
@@ -2562,11 +2571,12 @@ namespace System.Windows.Forms {
 
                internal override void SendAsyncMethod (AsyncMethodData method)
                {
-                       Win32PostMessage(FosterParent, Msg.WM_ASYNC_MESSAGE, IntPtr.Zero, (IntPtr)GCHandle.Alloc (method));
+                       Win32PostMessage(GetFosterParent(), Msg.WM_ASYNC_MESSAGE, IntPtr.Zero, (IntPtr)GCHandle.Alloc (method));
                }
 
                internal override void SetTimer (Timer timer)
                {
+                       IntPtr  FosterParent=GetFosterParent();
                        int     index;
 
                        index = timer.GetHashCode();
@@ -2824,7 +2834,7 @@ namespace System.Windows.Forms {
 
                internal override IntPtr ClipboardOpen(bool primary_selection) {
                        // Win32 does not have primary selection
-                       Win32OpenClipboard(FosterParent);
+                       Win32OpenClipboard(GetFosterParent());
                        return clip_magic;
                }
 
@@ -3220,7 +3230,7 @@ namespace System.Windows.Forms {
                        string          magic_string = "The quick brown fox jumped over the lazy dog.";
                        double          magic_number = 44.549996948242189;
 
-                       g = Graphics.FromHwnd(FosterParent);
+                       g = Graphics.FromHwnd(GetFosterParent());
 
                        width = (float) (g.MeasureString (magic_string, font).Width / magic_number);
                        return new SizeF(width, font.Height);
@@ -3595,6 +3605,9 @@ namespace System.Windows.Forms {
                [DllImport ("user32.dll", EntryPoint="IsWindowVisible", CallingConvention=CallingConvention.StdCall)]
                private extern static bool IsWindowVisible(IntPtr hwnd);
 
+               [DllImport ("user32.dll", EntryPoint="IsWindow", CallingConvention=CallingConvention.StdCall)]
+               private extern static bool IsWindow(IntPtr hwnd);
+
                //[DllImport ("user32.dll", EntryPoint="SetClassLong", CallingConvention=CallingConvention.StdCall)]
                //private extern static bool Win32SetClassLong(IntPtr hwnd, ClassLong nIndex, IntPtr dwNewLong);
 
index e9a833018a6d5e4e82a0718a12ab7cd4e9cc9bf4..f336b1537be36e1a8975e7fe1d530d1e8fe23f6f 100644 (file)
@@ -78,6 +78,7 @@ System.Windows.Forms/FocusTest.cs
 System.Windows.Forms/FolderBrowserDialogTest.cs
 System.Windows.Forms/FormEventTest.cs
 System.Windows.Forms/FormHandleTest.cs
+System.Windows.Forms/FormThreadTest.cs
 System.Windows.Forms/FormTest.cs
 System.Windows.Forms/EventArgsTest.cs
 System.Windows.Forms/EventLogger.cs
diff --git a/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/FormThreadTest.cs b/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/FormThreadTest.cs
new file mode 100644 (file)
index 0000000..e9858bb
--- /dev/null
@@ -0,0 +1,43 @@
+using System;
+using System.Windows.Forms;
+using System.Threading;
+using Sys_Threading=System.Threading;
+
+using NUnit.Framework;
+
+using CategoryAttribute = NUnit.Framework.CategoryAttribute;
+
+namespace MonoTests.System.Windows.Forms
+{
+       [TestFixture]
+       public class FormThreadTest : TestHelper
+       {
+               private static void GuiThread()
+               {
+                       Form form1;
+
+                       form1 = new Form();
+                       form1.Show();
+                       form1.Dispose();
+               }
+
+               [Test]
+               public void TestThreadFormsInit ()
+               {
+                       Sys_Threading.Thread thread;
+
+                       thread = new Sys_Threading.Thread(new ThreadStart(GuiThread));
+                       thread.Start();
+                       thread.Join();
+
+                       try
+                       {
+                               GuiThread();
+                       }
+                       catch (Exception e)
+                       {
+                               Assert.Fail ("#1");
+                       }
+               }
+       }
+}
index f2cf321677deab8b6c4a5810deb8587c56934f29..1a0c2bc584290d3356358948d9beb48938e93cb9 100644 (file)
@@ -230,6 +230,11 @@ namespace Mono.Net.Security
                        return provider.Provider;
                }
 
+               internal static MSI.MonoTlsProvider GetProvider (string name)
+               {
+                       return LookupProvider (name, false);
+               }
+
                internal static bool HasProvider {
                        get {
                                lock (locker) {
index a11fcec2c194ed559e80f3ead0f3fb7a4dc82931..6de1cd2599345f6e857e342f6cb88f008ce8bdf8 100644 (file)
@@ -120,5 +120,13 @@ namespace Mono.Net.Security
                        #endif
                }
 
+               internal static object GetProvider (string name)
+               {
+                       #if SECURITY_DEP
+                       return MonoTlsProviderFactory.GetProvider (name);
+                       #else
+                       throw new NotSupportedException ();
+                       #endif
+               }
        }
 }
index 4b69010b975f59370e4afc85cabae0f96640dcfd..31d56ce09eb38acf77a1e3a2a9ab1466b66b1266 100644 (file)
@@ -578,6 +578,34 @@ namespace System.Configuration
                private ExeConfigurationFileMap exeMapPrev = null;
                private SettingsPropertyValueCollection values = null;
 
+               /// <remarks>
+               /// Hack to remove the XmlDeclaration that the XmlSerializer adds.
+               /// <br />
+               /// see <a href="https://github.com/mono/mono/pull/2273">Issue 2273</a> for details
+               /// </remarks>
+               private string StripXmlHeader (string serializedValue)
+               {
+                       if (serializedValue == null)
+                       {
+                               return string.Empty;
+                       }
+
+                       XmlDocument doc = new XmlDocument ();
+                       XmlElement valueXml = doc.CreateElement ("value");
+                       valueXml.InnerXml = serializedValue;
+
+                       foreach (XmlNode child in valueXml.ChildNodes) {
+                               if (child.NodeType == XmlNodeType.XmlDeclaration) {
+                                       valueXml.RemoveChild (child);
+                                       break;
+                               }
+                       }
+
+                       // InnerXml will give you well-formed XML that you could save as a separate document, and 
+                       // InnerText will immediately give you a pure-text representation of this inner XML.
+                       return valueXml.InnerXml;
+               }
+
                private void SaveProperties (ExeConfigurationFileMap exeMap, SettingsPropertyValueCollection collection, ConfigurationUserLevel level, SettingsContext context, bool checkUserLevel)
                {
                        Configuration config = ConfigurationManager.OpenMappedExeConfiguration (exeMap, level);
@@ -585,8 +613,6 @@ namespace System.Configuration
                        UserSettingsGroup userGroup = config.GetSectionGroup ("userSettings") as UserSettingsGroup;
                        bool isRoaming = (level == ConfigurationUserLevel.PerUserRoaming);
 
-#if true // my reimplementation
-
                        if (userGroup == null) {
                                userGroup = new UserSettingsGroup ();
                                config.SectionGroups.Add ("userSettings", userGroup);
@@ -623,7 +649,7 @@ namespace System.Configuration
                                        element.Value.ValueXml = new XmlDocument ().CreateElement ("value");
                                switch (value.Property.SerializeAs) {
                                case SettingsSerializeAs.Xml:
-                                       element.Value.ValueXml.InnerXml = (value.SerializedValue as string) ?? string.Empty;
+                                       element.Value.ValueXml.InnerXml = StripXmlHeader (value.SerializedValue as string);
                                        break;
                                case SettingsSerializeAs.String:
                                        element.Value.ValueXml.InnerText = value.SerializedValue as string;
@@ -637,43 +663,6 @@ namespace System.Configuration
                        }
                        if (hasChanges)
                                config.Save (ConfigurationSaveMode.Minimal, true);
-
-#else // original impl. - likely buggy to miss some properties to save
-
-                       foreach (ConfigurationSection configSection in userGroup.Sections)
-                       {
-                               ClientSettingsSection userSection = configSection as ClientSettingsSection;
-                               if (userSection != null)
-                               {
-/*
-                                       userSection.Settings.Clear();
-
-                                       foreach (SettingsPropertyValue propertyValue in collection)
-                                       {
-                                               if (propertyValue.IsDirty)
-                                               {
-                                                       SettingElement element = new SettingElement(propertyValue.Name, SettingsSerializeAs.String);
-                                                       element.Value.ValueXml = new XmlDocument();
-                                                       element.Value.ValueXml.InnerXml = (string)propertyValue.SerializedValue;
-                                                       userSection.Settings.Add(element);
-                                               }
-                                       }
-*/
-                                       foreach (SettingElement element in userSection.Settings)
-                                       {
-                                               if (collection [element.Name] != null) {
-                                                       if (collection [element.Name].Property.Attributes.Contains (typeof (SettingsManageabilityAttribute)) != isRoaming)
-                                                               continue;
-
-                                                       element.SerializeAs = SettingsSerializeAs.String;
-                                                       element.Value.ValueXml.InnerXml = (string) collection [element.Name].SerializedValue;   ///Value = XmlElement
-                                               }
-                                       }
-                               }
-                       }
-                       config.Save (ConfigurationSaveMode.Minimal, true);
-#endif
                }
 
                // NOTE: We should add here all the chars that are valid in a name of a class (Ecma-wise),
index cedb3651c8884c525d4738a05a6624655167218d..ad9e3526ff740c4e1a682f38592ab6529ddcf54d 100644 (file)
@@ -33,6 +33,10 @@ using System;
 using System.IO;
 using System.Net;
 using System.Security.Principal;
+using System.Security.Permissions;
+using System.Security.Authentication.ExtendedProtection;
+using System.Threading;
+using System.Threading.Tasks;
 
 namespace System.Net.Security 
 {
@@ -272,6 +276,60 @@ namespace System.Net.Security
                        throw new NotImplementedException ();
                }
 
+               public virtual Task AuthenticateAsClientAsync()
+               {
+                       return Task.Factory.FromAsync(BeginAuthenticateAsClient, EndAuthenticateAsClient, null);
+               }
+
+               public virtual Task AuthenticateAsClientAsync(NetworkCredential credential, string targetName)
+               {
+                       return Task.Factory.FromAsync(BeginAuthenticateAsClient, EndAuthenticateAsClient, credential, targetName, null);
+               }
+
+               public virtual Task AuthenticateAsClientAsync(
+                       NetworkCredential credential, string targetName,
+                       ProtectionLevel requiredProtectionLevel,
+                       TokenImpersonationLevel allowedImpersonationLevel)
+               {
+                       return Task.Factory.FromAsync((callback, state) => BeginAuthenticateAsClient(credential, targetName, requiredProtectionLevel, allowedImpersonationLevel, callback, state), EndAuthenticateAsClient, null);
+               }
+
+               public virtual Task AuthenticateAsClientAsync(NetworkCredential credential, ChannelBinding binding, string targetName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual Task AuthenticateAsClientAsync(
+                       NetworkCredential credential, ChannelBinding binding,
+                       string targetName, ProtectionLevel requiredProtectionLevel,
+                       TokenImpersonationLevel allowedImpersonationLevel)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual Task AuthenticateAsServerAsync()
+               {
+                       return Task.Factory.FromAsync(BeginAuthenticateAsServer, EndAuthenticateAsServer, null);
+               }
+
+               public virtual Task AuthenticateAsServerAsync(ExtendedProtectionPolicy policy)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual Task AuthenticateAsServerAsync(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual Task AuthenticateAsServerAsync(
+                       NetworkCredential credential, ExtendedProtectionPolicy policy,
+                       ProtectionLevel requiredProtectionLevel,
+                       TokenImpersonationLevel requiredImpersonationLevel)
+               {
+                       throw new NotImplementedException ();
+               }
+
                #endregion // Methods
        }
 }
index 42b6c6e3d44dc65bdbf2d8838f498fdd51ed0c33..904142e3595e4737c60cddab3376e306953daa84 100644 (file)
@@ -40,7 +40,7 @@ using System.Security.Permissions;
 
 namespace System.Security.Cryptography.X509Certificates {
 
-       public sealed class X509Store {
+       public sealed class X509Store : IDisposable {
 
                private string _name;
                private StoreLocation _location;
@@ -107,6 +107,10 @@ namespace System.Security.Cryptography.X509Certificates {
                        _location = storeLocation;
                }
 
+               public void Dispose ()
+               {
+               }
+
                // properties
 
                public X509Certificate2Collection Certificates {
index 7b0b3ac8152a99b66953033ad54429352806d452..e12f53291d208b523a3b974f70e561018a4a9ea2 100644 (file)
 
 //#define SPEW
 
-
 using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Xml.Schema;
 using System.Text;
 using System.Configuration;
 using System.ComponentModel;
@@ -461,6 +464,60 @@ namespace MonoTests.System.Configuration {
                        Assert.AreEqual ("eclair", holder1.TestKey, "#4");
                        Assert.AreEqual ("", holder2.TestKey, "#5");
                }
+
+               class Settings : ApplicationSettingsBase
+               {
+                       [UserScopedSetting]
+                       public WindowPositionList WindowPositions {
+                               get {
+                                       return ((WindowPositionList)(this ["WindowPositions"]));
+                               }
+                               set {
+                                       this ["WindowPositions"] = value;
+                               }
+                       }
+               }
+
+               [Serializable]
+               public class WindowPositionList : IXmlSerializable
+               {
+                       public XmlSchema GetSchema ()
+                       {
+                               return null;
+                       }
+
+                       public void ReadXml (XmlReader reader)
+                       {
+                               reader.ReadStartElement ("sampleNode");
+                               reader.ReadEndElement ();
+                       }
+
+                       public void WriteXml (XmlWriter writer)
+                       {
+                               writer.WriteStartElement ("sampleNode");
+                               writer.WriteEndElement ();
+                       }
+               }
+
+               [Test] //Covers 36388
+               public void XmlHeader ()
+               {
+                       try {
+                               var settings = new Settings ();
+                               settings.Reset ();
+                               settings.Save ();
+
+                               settings.WindowPositions = new WindowPositionList ();
+
+                               settings.Save ();
+                               // If Reloads fails then saved data is corrupted
+                               settings.Reload ();
+                       } catch (ConfigurationErrorsException e) {
+                               // Delete corrupted config file so other test won't fail.
+                               File.Delete (e.Filename);
+                               Assert.Fail ("Invalid data was saved to config file.");
+                       }
+               }
        }
 }
 
index 2dd0d0674632ab82bd8a73d99724e3f1cc9c43b3..cea6bb18c14aabe8003407800c9af58a4d809714 100644 (file)
@@ -39,6 +39,8 @@ using System.Net.Security;
 using System.Security.Cryptography.X509Certificates;
 using System.Threading;
 
+using MonoTests.Helpers;
+
 namespace MonoTests.System.Net.Security
 {
 
@@ -64,7 +66,7 @@ public class SslStreamTest {
 
        void AuthenticateClientAndServer (bool server, bool client)
        {
-               IPEndPoint endPoint = new IPEndPoint (IPAddress.Parse ("127.0.0.1"), 10000);
+               IPEndPoint endPoint = new IPEndPoint (IPAddress.Parse ("127.0.0.1"), NetworkHelpers.FindFreePort ());
                ClientServerState state = new ClientServerState ();
                state.Client = new TcpClient ();
                state.Listener = new TcpListener (endPoint);
index a0e19d4f2d15d6d856fcf37ff33c86c1173274d5..a53a5d5624ab010ece48667b8bfe72719d856110 100755 (executable)
@@ -22,6 +22,8 @@ using System.IO;
 
 using System.Collections.Generic;
 
+using MonoTests.Helpers;
+
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
@@ -34,7 +36,7 @@ namespace MonoTests.System.Net.Sockets
                [Test]
                public void ConnectIPAddressAny ()
                {
-                       IPEndPoint ep = new IPEndPoint (IPAddress.Any, 0);
+                       IPEndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
 
                        /* UDP sockets use Any to disconnect
                        try {
@@ -64,7 +66,7 @@ namespace MonoTests.System.Net.Sockets
                public void IncompatibleAddress ()
                {
                        IPEndPoint epIPv6 = new IPEndPoint (IPAddress.IPv6Any,
-                                                               0);
+                                                               NetworkHelpers.FindFreePort ());
 
                        try {
                                using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)) {
@@ -111,9 +113,9 @@ namespace MonoTests.System.Net.Sockets
                        Socket.Select (list, list, list, 1000);
                }
                
-               private bool BlockingConnect (bool block)
+               private bool BlockingConnect (bool block, int port)
                {
-                       IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, 1234);
+                       IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, port);
                        Socket server = new Socket(AddressFamily.InterNetwork,
                                                   SocketType.Stream,
                                                   ProtocolType.Tcp);
@@ -155,11 +157,12 @@ namespace MonoTests.System.Net.Sockets
                public void AcceptBlockingStatus()
                {
                        bool block;
-
-                       block = BlockingConnect(true);
+                       var port = NetworkHelpers.FindFreePort ();
+       
+                       block = BlockingConnect(true, port);
                        Assert.AreEqual (block, true, "BlockingStatus01");
 
-                       block = BlockingConnect(false);
+                       block = BlockingConnect(false, port);
                        Assert.AreEqual (block, false, "BlockingStatus02");
                }
 
@@ -208,7 +211,7 @@ namespace MonoTests.System.Net.Sockets
                         * anything...
                         */
                        sock.BeginConnect (new IPEndPoint (IPAddress.Loopback,
-                                                          114),
+                                                          NetworkHelpers.FindFreePort ()),
                                           new AsyncCallback (CFACallback),
                                           sock);
                        CFACalledBack.WaitOne ();
@@ -219,7 +222,7 @@ namespace MonoTests.System.Net.Sockets
                [Test]
                public void SetSocketOptionBoolean ()
                {
-                       IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 1);
+                       IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        Socket sock = new Socket (ep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                        try {
                                sock.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
@@ -230,7 +233,7 @@ namespace MonoTests.System.Net.Sockets
                [Test]
                public void TestSelect1 ()
                {
-                       Socket srv = CreateServer ();
+                       Socket srv = CreateServer (NetworkHelpers.FindFreePort ());
                        ClientSocket clnt = new ClientSocket (srv.LocalEndPoint);
                        Thread th = new Thread (new ThreadStart (clnt.ConnectSleepClose));
                        Socket acc = null;
@@ -260,10 +263,10 @@ namespace MonoTests.System.Net.Sockets
                        }
                }
 
-               static Socket CreateServer ()
+               static Socket CreateServer (int port)
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-                       sock.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+                       sock.Bind (new IPEndPoint (IPAddress.Loopback, port));
                        sock.Listen (1);
                        return sock;
                }
@@ -369,7 +372,7 @@ namespace MonoTests.System.Net.Sockets
                public void Disposed19 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
-                       EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+                       EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
                        s.Close();
 
                        s.SendTo (buf, 0, ep);
@@ -380,7 +383,7 @@ namespace MonoTests.System.Net.Sockets
                public void Disposed20 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
-                       EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+                       EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
                        s.Close();
 
                        s.SendTo (buf, 10, 0, ep);
@@ -391,7 +394,7 @@ namespace MonoTests.System.Net.Sockets
                public void Disposed21 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
-                       EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+                       EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
                        s.Close();
 
                        s.SendTo (buf, 0, 10, 0, ep);
@@ -402,7 +405,7 @@ namespace MonoTests.System.Net.Sockets
                public void Disposed22 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
-                       EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+                       EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
                        s.Close();
 
                        s.SendTo (buf, ep);
@@ -424,7 +427,7 @@ namespace MonoTests.System.Net.Sockets
                        Socket server = new Socket (AddressFamily.InterNetwork,
                                SocketType.Stream, ProtocolType.Tcp);
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       9010);
+                                                       NetworkHelpers.FindFreePort ());
                        server.Bind (ep);
                        server.Listen (1);
 
@@ -682,7 +685,7 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        
-                       sock.Bind (new IPEndPoint (IPAddress.Any, 1235));
+                       sock.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
                        sock.ExclusiveAddressUse = true;
                        sock.Close ();
                }
@@ -1329,7 +1332,7 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
 
-                       sock.Bind (new IPEndPoint (IPAddress.Any, 1236));
+                       sock.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
                        
                        sock.BeginAccept (BACallback, sock);
                        
@@ -1343,7 +1346,7 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1237);
+                                                       NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep);
                        sock.Listen (1);
@@ -1410,7 +1413,7 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1238);
+                                                       NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep);
                        sock.Listen (1);
@@ -1478,7 +1481,7 @@ namespace MonoTests.System.Net.Sockets
                                                 ProtocolType.Udp);
                        
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1239);
+                                                       NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep);
                        sock.Listen (1);
@@ -1507,10 +1510,10 @@ namespace MonoTests.System.Net.Sockets
                                                 ProtocolType.Tcp);
                        
                        IPEndPoint ep1 = new IPEndPoint (IPAddress.Loopback,
-                                                        1240);
+                                                        NetworkHelpers.FindFreePort ());
                        
                        IPEndPoint ep2 = new IPEndPoint (IPAddress.Loopback,
-                                                        1241);
+                                                        NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep1);
                        sock.Listen (1);
@@ -1540,7 +1543,7 @@ namespace MonoTests.System.Net.Sockets
                                                 ProtocolType.Tcp);
                        
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1242);
+                                                       NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep);
                        sock.Listen (1);
@@ -1622,7 +1625,7 @@ namespace MonoTests.System.Net.Sockets
                                                 SocketType.Stream,
                                                 ProtocolType.Tcp);
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1243);
+                                                       NetworkHelpers.FindFreePort ());
 
                        sock.Bind (ep);
                        sock.Listen (1);
@@ -1673,7 +1676,7 @@ namespace MonoTests.System.Net.Sockets
                                                    SocketType.Stream,
                                                    ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1244);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
 
                        listen.Bind (ep);
                        listen.Listen (1);
@@ -1682,7 +1685,7 @@ namespace MonoTests.System.Net.Sockets
                        
                        BCConnected = false;
                        
-                       sock.BeginConnect (ip, 1244, BCCallback, sock);
+                       sock.BeginConnect (ip, ep.Port, BCCallback, sock);
 
                        if (BCCalledBack.WaitOne (2000, false) == false) {
                                Assert.Fail ("BeginConnectAddressPort wait timed out");
@@ -1721,13 +1724,13 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1245);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
 
                        sock.Bind (ep);
                        sock.Listen (1);
                        
                        try {
-                               sock.BeginConnect (ip, 1245, BCCallback, sock);
+                               sock.BeginConnect (ip, ep.Port, BCCallback, sock);
                                Assert.Fail ("BeginConnectAddressPortListen #1");
                        } catch (InvalidOperationException) {
                        } catch {
@@ -1772,7 +1775,7 @@ namespace MonoTests.System.Net.Sockets
                                                    SocketType.Stream,
                                                    ProtocolType.Tcp);
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1246);
+                                                       NetworkHelpers.FindFreePort ());
                        IPAddress[] ips = new IPAddress[4];
                        
                        ips[0] = IPAddress.Parse ("127.0.0.4");
@@ -1787,7 +1790,7 @@ namespace MonoTests.System.Net.Sockets
                        
                        BCConnected = false;
                        
-                       sock.BeginConnect (ips, 1246, BCCallback, sock);
+                       sock.BeginConnect (ips, ep.Port, BCCallback, sock);
                        
                        /* Longer wait here, because the ms runtime
                         * takes a lot longer to not connect
@@ -1835,7 +1838,7 @@ namespace MonoTests.System.Net.Sockets
                         * succeed it it can connect to at least one of the requested
                         * addresses.
                         */
-                       IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 1246);
+                       IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
 
                        listen.Bind (ep);
                        listen.Listen (1);
@@ -1844,7 +1847,7 @@ namespace MonoTests.System.Net.Sockets
                        
                        BCConnected = false;
                        
-                       sock.BeginConnect (allIps, 1246, BCCallback, sock);
+                       sock.BeginConnect (allIps, ep.Port, BCCallback, sock);
                        
                        /* Longer wait here, because the ms runtime
                         * takes a lot longer to not connect
@@ -1892,7 +1895,7 @@ namespace MonoTests.System.Net.Sockets
                                                  ProtocolType.Tcp);
                        IPAddress[] ips = new IPAddress[4];
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1247);
+                                                       NetworkHelpers.FindFreePort ());
                        
                        ips[0] = IPAddress.Parse ("127.0.0.4");
                        ips[1] = IPAddress.Parse ("127.0.0.3");
@@ -1903,7 +1906,7 @@ namespace MonoTests.System.Net.Sockets
                        sock.Listen (1);
                        
                        try {
-                               sock.BeginConnect (ips, 1247, BCCallback,
+                               sock.BeginConnect (ips, ep.Port, BCCallback,
                                                   sock);
                                Assert.Fail ("BeginConnectMultipleListen #1");
                        } catch (InvalidOperationException) {
@@ -1959,13 +1962,13 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1248);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep);
                        sock.Listen (1);
                        
                        try {
-                               sock.BeginConnect ("localhost", 1248,
+                               sock.BeginConnect ("localhost", ep.Port,
                                                   BCCallback, sock);
                                Assert.Fail ("BeginConnectHostPortListen #1");
                        } catch (InvalidOperationException) {
@@ -2033,12 +2036,12 @@ namespace MonoTests.System.Net.Sockets
                                                    SocketType.Stream,
                                                    ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1254);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
                        
                        listen.Bind (ep);
                        listen.Listen (1);
                        
-                       sock.Connect (ip, 1254);
+                       sock.Connect (ip, ep.Port);
                        
                        Assert.AreEqual (true, sock.Connected, "BeginDisconnect #1");
                        
@@ -2128,9 +2131,9 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        IPEndPoint ep1 = new IPEndPoint (IPAddress.Loopback,
-                                                       1256);
+                                                       NetworkHelpers.FindFreePort ());
                        IPEndPoint ep2 = new IPEndPoint (IPAddress.Loopback,
-                                                        1257);
+                                                        NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep1);
                        
@@ -2156,7 +2159,7 @@ namespace MonoTests.System.Net.Sockets
                                                    SocketType.Stream,
                                                    ProtocolType.Tcp);
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1258);
+                                                       NetworkHelpers.FindFreePort ());
                        
                        listen.Bind (ep);
                        listen.Listen (1);
@@ -2184,12 +2187,12 @@ namespace MonoTests.System.Net.Sockets
                                                    SocketType.Stream,
                                                    ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1249);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
 
                        listen.Bind (ep);
                        listen.Listen (1);
                        
-                       sock.Connect (ip, 1249);
+                       sock.Connect (ip, ep.Port);
                        
                        Assert.AreEqual (true, sock.Connected, "ConnectAddressPort #1");
                        
@@ -2223,13 +2226,13 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1250);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
 
                        sock.Bind (ep);
                        sock.Listen (1);
                        
                        try {
-                               sock.Connect (ip, 1250);
+                               sock.Connect (ip, ep.Port);
                                Assert.Fail ("ConnectAddressPortListen #1");
                        } catch (InvalidOperationException) {
                        } catch {
@@ -2281,7 +2284,7 @@ namespace MonoTests.System.Net.Sockets
                                                    SocketType.Stream,
                                                    ProtocolType.Tcp);
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1251);
+                                                       NetworkHelpers.FindFreePort ());
                        IPAddress[] ips = new IPAddress[4];
                        
                        ips[0] = IPAddress.Parse ("127.0.0.4");
@@ -2292,7 +2295,7 @@ namespace MonoTests.System.Net.Sockets
                        listen.Bind (ep);
                        listen.Listen (1);
                        
-                       sock.Connect (ips, 1251);
+                       sock.Connect (ips, ep.Port);
                        
                        Assert.AreEqual (true, sock.Connected, "ConnectMultiple #1");
                        Assert.AreEqual (AddressFamily.InterNetwork, sock.RemoteEndPoint.AddressFamily, "ConnectMultiple #2");
@@ -2327,12 +2330,12 @@ namespace MonoTests.System.Net.Sockets
                         * Bind to IPAddress.Any; Connect() will fail unless it can
                         * connect to all the addresses in allIps.
                         */
-                       IPEndPoint ep = new IPEndPoint (IPAddress.Any, 1251);
+                       IPEndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
 
                        listen.Bind (ep);
                        listen.Listen (1);
                        
-                       sock.Connect (allIps, 1251);
+                       sock.Connect (allIps, ep.Port);
                        
                        Assert.AreEqual (true, sock.Connected, "ConnectMultiple2 #1");
                        Assert.AreEqual (AddressFamily.InterNetwork, sock.RemoteEndPoint.AddressFamily, "ConnectMultiple2 #2");
@@ -2371,7 +2374,7 @@ namespace MonoTests.System.Net.Sockets
                                                  ProtocolType.Tcp);
                        IPAddress[] ips = new IPAddress[4];
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
-                                                       1252);
+                                                       NetworkHelpers.FindFreePort ());
                        
                        ips[0] = IPAddress.Parse ("127.0.0.4");
                        ips[1] = IPAddress.Parse ("127.0.0.3");
@@ -2382,7 +2385,7 @@ namespace MonoTests.System.Net.Sockets
                        sock.Listen (1);
                        
                        try {
-                               sock.Connect (ips, 1252);
+                               sock.Connect (ips, ep.Port);
                                Assert.Fail ("ConnectMultipleListen #1");
                        } catch (InvalidOperationException) {
                        } catch {
@@ -2436,13 +2439,13 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1253);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
                        
                        sock.Bind (ep);
                        sock.Listen (1);
                        
                        try {
-                               sock.Connect ("localhost", 1253);
+                               sock.Connect ("localhost", ep.Port);
                                Assert.Fail ("ConnectHostPortListen #1");
                        } catch (InvalidOperationException) {
                        } catch {
@@ -2495,12 +2498,12 @@ namespace MonoTests.System.Net.Sockets
                                                    SocketType.Stream,
                                                    ProtocolType.Tcp);
                        IPAddress ip = IPAddress.Loopback;
-                       IPEndPoint ep = new IPEndPoint (ip, 1255);
+                       IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
                        
                        listen.Bind (ep);
                        listen.Listen (1);
                        
-                       sock.Connect (ip, 1255);
+                       sock.Connect (ip, ep.Port);
                        
                        Assert.AreEqual (true, sock.Connected, "Disconnect #1");
                        
@@ -2547,7 +2550,7 @@ namespace MonoTests.System.Net.Sockets
                {
                        int i;
 
-                       IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, 1258);
+                       IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, NetworkHelpers.FindFreePort ());
 
                        Socket listensock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        listensock.Bind (endpoint);
@@ -2604,7 +2607,7 @@ namespace MonoTests.System.Net.Sockets
                {
                        int i;
 
-                       IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, 1259);
+                       IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, NetworkHelpers.FindFreePort ());
 
                        Socket listensock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        listensock.Bind (endpoint);
@@ -2700,7 +2703,7 @@ namespace MonoTests.System.Net.Sockets
                                                SocketType.Dgram,
                                                ProtocolType.Udp);
                        CWRSocket.Bind (new IPEndPoint (IPAddress.Loopback,
-                                                       1256));
+                                                       NetworkHelpers.FindFreePort ()));
                        
                        Thread recv_thread = new Thread (new ThreadStart (CWRReceiveThread));
                        CWRReady.Reset ();
@@ -2718,7 +2721,7 @@ namespace MonoTests.System.Net.Sockets
                static bool RRCLastRead = false;
                static ManualResetEvent RRCReady = new ManualResetEvent (false);
                
-               private static void RRCClientThread ()
+               private static void RRCClientThread (int port)
                {
                        byte[] bytes = new byte[8];
                        int readbyte;
@@ -2727,7 +2730,7 @@ namespace MonoTests.System.Net.Sockets
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
                        sock.Connect (new IPEndPoint (IPAddress.Loopback,
-                                                     1257));
+                                                     port));
                        
                        NetworkStream stream = new NetworkStream (sock);
 
@@ -3068,7 +3071,7 @@ namespace MonoTests.System.Net.Sockets
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
                                ProtocolType.Tcp);
 
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        try {
                                s.ReceiveFrom ((Byte []) null, ref remoteEP);
                                Assert.Fail ("#1");
@@ -3110,7 +3113,7 @@ namespace MonoTests.System.Net.Sockets
                                ProtocolType.Tcp);
                        s.Close ();
 
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        try {
                                s.ReceiveFrom ((Byte []) null, ref remoteEP);
                                Assert.Fail ("#1");
@@ -3129,7 +3132,7 @@ namespace MonoTests.System.Net.Sockets
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
                                ProtocolType.Tcp);
 
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        try {
                                s.ReceiveFrom ((Byte []) null, (SocketFlags) 666, ref remoteEP);
                                Assert.Fail ("#1");
@@ -3171,7 +3174,7 @@ namespace MonoTests.System.Net.Sockets
                                ProtocolType.Tcp);
                        s.Close ();
 
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        try {
                                s.ReceiveFrom ((Byte []) null, (SocketFlags) 666, ref remoteEP);
                                Assert.Fail ("#1");
@@ -3190,7 +3193,7 @@ namespace MonoTests.System.Net.Sockets
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
                                ProtocolType.Tcp);
 
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        try {
                                s.ReceiveFrom ((Byte []) null, 0, (SocketFlags) 666,
                                        ref remoteEP);
@@ -3231,7 +3234,7 @@ namespace MonoTests.System.Net.Sockets
                {
                        Socket s;
                        byte [] buffer = new byte [5];
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
 
                        // size negative
                        s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3274,7 +3277,7 @@ namespace MonoTests.System.Net.Sockets
                                ProtocolType.Tcp);
                        s.Close ();
 
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        try {
                                s.ReceiveFrom ((Byte []) null, -1, (SocketFlags) 666,
                                        ref remoteEP);
@@ -3293,7 +3296,7 @@ namespace MonoTests.System.Net.Sockets
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
                                ProtocolType.Tcp);
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
 
                        try {
                                s.ReceiveFrom ((Byte []) null, -1, -1, (SocketFlags) 666,
@@ -3312,7 +3315,7 @@ namespace MonoTests.System.Net.Sockets
                {
                        Socket s;
                        byte [] buffer = new byte [5];
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
 
                        // offset negative
                        s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3375,7 +3378,7 @@ namespace MonoTests.System.Net.Sockets
                {
                        Socket s;
                        byte [] buffer = new byte [5];
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
 
                        // size negative
                        s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3436,7 +3439,7 @@ namespace MonoTests.System.Net.Sockets
                        s.Close ();
 
                        byte [] buffer = new byte [5];
-                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+                       EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        try {
                                s.ReceiveFrom (buffer, -1, -1, (SocketFlags) 666,
                                        ref remoteEP);
@@ -3453,14 +3456,15 @@ namespace MonoTests.System.Net.Sockets
                [Test]
                public void ReceiveRemoteClosed ()
                {
+                       var port = NetworkHelpers.FindFreePort ();
                        Socket sock = new Socket (AddressFamily.InterNetwork,
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
-                       sock.Bind (new IPEndPoint (IPAddress.Loopback, 1257));
+                       sock.Bind (new IPEndPoint (IPAddress.Loopback, port));
                        sock.Listen (1);
                        
                        RRCReady.Reset ();
-                       Thread client_thread = new Thread (new ThreadStart (RRCClientThread));
+                       Thread client_thread = new Thread (() => RRCClientThread (port));
                        client_thread.Start ();
                        
                        Socket client = sock.Accept ();
@@ -3482,12 +3486,13 @@ namespace MonoTests.System.Net.Sockets
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                        s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
                        
-                       s.Bind (new IPEndPoint (IPAddress.Any, 12345));
+                       var ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
+                       s.Bind (ep);
                        
                        Socket ss = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                        ss.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
                        
-                       ss.Bind (new IPEndPoint (IPAddress.Any, 12345));
+                       ss.Bind (new IPEndPoint (IPAddress.Any, ep.Port));
 
                        // If we make it this far, we succeeded.
                        
@@ -3525,15 +3530,15 @@ namespace MonoTests.System.Net.Sockets
                        using (Socket ss = new Socket (AddressFamily.InterNetwork,
                                                SocketType.Stream, ProtocolType.Tcp)) {
                                s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
-
-                               s.Bind (new IPEndPoint (IPAddress.Any, 12345));
+                               var ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
+                               s.Bind (ep);
                                s.Listen(1);
 
                                ss.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
 
                                Exception ex = null;
                                try {
-                                       ss.Bind (new IPEndPoint (IPAddress.Any, 12345));
+                                       ss.Bind (new IPEndPoint (IPAddress.Any, ep.Port));
                                        ss.Listen(1);
                                } catch (SocketException e) {
                                        ex = e;
@@ -3547,11 +3552,11 @@ namespace MonoTests.System.Net.Sockets
                [Category ("NotOnMac")]
                 public void ConnectedProperty ()
                 {
-                       TcpListener listener = new TcpListener (IPAddress.Loopback, 23456);
+                       TcpListener listener = new TcpListener (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                        listener.Start();
 
                        Socket client = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-                       client.Connect (IPAddress.Loopback, 23456);
+                       client.Connect (IPAddress.Loopback, ((IPEndPoint)listener.LocalEndpoint).Port);
                        Socket server = listener.AcceptSocket ();
 
                        try {
@@ -3753,7 +3758,7 @@ namespace MonoTests.System.Net.Sockets
                        IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
 
                        using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
-                               s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+                               s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
                                try {
                                        s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
                                                new IPv6MulticastOption (mcast_addr));
@@ -3775,7 +3780,7 @@ namespace MonoTests.System.Net.Sockets
                        IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
 
                        using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
-                               s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+                               s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
                                s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
                                        new MulticastOption (mcast_addr));
                        }
@@ -3814,7 +3819,7 @@ namespace MonoTests.System.Net.Sockets
                        IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
 
                        using (Socket s = new Socket (AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp)) {
-                               s.Bind (new IPEndPoint (IPAddress.IPv6Any, 1902));
+                               s.Bind (new IPEndPoint (IPAddress.IPv6Any, NetworkHelpers.FindFreePort ()));
                                s.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership,
                                        new IPv6MulticastOption (mcast_addr));
                        }
@@ -3829,7 +3834,7 @@ namespace MonoTests.System.Net.Sockets
                        IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
 
                        using (Socket s = new Socket (AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp)) {
-                               s.Bind (new IPEndPoint (IPAddress.IPv6Any, 1902));
+                               s.Bind (new IPEndPoint (IPAddress.IPv6Any, NetworkHelpers.FindFreePort ()));
                                try {
                                        s.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership,
                                                new MulticastOption (mcast_addr));
@@ -3980,7 +3985,7 @@ namespace MonoTests.System.Net.Sockets
                        IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
 
                        using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
-                               s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+                               s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
                                s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
                                        new MulticastOption (mcast_addr));
                                try {
@@ -4006,7 +4011,7 @@ namespace MonoTests.System.Net.Sockets
                        using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
                                MulticastOption option = new MulticastOption (mcast_addr);
 
-                               s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+                               s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
                                s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
                                        option);
                                s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.DropMembership,
@@ -4065,7 +4070,7 @@ namespace MonoTests.System.Net.Sockets
                        IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
 
                        using (Socket s = new Socket (AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp)) {
-                               s.Bind (new IPEndPoint (IPAddress.IPv6Any, 1902));
+                               s.Bind (new IPEndPoint (IPAddress.IPv6Any, NetworkHelpers.FindFreePort ()));
                                s.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership,
                                        new IPv6MulticastOption (mcast_addr));
                                try {
@@ -4194,7 +4199,7 @@ namespace MonoTests.System.Net.Sockets
                public void Shutdown_NoConnect ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-                       s.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+                       s.Bind (new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ()));
                        s.Listen (1);
                        try {
                                s.Shutdown (SocketShutdown.Both);
@@ -4332,7 +4337,7 @@ namespace MonoTests.System.Net.Sockets
                public void ConnectToIPV4EndPointUsingDualModelSocket () {
                        using (var server = new Socket (SocketType.Stream, ProtocolType.Tcp))
                        using (var client = new Socket (SocketType.Stream, ProtocolType.Tcp)) {
-                               var host = new IPEndPoint (IPAddress.Loopback, 0);
+                               var host = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                                        
                                server.Bind (host);
                                server.Listen (0);
@@ -4354,7 +4359,7 @@ namespace MonoTests.System.Net.Sockets
                public void BeginConnectToIPV4EndPointUsingDualModelSocket () {
                        using (var server = new Socket (SocketType.Stream, ProtocolType.Tcp))
                        using (var client = new Socket (SocketType.Stream, ProtocolType.Tcp)) {
-                               var host = new IPEndPoint (IPAddress.Loopback, 0);
+                               var host = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
                                        
                                server.Bind (host);
                                server.Listen (0);
@@ -4383,7 +4388,7 @@ namespace MonoTests.System.Net.Sockets
 
                        Socket listenSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        
-                       listenSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+                       listenSocket.Bind (new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ()));
                        listenSocket.Listen (1);
 
                        listenSocket.BeginAccept (new AsyncCallback (ReceiveCallback), listenSocket);
@@ -4408,7 +4413,7 @@ namespace MonoTests.System.Net.Sockets
                        /* see https://bugzilla.xamarin.com/show_bug.cgi?id=36941 */
 
                        using (Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
-                               IPEndPoint end_point = new IPEndPoint (IPAddress.Any, 11000);
+                               IPEndPoint end_point = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
                                socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
                                socket.Bind (end_point);
                                socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 19);
index 9fc807acc278015e9beb1b7b7d510f912c7957f4..2540e23603143f4999cba59f4c9b11cdc42d6a09 100644 (file)
@@ -67,7 +67,7 @@ CORLIB_MONO_POSIX_REF = -r:Mono.Posix.dll
 endif
 
 # System.IO/DirectoryInfoTest.cs needs Mono.Posix
-TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll \
+TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll -r:System.dll \
                                 -define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%)
 
 EXTRA_DISTFILES = \
@@ -95,39 +95,6 @@ CLEAN_FILES += $(TEST_RESX_RESOURCES)
 
 include $(topdir)/build/library.make
 
-ifdef FIXME_CORLIB_CMP
-# corlib_cmp
-corlib_flags = -unsafe -nostdlib
-cmplib = $(topdir)/class/lib/$(PROFILE)/corlib_cmp.dll
-cmppdb = $(cmplib:.dll=.pdb)
-cmp_response = $(depsdir)/$(PROFILE)_corlib_cmp.dll.response
-cmp_makefrag = $(depsdir)/$(PROFILE)_corlib_cmp.dll.makefrag
-cmp_flags = -r:$(PLATFORM_CORLIB) $(corlib_flags)
-
-EXTRA_DISTFILES += corlib_cmp.dll.excludes
-CLEAN_FILES += $(cmplib) $(cmp_response) $(cmp_makefrag) $(cmppdb)
-
-$(cmplib): $(cmp_makefrag) $(cmp_response)
-       $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) -target:library -out:$@ @$(cmp_response)
-
-$(cmp_response): $(sourcefile) corlib_cmp.dll.excludes
-       @echo Creating $@ ...
-       @sort $(sourcefile) corlib_cmp.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
-
-$(cmp_makefrag): $(cmp_response)
-       @echo Creating $@ ...
-       @sed 's,^,$(cmplib): ,' $< >$@
-
-# Since we make corlib_cmp on demand, there isn't a real need
-# to have full dep tracking for it. Also, the generation of this
-# file is busted on Win32 ('sort' seems to mess up line endings),
-# leading to a broken build.
-#
-# -include $(cmp_makefrag)
-
-$(cmp_response) $(cmp_makefrag): Makefile $(depsdir)/.stamp
-endif
-
 $(TEST_RESX_RESOURCES) $(TEST_RESX_RESOURCES_SATELITE): %.resources: %.resx
        $(RESGEN) $< || cp $@.prebuilt $@
 
index daf8eb72322c4afb80c2da740219ce0ba5f0d2db..b442da4d2fb51057e180cb1252e4409cc024306d 100644 (file)
@@ -683,7 +683,11 @@ namespace Mono {
                                                n = 2;
                                                break;
                                        case '7':
+#if PCL
+                                               e = Encoding.GetEncoding ("utf-7");
+#else
                                                e = Encoding.UTF7;
+#endif
                                                n = 1;
                                                break;
                                        case 'b':
@@ -691,11 +695,19 @@ namespace Mono {
                                                n = 2;
                                                break;
                                        case '3':
+#if PCL
+                                               e = Encoding.GetEncoding ("utf-32");
+#else
                                                e = Encoding.GetEncoding (12000);
+#endif
                                                n = 4;
                                                break;
                                        case '4':
+#if PCL
+                                               e = Encoding.GetEncoding ("utf-32BE");
+#else
                                                e = Encoding.GetEncoding (12001);
+#endif
                                                n = 4;
                                                break;
                                        
index 33ff04a566acbdbfc9ec3c894f074c357092a512..a0d0fd05b21b577d2d670f577359fe76c763bf45 100644 (file)
@@ -43,7 +43,10 @@ namespace System.Diagnostics.Tracing
 
                public EventLevel Level { get; set; }
                public EventKeywords Keywords { get; set; }
-
+               public EventOpcode Opcode { get; set; }
+               public EventChannel Channel { get; set; }
+               public string Message { get; set; }
+               public EventTask Task { get; set; }
        }
 }
 
index 41a79eb6d7e560e48797c385a6804d1f51070533..9bc0b8a5994500a625b81919aa59c85cb18192a9 100644 (file)
@@ -283,6 +283,12 @@ namespace System.Reflection.Emit
                        throw new NotSupportedException ();
                }
 
+               public override ParameterInfo ReturnParameter {
+                       get {
+                               throw new NotSupportedException();
+                       }
+               }
+
                public override ICustomAttributeProvider ReturnTypeCustomAttributes {
                        get {
                                throw new NotSupportedException ();
diff --git a/mcs/class/corlib/System.Reflection/MethodInfo.cs b/mcs/class/corlib/System.Reflection/MethodInfo.cs
deleted file mode 100644 (file)
index 83fc9a7..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-//
-// System.Reflection/MethodInfo.cs
-//
-// Author:
-//   Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection {
-
-       [ComVisible (true)]
-       [ComDefaultInterfaceAttribute (typeof (_MethodInfo))]
-       [Serializable]
-       [ClassInterface(ClassInterfaceType.None)]
-#if MOBILE
-       public abstract class MethodInfo: MethodBase {
-#else
-       public abstract class MethodInfo: MethodBase, _MethodInfo {
-#endif
-               public abstract MethodInfo GetBaseDefinition();
-
-               internal virtual MethodInfo GetBaseMethod ()
-               {
-                       return this;
-               }
-
-               protected MethodInfo() {
-               }
-
-
-               public override MemberTypes MemberType { get {return MemberTypes.Method;} }
-
-               public virtual Type ReturnType {
-                       get { return null; }
-               }
-
-               public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
-
-#if !MOBILE
-               void _MethodInfo.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               Type _MethodInfo.GetType ()
-               {
-                       // Required or object::GetType becomes virtual final
-                       return base.GetType ();
-               }
-
-               void _MethodInfo.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               void _MethodInfo.GetTypeInfoCount (out uint pcTInfo)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               void _MethodInfo.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
-
-               [ComVisible (true)]
-               public virtual MethodInfo GetGenericMethodDefinition ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public virtual MethodInfo MakeGenericMethod (params Type [] typeArguments)
-               {
-                       throw new NotSupportedException (this.GetType().ToString ());
-               }
-
-               // GetGenericArguments, IsGenericMethod, IsGenericMethodDefinition
-               // and ContainsGenericParameters are implemented in the derived classes.
-               [ComVisible (true)]
-               public override Type [] GetGenericArguments () {
-                       return Type.EmptyTypes;
-               }
-
-
-               public virtual ParameterInfo ReturnParameter {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override bool Equals (object obj)
-               {
-                       return obj == (object) this;
-               }
-
-               public override int GetHashCode ()
-               {
-                       return base.GetHashCode ();
-               }
-
-               public static bool operator == (MethodInfo left, MethodInfo right)
-               {
-                       if ((object)left == (object)right)
-                               return true;
-                       if ((object)left == null ^ (object)right == null)
-                               return false;
-                       return left.Equals (right);
-               }
-
-               public static bool operator != (MethodInfo left, MethodInfo right)
-               {
-                       if ((object)left == (object)right)
-                               return false;
-                       if ((object)left == null ^ (object)right == null)
-                               return true;
-                       return !left.Equals (right);
-               }
-
-               public virtual Delegate CreateDelegate (Type delegateType)
-               {
-                       return Delegate.CreateDelegate (delegateType, this);
-               }
-
-               public virtual Delegate CreateDelegate (Type delegateType, object target)
-               {
-                       return Delegate.CreateDelegate (delegateType, target, this);
-               }
-       }
-}
index f9a931f1135d39d71828ea7573124ee49683542e..544774d1786061abd71dcd490fc36a4c8e4dbf4b 100644 (file)
@@ -149,6 +149,16 @@ namespace System.Reflection {
             return sbName.ToString();
         }
 
+               public override Delegate CreateDelegate (Type delegateType)
+               {
+                       return Delegate.CreateDelegate (delegateType, this);
+               }
+
+               public override Delegate CreateDelegate (Type delegateType, object target)
+               {
+                       return Delegate.CreateDelegate (delegateType, target, this);
+               }
+
         public override String ToString() 
         {
             return ReturnType.FormatTypeName() + " " + FormatNameAndSig(false);
index 0ce7736f57432c0bbe1981d60cba712af09d597b..c86156e8ca137328a94758ec06621f1af0a4c29b 100644 (file)
@@ -34,6 +34,7 @@ using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
 using System.Security.Permissions;
 using System.Security.Claims;
+using Microsoft.Win32.SafeHandles;
 
 namespace System.Security.Principal {
 
@@ -312,6 +313,10 @@ namespace System.Security.Principal {
                        }
                }
 
+               public SafeAccessTokenHandle AccessToken {
+                       get { throw new NotImplementedException (); }
+               }
+
                // see mono/mono/metadata/security.c for implementation
 
                // Many people use reflection to get a user's roles - so many 
diff --git a/mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs b/mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs
new file mode 100644 (file)
index 0000000..d7682bf
--- /dev/null
@@ -0,0 +1,25 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.Win32.SafeHandles
+{
+       public sealed class SafeAccessTokenHandle : SafeHandle
+       {
+               public override bool IsInvalid {
+                       get {
+                               return handle == IntPtr.Zero;
+                       }
+               }
+
+               public SafeAccessTokenHandle ()
+                       : base (IntPtr.Zero, true)
+               {
+                       
+               }
+
+               protected override bool ReleaseHandle()
+               {
+                       return true;
+               }
+       }
+}
index be6236d6a0700d5c07c399ad02479732d13bd050..2eae58e3e444e17fdc8447ccaee689a3aa6605bf 100644 (file)
@@ -1660,6 +1660,25 @@ namespace MonoTests.System.IO
                        
                }
 
+               [Test]
+               public void OpenCharDeviceRepeatedly ()
+               {
+                       // https://bugzilla.xamarin.com/show_bug.cgi?id=38408
+                       try {
+                               using (var f = new FileStream ("/dev/zero", FileMode.Open))
+                               {
+                               }
+                       } catch (FileNotFoundException) {
+                               // Only run this test on platforms where /dev/zero exists
+                               Assert.Ignore();
+                       }
+
+                       // this shouldn't throw
+                       using (var g = new FileStream ("/dev/zero", FileMode.Open))
+                       {
+                       }
+               }
+
 #if !MOBILE
                [Test]
                public void WriteWithExposedHandle ()
index 82aab2be0613795941937c7499286cc7e067d308..474abcd2208084f4ab516897df9e560c0d1d667a 100644 (file)
@@ -175,7 +175,14 @@ namespace MonoTests.System.Text
                        Assert.AreEqual (0x32, (int) s [5], "#B7");
                }
 
-               // UTF8 decoding tests from http://www.cl.cam.ac.uk/~mgk25/
+               //
+               // UTF8 decoding tests are based on the test file from http://www.cl.cam.ac.uk/~mgk25/
+               // The test file is: https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
+               // which is licensed under CC-by-4.0: https://creativecommons.org/licenses/by/4.0/
+               //
+               // The file is not copied verbatim, instead individual
+               // tests are based on individual portions of that file
+               //
 
                [Test]
                public void T1_Correct_GreekWord_kosme () 
index 7119236c8aab2bb638ec9916a2191e761088ed7c..a45c7ec198cb62b2fb068a2a13b743b86f535288 100644 (file)
@@ -16,6 +16,10 @@ using System.Globalization;
 using System.Reflection;
 using System.Threading;
 
+#if !MOBILE
+using System.Diagnostics;
+#endif
+
 using NUnit.Framework;
 
 namespace MonoTests.System
@@ -92,19 +96,36 @@ public class StringTest
                }
        }
 
+       // Several tests in this file, to run properly, allocate 4GB objects.
+       // Obviously this creates problems on several kinds of systems, so we
+       // conservatively skip these tests unless we find a high-RAM environment.
+       // Checking RAM requires PerformanceCounter which is absent on mobile,
+       // so any test that calls this must be category MobileNotWorking.
+       static void RequireHighMemoryTestEnvironment ()
+       {
+#if MOBILE
+               Assert.Ignore("PerformanceCounter not available.");
+#else
+               if (!Environment.Is64BitProcess)
+                       Assert.Ignore("This test cannot run on a 32-bit system.");
+
+               // Require 6 GB physical RAM, for the 4GB string plus 2GB headroom
+               var pc = new PerformanceCounter ("Mono Memory", "Total Physical Memory");
+
+               if (pc.RawValue < 6L*1024L*1024L*1024L)
+                       Assert.Ignore("This machine may not have enough RAM to run this test.");
+#endif
+       }
+
        [Test] // ctor (Char, Int32)
+       [Category ("MobileNotWorking")]
        public void Constructor4_LargeString ()
        {
-               try {
-                       var x = new String ('A', int.MaxValue);
-                       if (Environment.Is64BitProcess) {
-                               Assert.AreEqual ('A', x[0]);
-                               Assert.AreEqual ('A', x[int.MaxValue - 1]);
-                       }
-                       else
-                               Assert.Fail ("Expected OutOfMemoryException.");
-               } catch (OutOfMemoryException) {
-               }
+               RequireHighMemoryTestEnvironment();
+
+               var x = new String ('A', int.MaxValue);
+               Assert.AreEqual ('A', x[0]);
+               Assert.AreEqual ('A', x[int.MaxValue - 1]);
        }
 
        [Test] // ctor (Char [], Int32, Int32)
@@ -3008,18 +3029,14 @@ public class StringTest
        }
 
        [Test]
+       [Category ("MobileNotWorking")]
        public void PadLeft_LargeString ()
        {
-               try {
-                       var x = "x".PadLeft (int.MaxValue, '-');
-                       if (Environment.Is64BitProcess) {
-                               Assert.AreEqual ('-', x[0]);
-                               Assert.AreEqual ('x', x[int.MaxValue - 1]);
-                       }
-                       else
-                               Assert.Fail ("Expected OutOfMemoryException.");
-               } catch (OutOfMemoryException) {
-               }
+               RequireHighMemoryTestEnvironment();
+
+               var x = "x".PadLeft (int.MaxValue, '-');
+               Assert.AreEqual ('-', x[0]);
+               Assert.AreEqual ('x', x[int.MaxValue - 1]);
        }
 
        [Test] // PadRight (Int32)
@@ -3064,18 +3081,14 @@ public class StringTest
        }
 
        [Test]
+       [Category ("MobileNotWorking")]
        public void PadRight_LargeString ()
        {
-               try {
-                       var x = "x".PadRight (int.MaxValue, '-');
-                       if (Environment.Is64BitProcess) {
-                               Assert.AreEqual ('x', x[0]);
-                               Assert.AreEqual ('-', x[int.MaxValue - 1]);
-                       }
-                       else
-                               Assert.Fail ("Expected OutOfMemoryException.");
-               } catch (OutOfMemoryException) {
-               }
+               RequireHighMemoryTestEnvironment();
+
+               var x = "x".PadRight (int.MaxValue, '-');
+               Assert.AreEqual ('x', x[0]);
+               Assert.AreEqual ('-', x[int.MaxValue - 1]);
        }
 
        [Test] // Remove (Int32, Int32)
index 223880c02974001e645a20cc5cd045655f8a6e2c..b4b398166e83411b01d8ad167b3f5f55882f48d5 100644 (file)
@@ -60,6 +60,7 @@
     <Compile Include="..\..\..\external\referencesource\mscorlib\system\action.cs" />\r
     <Compile Include="..\..\..\external\referencesource\mscorlib\system\activator.cs" />\r
     <Compile Include="..\..\..\external\referencesource\mscorlib\system\AggregateException.cs" />\r
+    <Compile Include="..\..\..\external\referencesource\mscorlib\system\AppContext\AppContext.cs" />\r
     <Compile Include="..\..\..\external\referencesource\mscorlib\system\appdomainattributes.cs" />\r
     <Compile Include="..\..\..\external\referencesource\mscorlib\system\appdomainunloadedexception.cs" />\r
     <Compile Include="..\..\..\external\referencesource\mscorlib\system\applicationexception.cs" />\r
     <Compile Include="System.Security\PermissionBuilder.cs" />\r
     <Compile Include="System.Security\PermissionSet.cs" />\r
     <Compile Include="System.Security\PolicyLevelType.cs" />\r
+    <Compile Include="System.Security\SafeAccessTokenHandle.cs" />\r
     <Compile Include="System.Security\SecureString.cs" />\r
     <Compile Include="System.Security\SecurityElement.cs" />\r
     <Compile Include="System.Security\SecurityException.cs" />\r
     <Compile Include="System\__ComObject.cs" />\r
     <Compile Include="System\ActivationContext.cs" />\r
     <Compile Include="System\AndroidPlatform.cs" />\r
-    <Compile Include="System\AppContext.cs" />\r
     <Compile Include="System\AppDomain.cs" />\r
     <Compile Include="System\AppDomainInitializer.cs" />\r
     <Compile Include="System\AppDomainManager.cs" />\r
index aa0f448ce3482947805c6ca1332afd3e9a1ed0d3..55755abad47c39e0c920ee200f0f79f386ea7981 100644 (file)
@@ -239,7 +239,6 @@ System.Reflection/FieldInfo.cs
 System.Reflection/ImageFileMachine.cs
 System.Reflection/LocalVariableInfo.cs
 System.Reflection/MethodBody.cs
-System.Reflection/MethodInfo.cs
 System.Reflection/Module.cs
 System.Reflection/ModuleResolveEventHandler.cs
 System.Reflection/MonoAssembly.cs
@@ -637,6 +636,7 @@ System.Security/NamedPermissionSet.cs
 System.Security/PermissionBuilder.cs
 System.Security/PermissionSet.cs
 System.Security/PolicyLevelType.cs
+System.Security/SafeAccessTokenHandle.cs
 System.Security/SecureString.cs
 System.Security/SecurityElement.cs
 System.Security/SecurityFrame.cs
@@ -1137,6 +1137,7 @@ ReferenceSources/SecurityContext.cs
 
 ../../../external/referencesource/mscorlib/system/diagnostics/contracts/contracts.cs
 ../../../external/referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs
+../../../external/referencesource/mscorlib/system/diagnostics/eventing/winmeta.cs
 
 ../../../external/referencesource/mscorlib/system/globalization/bidicategory.cs
 ../../../external/referencesource/mscorlib/system/globalization/calendar.cs
@@ -1236,6 +1237,7 @@ ReferenceSources/SecurityContext.cs
 ../../../external/referencesource/mscorlib/system/reflection/methodbase.cs
 ../../../external/referencesource/mscorlib/system/reflection/methodbody.cs
 ../../../external/referencesource/mscorlib/system/reflection/methodimplattributes.cs
+../../../external/referencesource/mscorlib/system/reflection/methodinfo.cs
 ../../../external/referencesource/mscorlib/system/reflection/missing.cs
 ../../../external/referencesource/mscorlib/system/reflection/obfuscateassemblyattribute.cs
 ../../../external/referencesource/mscorlib/system/reflection/obfuscationattribute.cs
index 69097d496391df35fbb67104ea05d9f113dd6946..d69feb3de5b15bd0bd0c08a986db9865c0098104 100644 (file)
@@ -77,6 +77,7 @@ namespace Mono.CSharp
 
                // Win32 version info values
                string vi_product, vi_product_version, vi_company, vi_copyright, vi_trademark;
+               string pa_file_version, pa_assembly_version;
 
                protected AssemblyDefinition (ModuleContainer module, string name)
                {
@@ -240,6 +241,7 @@ namespace Mono.CSharp
                                        SetCustomAttribute (ctor, cdata);
                                } else {
                                        builder_extra.SetVersion (vinfo, a.Location);
+                                       pa_assembly_version = vinfo.ToString ();
                                }
 
                                return;
@@ -357,15 +359,15 @@ namespace Mono.CSharp
                        } else if (a.Type == pa.RuntimeCompatibility) {
                                wrap_non_exception_throws_custom = true;
                        } else if (a.Type == pa.AssemblyFileVersion) {
-                               vi_product_version = a.GetString ();
-                               if (string.IsNullOrEmpty (vi_product_version) || IsValidAssemblyVersion (vi_product_version, false) == null) {
+                               pa_file_version = a.GetString ();
+                               if (string.IsNullOrEmpty (pa_file_version) || IsValidAssemblyVersion (pa_file_version, false) == null) {
                                        Report.Warning (7035, 1, a.Location, "The specified version string `{0}' does not conform to the recommended format major.minor.build.revision",
-                                               vi_product_version, a.Name);
+                                                       pa_file_version, a.Name);
                                        return;
                                }
 
                                // File version info decoding from blob is not supported
-                               var cab = new CustomAttributeBuilder ((ConstructorInfo) ctor.GetMetaInfo (), new object[] { vi_product_version });
+                               var cab = new CustomAttributeBuilder ((ConstructorInfo)ctor.GetMetaInfo (), new object [] { pa_file_version });
                                Builder.SetCustomAttribute (cab);
                                return;
                        } else if (a.Type == pa.AssemblyProduct) {
@@ -378,6 +380,8 @@ namespace Mono.CSharp
                                vi_trademark = a.GetString ();
                        } else if (a.Type == pa.Debuggable) {
                                has_user_debuggable = true;
+                       } else if (a.Type == pa.AssemblyInformationalVersion) {
+                               vi_product_version = a.GetString ();
                        }
 
                        //
@@ -817,7 +821,11 @@ namespace Mono.CSharp
                        if (Compiler.Settings.Win32ResourceFile != null) {
                                Builder.DefineUnmanagedResource (Compiler.Settings.Win32ResourceFile);
                        } else {
-                               Builder.DefineVersionInfoResource (vi_product, vi_product_version, vi_company, vi_copyright, vi_trademark);
+                               Builder.DefineVersionInfoResource (vi_product, 
+                                                                  vi_product_version ?? pa_file_version ?? pa_assembly_version,
+                                                                  vi_company,
+                                                                  vi_copyright,
+                                                                  vi_trademark);
                        }
 
                        if (Compiler.Settings.Win32IconFile != null) {
index a145c37211fd58b2441b23dd32ec5b35a6a12a7a..8edce969a443819cabe510b5da2804ba4796a2dd 100644 (file)
@@ -1700,6 +1700,7 @@ namespace Mono.CSharp {
                public readonly PredefinedAttribute AssemblyAlgorithmId;
                public readonly PredefinedAttribute AssemblyFlags;
                public readonly PredefinedAttribute AssemblyFileVersion;
+               public readonly PredefinedAttribute AssemblyInformationalVersion;
                public readonly PredefinedAttribute ComImport;
                public readonly PredefinedAttribute CoClass;
                public readonly PredefinedAttribute AttributeUsage;
@@ -1800,6 +1801,7 @@ namespace Mono.CSharp {
                        AssemblyCompany = new PredefinedAttribute (module, "System.Reflection", "AssemblyCompanyAttribute");
                        AssemblyCopyright = new PredefinedAttribute (module, "System.Reflection", "AssemblyCopyrightAttribute");
                        AssemblyTrademark = new PredefinedAttribute (module, "System.Reflection", "AssemblyTrademarkAttribute");
+                       AssemblyInformationalVersion = new PredefinedAttribute (module, "System.Reflection", "AssemblyInformationalVersionAttribute");
 
                        AsyncStateMachine = new PredefinedStateMachineAttribute (module, "System.Runtime.CompilerServices", "AsyncStateMachineAttribute");
 
index 9ec4d99766cda5ed9e154a080e11c270297262ba..8553856ac585229093f9edb551cd9f993ce78276 100644 (file)
@@ -499,9 +499,7 @@ namespace Mono.CSharp {
 
                public override Expression CreateExpressionTree (ResolveContext ec)
                {
-                       MemberAccess ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
-
-                       Arguments args = new Arguments (3);
+                       Arguments args = new Arguments (2);
                        args.Add (new Argument (new TypeOf (type, loc)));
 
                        if (method_group.InstanceExpression == null)
@@ -509,7 +507,21 @@ namespace Mono.CSharp {
                        else
                                args.Add (new Argument (method_group.InstanceExpression));
 
-                       args.Add (new Argument (method_group.CreateExpressionTree (ec)));
+                       Expression ma;
+                       var create_v45 = ec.Module.PredefinedMembers.MethodInfoCreateDelegate.Get ();
+                       if (create_v45 != null) {
+                               //
+                               // .NET 4.5 has better API but it produces different instance than Delegate::CreateDelegate
+                               // and because csc uses this enhancement we have to as well to be fully compatible
+                               //
+                               var mg = MethodGroupExpr.CreatePredefined (create_v45, create_v45.DeclaringType, loc);
+                               mg.InstanceExpression = method_group.CreateExpressionTree (ec);
+                               ma = mg;
+                       } else {
+                               ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
+                               args.Add (new Argument (method_group.CreateExpressionTree (ec)));
+                       }
+
                        Expression e = new Invocation (ma, args).Resolve (ec);
                        if (e == null)
                                return null;
index b16e2f38b9fefa8e189722f9fc636405a3ee5ff8..a5a9ad15607da053892c5073fee28ecfcdd25130 100644 (file)
@@ -384,6 +384,7 @@ namespace Mono.CSharp
                public readonly PredefinedMember<MethodSpec> FixedBufferAttributeCtor;
                public readonly PredefinedMember<MethodSpec> MethodInfoGetMethodFromHandle;
                public readonly PredefinedMember<MethodSpec> MethodInfoGetMethodFromHandle2;
+               public readonly PredefinedMember<MethodSpec> MethodInfoCreateDelegate;
                public readonly PredefinedMember<MethodSpec> MonitorEnter;
                public readonly PredefinedMember<MethodSpec> MonitorEnter_v4;
                public readonly PredefinedMember<MethodSpec> MonitorExit;
@@ -659,6 +660,10 @@ namespace Mono.CSharp
                        MethodInfoGetMethodFromHandle2 = new PredefinedMember<MethodSpec> (module, types.MethodBase,
                                "GetMethodFromHandle", MemberKind.Method, types.RuntimeMethodHandle, new PredefinedType (btypes.RuntimeTypeHandle));
 
+                       MethodInfoCreateDelegate = new PredefinedMember<MethodSpec> (module, types.MethodInfo,
+                                                                                    "CreateDelegate", MemberKind.Method,
+                                                                                    new PredefinedType (btypes.Type), new PredefinedType (btypes.Object));
+
                        MonitorEnter = new PredefinedMember<MethodSpec> (module, types.Monitor, "Enter", btypes.Object);
 
                        MonitorEnter_v4 = new PredefinedMember<MethodSpec> (module, types.Monitor,
index 74a4d1ad1f4f4788e16453eb942c84357efa6f5c..6e46735c81812f4a1fb0de37d530bf5b3529ee1b 100644 (file)
@@ -27,13 +27,13 @@ class C
        int TestInstance ()
        {
                Expression<Func<EmptyDelegate>> e = () => M;
-               if (e.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, value(C), Void M()))")
+               if (e.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, value(C)))")
                        return 1;
                
                e.Compile () ();
                
                Expression<Func<C, EmptyDelegate>> e2 = (l) => l.M;
-               if (e2.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, l, Void M()))")
+               if (e2.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, l))")
                        return 2;
                
                e2.Compile () (this);
@@ -43,8 +43,7 @@ class C
        public static int Main ()
        {
                Expression<Func<EmptyDelegate>> e = () => new EmptyDelegate (Test);
-               
-               if (e.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
+               if (e.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))")
                        return 1;
 
                var v = e.Compile ();
@@ -54,7 +53,7 @@ class C
                        return 2;
                
                Expression<Func<EmptyDelegate>> e2 = () => Test;
-               if (e2.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
+               if (e2.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))")
                        return 3;
 
                var v2 = e2.Compile ();
@@ -65,7 +64,7 @@ class C
                        
                unsafe {
                        Expression<Func<UnsafeDelegate>> e3 = () => new UnsafeDelegate (Foo);
-                       if (e3.Body.ToString () != "Convert(CreateDelegate(UnsafeDelegate, null, Int32* Foo()))")
+                       if (e3.Body.ToString () != "Convert(Int32* Foo().CreateDelegate(UnsafeDelegate, null))")
                                return 5;
                        
                        var v3 = e3.Compile ();
diff --git a/mcs/tests/gtest-etree-31.cs b/mcs/tests/gtest-etree-31.cs
new file mode 100644 (file)
index 0000000..350a64a
--- /dev/null
@@ -0,0 +1,31 @@
+using System;
+using System.Linq.Expressions;
+
+class X
+{
+       class HasAction
+       {
+               public void Start ()
+               {
+               }
+       }
+
+       public static int Main ()
+       {
+               var expectedObject = typeof (HasAction).GetMethod("Start");
+
+               Expression<Func<HasAction, Action>> methodToUse = r => r.Start;
+               
+               UnaryExpression unary = methodToUse.Body as UnaryExpression;
+               MethodCallExpression methodCall = unary.Operand as MethodCallExpression;
+               ConstantExpression constantExpression = methodCall.Object as ConstantExpression;
+
+               if (expectedObject != constantExpression.Value)
+                       return 1;
+
+               if (methodCall.Object == null)
+                       return 2;
+
+               return 0;
+       }
+}
\ No newline at end of file
index b649279812506f9d02a19cf558fec4681c024a20..e57c81cfd743f451e79d7b95069add58d551b878 100644 (file)
@@ -14,6 +14,9 @@ class X
                if (fvi.FileVersion != "2011.02.0.0")
                        return 1;
 
+               if (fvi.ProductVersion != "2011.02.0.0")
+                       return 2;
+
                return 0;
        }
 }
\ No newline at end of file
index 76a4c4217b67d1d3de70cf638339671c5b8f18dd..47486e7f971cd3edee09a15d8db0996657c48d37 100644 (file)
         <size>102</size>
       </method>
       <method name="Void ConvertTest_12()" attrs="129">
-        <size>142</size>
+        <size>141</size>
       </method>
       <method name="Void ConvertTest_13()" attrs="129">
         <size>87</size>
         <size>313</size>
       </method>
       <method name="Void EqualTestDelegate_3()" attrs="129">
-        <size>230</size>
+        <size>229</size>
       </method>
       <method name="Void ExclusiveOrTest()" attrs="129">
         <size>116</size>
         <size>2</size>
       </method>
       <method name="Int32 TestInstance()" attrs="129">
-        <size>339</size>
+        <size>337</size>
       </method>
       <method name="Int32 Main()" attrs="150">
-        <size>583</size>
+        <size>580</size>
       </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
         <size>9</size>
       </method>
       <method name="Int32 Main()" attrs="150">
-        <size>222</size>
+        <size>221</size>
       </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
     </type>
   </test>
+  <test name="gtest-etree-31.cs">
+    <type name="X">
+      <method name="Int32 Main()" attrs="150">
+        <size>241</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X+HasAction">
+      <method name="Void Start()" attrs="134">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-exmethod-01.cs">
     <type name="SimpleTest">
       <method name="System.String Prefix(System.String, System.String)" attrs="150">
   <test name="test-892.cs">
     <type name="X">
       <method name="Int32 Main()" attrs="150">
-        <size>66</size>
+        <size>94</size>
       </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
diff --git a/mcs/tools/misc/.gitattributes b/mcs/tools/misc/.gitattributes
deleted file mode 100644 (file)
index 3ca3e2b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/EnumCheck.cs -crlf
-/EnumCheckAssemblyCollection.cs -crlf
-/GenerateDelegate.cs -crlf
-/IFaceDisco.cs -crlf
-/XMLUtil.cs -crlf
diff --git a/mcs/tools/misc/EnumCheck.cs b/mcs/tools/misc/EnumCheck.cs
deleted file mode 100644 (file)
index 8c564cc..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/**\r
- * Namespace: System.Web\r
- * Class:     EnumCheck\r
- *\r
- * Author:  Gaurav Vaish\r
- * Contact: <gvaish@iitk.ac.in>\r
- * Status:  100%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
-\r
-using System;\r
-using System.Xml;\r
-using System.Collections;\r
-using System.Reflection;\r
-\r
-namespace Mono.Enumerations\r
-{\r
-       public class EnumCheck\r
-       {\r
-               private string className;\r
-               private Type   type;\r
-               private EnumCheckAssemblyCollection ecac = new EnumCheckAssemblyCollection();\r
-               \r
-               public static string confFile = "assemblies.xml";\r
-\r
-               public EnumCheck(string className)\r
-               {\r
-                       this.className = className;\r
-                       ecac.Parse();\r
-               }\r
-\r
-               public void Display()\r
-               {\r
-                       ecac.ConfigFile = confFile;\r
-                       LoadType();\r
-                       if(type == null || !type.IsEnum)\r
-                       {\r
-                               System.Console.Write("-->Failed to load the enumeration: " + className);\r
-                               return;\r
-                       }\r
-                       Array ar = Enum.GetValues(type);\r
-                       System.Console.WriteLine("-->Enumeration: {0}", type.ToString());\r
-                       for(int i=0; i < ar.Length; i++)\r
-                       {\r
-                               Enum b = (Enum)ar.GetValue(i);\r
-                               System.Console.Write(" {0}", Enum.Format(type, b, "G"));\r
-                               System.Console.WriteLine(" ({0}) ", Enum.Format(type, b, "D"));\r
-                       }\r
-               }\r
-\r
-               private void LoadType()\r
-               {\r
-                       type = null;\r
-                       foreach(string url in ecac)\r
-                       {\r
-                               try\r
-                               {\r
-                                       Assembly assembly = Assembly.LoadFrom(url);\r
-                                       foreach(Type t in assembly.GetTypes())\r
-                                       {\r
-                                               if(!t.IsEnum)\r
-                                                       continue;\r
-                                               if(className == t.ToString())\r
-                                               {\r
-                                                       type = t;\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-                               } catch(BadImageFormatException)\r
-                               {\r
-                               } catch(ReflectionTypeLoadException)\r
-                               {\r
-                               } catch(ArgumentException)\r
-                               {\r
-                               }\r
-                               if(type != null)\r
-                                       return;\r
-                       }\r
-               }\r
-\r
-               public static void PrintUsage()\r
-               {\r
-                       System.Console.WriteLine("Usage:");\r
-                       System.Console.WriteLine("EnumCheck [<enum> [<enum> [... ] ] ]");\r
-                       System.Console.WriteLine("");\r
-                       System.Console.WriteLine("enum := <namespace>[.<subnamespace>[...]].enum_name");\r
-                       System.Console.WriteLine("");\r
-               }\r
-\r
-               public static void Main(string[] args)\r
-               {\r
-                       if(args.Length > 0 && (args[0] == "--help" || args[0] == "-h"))\r
-                       {\r
-                               PrintUsage();\r
-                               return;\r
-                       }\r
-                       EnumCheck check = null;\r
-                       string bdir;\r
-                       System.Console.Write("Enter assembly configuration file [{0}]:", confFile);\r
-                       //System.Console.Write("[{0}]: ", confFile);\r
-                       bdir = System.Console.ReadLine();\r
-                       while(bdir.EndsWith("/") || bdir.EndsWith("\\"))\r
-                       {\r
-                               bdir = bdir.Substring(0, bdir.Length - 1);\r
-                       }\r
-                       if(bdir != "")\r
-                       {\r
-                               confFile = bdir;\r
-                       }\r
-                       if(args.Length != 0)\r
-                       {\r
-                               foreach(string clName in args)\r
-                               {\r
-                                       check = new EnumCheck(clName);\r
-                                       check.Display();\r
-                                       System.Console.WriteLine("\n");\r
-                               }\r
-                       }\r
-                       while(true)\r
-                       {\r
-                               System.Console.Write("Enter the name of the Enumeration (end to stop): ");\r
-                               string clName = System.Console.ReadLine();\r
-                               if(clName == "stop" || clName == "end" || clName.Length == 0)\r
-                                       break;\r
-                               check = new EnumCheck(clName);\r
-                               check.Display();\r
-                               System.Console.WriteLine("\n");\r
-                       }\r
-               }\r
-       }\r
-}\r
diff --git a/mcs/tools/misc/EnumCheckAssemblyCollection.cs b/mcs/tools/misc/EnumCheckAssemblyCollection.cs
deleted file mode 100644 (file)
index 470492c..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/**\r
- * Namespace: System.Web\r
- * Class:     EnumCheckAssembly\r
- *\r
- * Author:  Gaurav Vaish\r
- * Contact: <gvaish@iitk.ac.in>\r
- * Status:  100%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Xml;\r
-using System.Collections;\r
-using System.Reflection;\r
-\r
-namespace Mono.Enumerations\r
-{\r
-       public class EnumCheckAssemblyCollection: IEnumerable\r
-       {\r
-               public string ConfigFile = "assemblies.xml";\r
-               \r
-               private ArrayList assemblyList = new ArrayList();\r
-\r
-               public EnumCheckAssemblyCollection()\r
-               {\r
-               }\r
-\r
-               public void Parse()\r
-               {\r
-                       Stream      fStream;\r
-                       XmlReader   reader;\r
-                       XmlDocument document;\r
-                       string      url;\r
-\r
-                       fStream = new FileStream(ConfigFile, FileMode.Open, FileAccess.Read, FileShare.Read);\r
-                       reader = new XmlTextReader(fStream);\r
-                       document = new XmlDocument();\r
-                       document.Load(reader);\r
-                       if(document.DocumentElement != null)\r
-                       {\r
-                               if(document.DocumentElement.LocalName == "assemblies")\r
-                               {\r
-                                       foreach(XmlNode pathNode in document.DocumentElement)\r
-                                       {\r
-                                               if(pathNode.NodeType == XmlNodeType.Element && pathNode.LocalName=="path")\r
-                                               {\r
-                                                       url = pathNode.Attributes["url"].Value;\r
-                                                       while(url.EndsWith("\\") || url.EndsWith("/"))\r
-                                                       {\r
-                                                               url = url.Substring(0, url.Length - 1);\r
-                                                       }\r
-                                                       if(url == null || url.Length == 0)\r
-                                                       {\r
-                                                               continue;\r
-                                                       }\r
-                                                       foreach(XmlNode assemblyNode in pathNode.ChildNodes)\r
-                                                       {\r
-                                                               if(assemblyNode.LocalName == "assembly")\r
-                                                               {\r
-                                                                       assemblyList.Add(url + "\\" + assemblyNode.Attributes["file"].Value);\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-                       fStream.Close();\r
-               }\r
-\r
-               public IEnumerator GetEnumerator()\r
-               {\r
-                       return assemblyList.GetEnumerator();\r
-               }\r
-       }\r
-}\r
diff --git a/mcs/tools/misc/GenerateDelegate.cs b/mcs/tools/misc/GenerateDelegate.cs
deleted file mode 100644 (file)
index 0ba8e78..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/**\r
- * Namespace: com.mastergaurav.utils\r
- * Class:     GenerateDelegate\r
- *\r
- * Author:  Gaurav Vaish\r
- * Maintainer: gvaish@iitk.ac.in\r
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
- * Implementation: yes\r
- * Status:  100%\r
- *\r
- * (C) Gaurav Vaish (2001)\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-\r
-namespace com.mastergaurav.Utils\r
-{\r
-       public class GenerateDelegate\r
-       {\r
-               public static string TargetDirectory = String.Empty;\r
-               public static string NamespaceName   = String.Empty;\r
-\r
-               public static readonly string PROLOGUE = "/**\n * Namespace: ";\r
-               public static readonly string DETAILS   = " *\n * Author: Gaurav Vaish\n" +\r
-                                                         " * Maintainer: gvaish@iitk.ac.in\n" +\r
-                                                         " * Contact:  <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\n" +\r
-                                                         " * Implementation: yes\n" +\r
-                                                         " * Status: 100%\n" +\r
-                                                         " *\n" +\r
-                                                         " * (C) Gaurav Vaish (2002)\n" +\r
-                                                         " */\n\n";\r
-               public static readonly string USING     = "using System;\n" +\r
-                                                         "using System.Web;\n" +\r
-                                                         "using System.Web.UI;\n\n";\r
-\r
-               public static readonly string NAMESPACE = "namespace ";\r
-\r
-               public static string AskForNamespace()\r
-               {\r
-                       string nm = String.Empty;\r
-                       System.Console.Write("Enter the name of the namespace: ");\r
-                       nm = System.Console.ReadLine();\r
-                       return nm;\r
-               }\r
-\r
-               public static string AskForMore()\r
-               {\r
-                       string del = String.Empty;\r
-                       System.Console.Write("Enter the name of the delegate (end to stop): ");\r
-                       del = System.Console.ReadLine();\r
-                       if(del == String.Empty || del == "end")\r
-                               return String.Empty;\r
-                       return del;\r
-               }\r
-\r
-               public static void Generate(string delName)\r
-               {\r
-                       string fileName = TargetDirectory + "\\" + delName + "EventHandler.cs";\r
-                       System.Console.Write("File: ");//, fileName);\r
-                       System.Console.Write(fileName);\r
-                       System.Console.Write("\tGenerating");\r
-\r
-                       StreamWriter writer;\r
-                       try\r
-                       {\r
-                               Stream stream = new FileStream(fileName, FileMode.Truncate, FileAccess.Write);\r
-                               writer = new StreamWriter(stream);\r
-                       } catch(FileNotFoundException)\r
-                       {\r
-                               writer = File.CreateText(fileName);\r
-                       }\r
-                       if(writer == null)\r
-                       {\r
-                               System.Console.WriteLine("Null writer...\n");\r
-                               return;\r
-                       }\r
-                       writer.Write(PROLOGUE);\r
-                       writer.Write(NamespaceName + "\n");\r
-                       writer.Write(DETAILS);\r
-                       writer.Write(NAMESPACE);\r
-                       writer.Write(NamespaceName + "\n");\r
-                       writer.Write("{\n");\r
-                       writer.Write("\tpublic delegate void ");\r
-                       writer.Write(delName);\r
-                       writer.Write("EventHandler(object sender, ");\r
-                       writer.Write(delName);\r
-                       writer.Write("EventArgs e);\n");\r
-                       writer.Write("}");\r
-\r
-                       writer.Flush();\r
-                       writer.Close();\r
-\r
-                       System.Console.WriteLine("\tGenerated\n");\r
-               }\r
-\r
-               public static string GetTargetDir()\r
-               {\r
-                       System.Console.Write("Enter target directory: ");\r
-                       return System.Console.ReadLine();\r
-               }\r
-\r
-               public static void Usage(bool wrong)\r
-               {\r
-                       if(wrong)\r
-                       {\r
-                               System.Console.WriteLine("Wrong # arguments.");\r
-                       }\r
-                       System.Console.WriteLine("Usage: GenerateDelegate [target-dir] [namespace] [delegate1 [delegate2 [...]]]");\r
-               }\r
-\r
-               public static bool IsHelp(string arg)\r
-               {\r
-                       return (arg == "-h" || arg == "--help");\r
-               }\r
-\r
-               public static bool IsDirectory(string dirName)\r
-               {\r
-                       FileAttributes attrs;\r
-                       try\r
-                       {\r
-                               attrs = File.GetAttributes(dirName);\r
-                               if( (attrs & FileAttributes.Directory) != FileAttributes.Directory)\r
-                               {\r
-                                       Usage(true);\r
-                                       return false;\r
-                               }\r
-                       }catch(Exception e)\r
-                       {\r
-                               System.Console.WriteLine("Exception: {0}", e.ToString());\r
-                               return false;\r
-                       }\r
-                       return true;\r
-               }\r
-\r
-               public static void Main(string[] args)\r
-               {\r
-                       if(args.Length == 1 && IsHelp(args[0]))\r
-                       {\r
-                               Usage(false);\r
-                               return;\r
-                       }\r
-\r
-                       if(args.Length == 0)\r
-                       {\r
-                               TargetDirectory = GetTargetDir();\r
-                               while(TargetDirectory.EndsWith("\\"))\r
-                               {\r
-                                       TargetDirectory = TargetDirectory.Substring(0, TargetDirectory.Length - 1);\r
-                               }\r
-                       } else\r
-                       {\r
-                               while(args[0].EndsWith("\\"))\r
-                               {\r
-                                       args[0] = args[0].Substring(0, args[0].Length - 1);\r
-                               }\r
-                               TargetDirectory = args[0];\r
-                       }\r
-\r
-                       if(!IsDirectory(TargetDirectory))\r
-                               return;\r
-\r
-                       if(args.Length > 1)\r
-                       {\r
-                               NamespaceName = args[1];\r
-                       } else\r
-                       {\r
-                               NamespaceName = AskForNamespace();\r
-                       }\r
-\r
-                       if(args.Length > 2)\r
-                       {\r
-                               int i=0;\r
-                               foreach(string currArg in args)\r
-                               {\r
-                                       if(i != 0)\r
-                                       {\r
-                                               Generate(currArg);\r
-                                       }\r
-                                       i++;\r
-                               }\r
-                       }\r
-                       string delegateName = String.Empty;\r
-                       while((delegateName = AskForMore()) != String.Empty)\r
-                       {\r
-                               Generate(delegateName);\r
-                       }\r
-               }\r
-       }\r
-}\r
diff --git a/mcs/tools/misc/IFaceDisco.cs b/mcs/tools/misc/IFaceDisco.cs
deleted file mode 100644 (file)
index 0f8a062..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-// IFaceDisco.cs\r
-//\r
-// Nick Drochak (ndrochak@gol.com)\r
-//\r
-// (C) 2001 Nick Drochak\r
-\r
-using System;\r
-using System.Reflection;\r
-using System.Collections;\r
-using System.IO;\r
-\r
-namespace Mono.Util\r
-{\r
-       class IFaceDisco {\r
-               public static void Main(string[] args) {\r
-                       Assembly                                        asm;\r
-                       Type[]                                          asmTypes;\r
-                       InterfaceMapping                map;\r
-                       Type[]                                          interfaces;\r
-                       ArrayList                                       TypesList                                       = new ArrayList();\r
-                       ArrayList                                       implementingTypes       = new ArrayList();\r
-                       string                                          asmFullPath                             = null;\r
-                       string                                          ifaceToDiscover         = null;\r
-                       \r
-                       if (args.Length < 1 || args.Length > 3) {\r
-                               Usage();\r
-                               return;\r
-                       }\r
-\r
-                       for (int i = 0; i < args.Length; i++) {\r
-                               string arg = args[i];\r
-\r
-                               if (arg.StartsWith("-") && ((i + 1) < args.Length)) {\r
-                                       if (arg == "--asm") {\r
-                                               asmFullPath = args[++i];\r
-                                       } else {\r
-                                               Usage();\r
-                                               return;\r
-                                       }\r
-                               } else {\r
-                                       // allow only one interface to discover\r
-                                       if (ifaceToDiscover != null){\r
-                                               Usage();\r
-                                               return;\r
-                                       }\r
-                                       ifaceToDiscover = arg;\r
-                               }\r
-                       }\r
-\r
-                       // find the assembly\r
-                       if (null == asmFullPath){\r
-                               asm = Assembly.GetAssembly(typeof (System.Object));\r
-                       }\r
-                       else {\r
-                               try{\r
-                                       asm = Assembly.LoadFrom(asmFullPath);\r
-                               }\r
-                               catch(Exception e){\r
-                                       Console.WriteLine("Could not open assembly '{0}' for discovery. Error is: "+e.Message, asmFullPath);\r
-                                       return;\r
-                               }\r
-                       }\r
-                       asmTypes = asm.GetTypes();\r
-\r
-                       // examine all the public types\r
-                       foreach(Type t in asmTypes) {\r
-                               if (t.IsPublic) {\r
-                                       // find out which, if any, interfaces are "in" the type\r
-                                       interfaces= t.GetInterfaces();\r
-                                       if (null != interfaces){\r
-                                               // look for the interface we want to discover\r
-                                               foreach (Type iface in interfaces) {\r
-                                                       // this area seems to throw an exception sometimes, just ignore it\r
-                                                       try{\r
-                                                               if (iface.FullName.ToLower() == args[0].ToLower()) {\r
-                                                                       // find out if this type is the one which "declares" the interface\r
-                                                                       map = t.GetInterfaceMap(iface);\r
-                                                                       if (map.TargetMethods[0].DeclaringType.FullName == t.FullName){\r
-                                                                               // if so, then we found a class to report\r
-                                                                               implementingTypes.Add(t.FullName);\r
-                                                                       } // if\r
-                                                               }  // if\r
-                                                       }catch{}\r
-                                               } // foreach\r
-                                       } // if\r
-                               } // if\r
-                       } // foreach\r
-\r
-                       // sort the list to make it easier to find what you are looking for\r
-                       implementingTypes.Sort();\r
-                       Console.WriteLine(XMLUtil.ToXML(implementingTypes, "Type", "ImplementingTypes"));\r
-               } // Main()\r
-\r
-               private static void Usage() {\r
-                       Console.WriteLine (\r
-                               "Mono Interface Discovery Tool\n" +\r
-                               "usage: ifacedisco [--asm assembly] interface\n\n" +\r
-                               "  The full path to 'assembly' should be specified when using --asm.\n" +\r
-                               "  If 'assembly' is not specified, the assembly that contains System.Object will be used.\n" +\r
-                               "  Use the fully qualified form for 'interface', e.g. System.Runtime.Serialization.ISerializable\n"\r
-                               );\r
-               } // Usage()\r
-\r
-       } // class IFaceDisco\r
-}  // namespace Mono.Util\r
diff --git a/mcs/tools/misc/XMLUtil.cs b/mcs/tools/misc/XMLUtil.cs
deleted file mode 100644 (file)
index 0643472..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// IFaceDisco.cs\r
-//\r
-// Nick Drochak (ndrochak@gol.com)\r
-//\r
-// (C) 2001 Nick Drochak\r
-\r
-using System;\r
-using System.Text;\r
-using System.Collections;\r
-\r
-namespace Mono.Util\r
-{\r
-       class XMLUtil{\r
-               public static string ToXML(\r
-                       ArrayList list, \r
-                       string itemWrap,\r
-                       string listWrap)\r
-               {\r
-                       if (null == itemWrap){\r
-                               throw new ArgumentNullException("itemWrap");\r
-                       }\r
-                       if (null == listWrap){\r
-                               throw new ArgumentNullException("listWrap");\r
-                       }\r
-                       StringBuilder output = new StringBuilder();\r
-                       output.Append("<"+listWrap+">");\r
-                       foreach(object o in list){\r
-                               output.Append("\n<"+itemWrap+">");\r
-                               output.Append(o.ToString());\r
-                               output.Append("</"+itemWrap+">");\r
-                       }\r
-                       output.Append("\n</"+listWrap+">");\r
-                       return output.ToString();\r
-               }\r
-       }\r
-}
\ No newline at end of file
diff --git a/mcs/tools/misc/monostyle.cs b/mcs/tools/misc/monostyle.cs
deleted file mode 100644 (file)
index 845ab93..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-//     monostyle.cs
-//
-//     Adam Treat (manyoso@yahoo.com)
-//     Ben Maurer (bmaurer@users.sf.net)
-//     (C) 2002 Adam Treat
-//     (C) 2003 Ben Maurer
-//
-//     This program is free software; you can redistribute it and/or modify
-//     it under the terms of the GNU General Public License as published by
-//     the Free Software Foundation; either version 2 of the License, or
-//     (at your option) any later version.
-
-using System;
-using System.IO;
-using System.Text.RegularExpressions;
-using System.Collections.Specialized;
-
-namespace Mono.Util {
-
-       class MonoStyle {
-
-               string file;
-               StringCollection filebuffer;
-               bool linespace = true;
-
-               void Usage()
-               {
-                       Console.Write (
-                               "monostyle -f file.cs -l <true|false> > output.cs\n\n" +
-                               "   -f || /-f || --file  file.cs        The csharp source file to parse.\n\n" +
-                               "   -l || /-l || --line  <true|false>   Specifies wether to use line spacing.\n\n");
-               }
-
-               public static void Main (string[] args)
-               {
-                       MonoStyle style = new MonoStyle(args);
-               }
-
-               public MonoStyle (string[] args)
-               {
-                       int argc = args.Length;
-                       for(int i = 0; i < argc; i++) {
-                               string arg = args[i];
-                               // The "/" switch is there for wine users, like me ;-)
-                               if(arg.StartsWith("-") || arg.StartsWith("/")) {
-                                       switch(arg) {
-                                               case "-l": case "/-l": case "--line":
-                                               if((i + 1) >= argc) {
-                                                       Usage();
-                                                       return;
-                                               }
-                                               if (args[i++] == "false") {
-                                                       linespace = false;
-                                               }
-                                               continue;
-                                               case "-f": case "/-f": case "--file":
-                                               if((i + 1) >= argc) {
-                                                       Usage();
-                                                       return;
-                                               }
-                                               file = args[++i];
-                                               continue;
-                                               default:
-                                               Usage();
-                                               return;
-                                       }
-                               }
-                       }
-                       if(file == null) {
-                               Usage();
-                               return;
-                       }
-                       filebuffer = new StringCollection();
-                       StreamReader sr = new StreamReader(file);
-                       FillBuffer(sr);
-                       FixMonoStyle();
-                       PrintToConsole();
-               }
-
-               public void FillBuffer(StreamReader sr)
-               {
-                       sr.BaseStream.Seek(0, SeekOrigin.Begin);
-                       while (sr.Peek() > -1) {
-                               filebuffer.Add(sr.ReadLine());
-                       }
-                       sr.Close();
-               }
-
-               public void FixMonoStyle()
-               {
-                       for (int i=0; i < filebuffer.Count; i++) {
-                               IsBadMonoStyle(filebuffer[i]);
-                       }
-               }
-
-               public void PrintToConsole()
-               {
-                       for (int i=0; i < filebuffer.Count; i++) {
-                               Console.WriteLine(filebuffer[i]);
-                       }
-               }
-
-               public void IsBadMonoStyle(String str)
-               {
-                       if (IsBadMonoType(str)) {
-                               FixHangingBrace(str);
-                       } else if(IsBadMonoFlow(str)) {
-                               FixHangingBrace(str);
-                       } else if(IsBadMonoFunction(str)) {
-                               FixEndBrace(str);
-                       } else if(IsBadMonoProperty(str)) {
-                               FixHangingBrace(str);
-                       } else {
-                       }
-               }
-
-               public void FixHangingBrace(String str)
-               {
-                       int strloc = filebuffer.IndexOf(str);
-                       int brcloc = FindHangingBrace(strloc);
-                       int diff = brcloc - strloc;
-                       if (brcloc > 0) {
-                               for (int i = 0; i < diff+1; i++) {
-                                       filebuffer.RemoveAt(strloc);
-                               }
-                               filebuffer.Insert(strloc, str + " {");
-                               if (linespace) {
-                                       filebuffer.Insert(strloc+1, "");
-                               }
-                       } else {}
-               }
-
-               public int FindHangingBrace(int strloc)
-               {
-                       strloc++;
-                       bool found = false;
-                       while (!found) {
-                               try {
-                                       string str = filebuffer[strloc++];
-                                       found = IsHangingBrace(str);
-                                       if (!found && !IsBlankLine(str)) {
-                                               return -1;
-                                       }
-                               } catch (Exception) {
-                                       return -1;
-                               }
-                       }
-                       return strloc -1;
-               }
-
-               public void FixEndBrace(String str)
-               {
-                       int strloc = filebuffer.IndexOf(str);
-                       filebuffer.RemoveAt(strloc);
-                       filebuffer.Insert(strloc, RemoveEndBrace(str));
-                       filebuffer.Insert(strloc+1, AddHangingBrace(str));
-               }
-
-               public static bool IsBadMonoType(String str)
-               {
-                       if ( IsType(str) && !EndWithBrace(str)) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static bool IsBadMonoFlow(String str)
-               {
-                       if (IsFlow(str) && !EndWithBrace(str)) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static bool IsBadMonoFunction(String str)
-               {
-                       if (IsFunction(str) && EndWithBrace(str)) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static bool IsBadMonoProperty(String str)
-               {
-                       if (IsProperty(str) && !EndWithBrace(str)) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static bool IsType(String str)
-               {
-                       if (    !IsComment(str) && (
-                                       IsNameSpace(str) ||
-                                       IsClass(str) ||
-                                       IsStruct(str) ||
-                                       IsEnum(str) )) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static bool IsFlow(String str)
-               {
-                       if (    !IsComment(str) && (
-                                       IsIf(str) ||
-                                       IsElse(str) ||
-                                       IsElseIf(str) ||
-                                       IsTry(str) ||
-                                       IsCatch(str) ||
-                                       IsFinally(str) ||
-                                       IsFor(str) ||
-                                       IsForEach(str) ||
-                                       IsWhile(str) ||
-                                       IsSwitch(str)
-                                       )) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static bool IsFunction(String str)
-               {
-                       if (    Regex.IsMatch(str, @"^\s*(\w+)\s+(\w+).*\(+") &&
-                                       !IsDeclaration(str) &&
-                                       !IsComment(str) &&
-                                       !IsType(str) &&
-                                       !IsFlow(str) ) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static bool IsProperty(String str)
-               {
-                       if (    Regex.IsMatch(str, @"^\s*(\w+)\s+(\w+).*") &&
-                                       !IsDeclaration(str) &&
-                                       !IsComment(str) &&
-                                       !IsType(str) &&
-                                       !IsFlow(str) &&
-                                       !IsFunction(str) ) {
-                               return true;
-                       } else {
-                               return false;
-                       }
-               }
-
-               public static string RemoveEndBrace(String str)
-               {
-                       Regex rg = new Regex(@"\{\s*$");
-                       return rg.Replace(str, "");
-               }
-
-               public static string AddHangingBrace(String str)
-               {
-                       Regex rg = new Regex(@"\S+\s*");
-                       string blank = rg.Replace(str,"");
-                       return blank + "{";
-               }
-
-               public static bool IsDeclaration(String str)
-               {
-                       return Regex.IsMatch(str, @"\;\s*$");
-               }
-
-               public static bool IsComment(String str)
-               {
-                       return Regex.IsMatch(str, @"^(\s*\/+|\s*\*+|\s*\#+)");
-               }
-
-               public static bool EndWithBrace(String str)
-               {
-                       return Regex.IsMatch(str, @"\{\s*$");
-               }
-
-               public static bool IsHangingBrace(String str)
-               {
-                       return Regex.IsMatch(str, @"^\s*\{");
-               }
-
-               public static bool IsBlankLine(String str)
-               {
-                       return Regex.IsMatch(str, @"^\s*$");
-               }
-
-               public static bool IsNameSpace(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+)namespace\s+");
-               }
-
-               public static bool IsClass(String str)
-               {
-                       return Regex.IsMatch(str, @"\s+class\s+");
-               }
-
-               public static bool IsStruct(String str)
-               {
-                       return Regex.IsMatch(str, @"\s+struct\s+");
-               }
-
-               public static bool IsEnum(String str)
-               {
-                       return Regex.IsMatch(str, @"\s+enum\s+");
-               }
-
-               public static bool IsIf(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)if(\s+|\(+|$)");
-               }
-
-               public static bool IsElse(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)else(\s+|\{+|$)");
-               }
-
-               public static bool IsElseIf(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)else if(\s+|\(+|$)");
-               }
-
-               public static bool IsTry(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)try(\s+|\(+|$)");
-               }
-
-               public static bool IsCatch(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)catch(\s+|\(+|$)");
-               }
-
-               public static bool IsFinally(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)finally(\s+|\{+|$)");
-               }
-
-               public static bool IsFor(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)for(\s+|\(+|$)");
-               }
-
-               public static bool IsForEach(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)foreach(\s+|\(+|$)");
-               }
-
-               public static bool IsWhile(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)while(\s+|\(+|$)");
-               }
-
-               public static bool IsSwitch(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)switch(\s+|\(+|$)");
-               }
-
-               public static bool IsCase(String str)
-               {
-                       return Regex.IsMatch(str, @"(^|\s+|\}+)case(\s+|\(+|$)");
-               }
-       }
-}
diff --git a/mcs/tools/misc/sample_cast_const.cs b/mcs/tools/misc/sample_cast_const.cs
deleted file mode 100644 (file)
index 0496931..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-using System;
-
-class X {
-       static void w (string s)
-       {
-               Console.WriteLine ("\t" + s);
-       }
-       
-       static void Main ()
-       {
-               object [,] names = 
-                       { { "Byte", "byte" },
-                         { "SByte", "sbyte" },
-                         { "Short", "short" },
-                         { "UShort", "ushort" },
-                         { "Int", "int32" },
-                         { "UInt", "uint32" },
-                         { "Long", "int64" },
-                         { "ULong", "uint64" },
-                         { "Float", "float" },
-                         { "Double", "double" },
-                         { null, null }
-                       };
-
-               for (int i = 0; names [i,0] != null; i++){
-                       string big = names [i, 0] + "Constant";
-                       string small = "TypeManager." + names [i, 1] + "_type";
-                       string nat = ((string) names [i,0]).ToLower ();
-                       
-                       w ("\t\tif (expr is " + big + "){");
-                       w ("\t\t\t" + nat + " v = ((" + big + ") expr).Value;");
-                       w ("");
-
-                       for (int j = 0; names [j,0] != null; j++){
-                               string b = names [j, 0] + "Constant";
-                               string s = "TypeManager." + names [j, 1] + "_type";
-                               string n = ((string) names [j,0]).ToLower ();
-
-                               if (i == j)
-                                       continue;
-                               
-                               w ("\t\t\tif (target_type == " + s + ")");
-                               w ("\t\t\t\treturn new " + b + " ((" + n + ") v);");
-                       }
-                       w ("\t\t}");
-               }
-       }
-}
-       
diff --git a/mcs/tools/misc/serialize.cs b/mcs/tools/misc/serialize.cs
deleted file mode 100644 (file)
index 01b83f8..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// Serialize.cs
-//
-// This program creates a SerializationInfo and requests an object
-// to serialize itself.
-//
-// We serialize because we need to know the *exact* names that are
-// used for the values being serialized.
-//
-// Author: Miguel de Icaza
-//        Duncan Mak
-//
-// (C) Ximian, Inc.
-//
-
-using System;
-using System.Collections;
-using System.Globalization;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Formatters.Soap;
-using System.IO;
-
-namespace Mono.Serialize {
-       class Driver {
-               static object StaticCreateObject ()
-               {
-                       //
-                       // Change the object type here.
-                       //
-                       return null;
-               }
-
-               static object LiveCreateObject (Type obj, Type[] types, string[] values)
-               {
-                       if (types.Length != values.Length)
-                               throw new ArgumentException ();
-                       
-                       object[] a = new object [types.Length];
-                       
-                       for (int i = 0; i < a.Length; i++)
-                               a [i] = Convert.ChangeType (values [i], types [i]);
-                       
-                       return Activator.CreateInstance (obj, a);
-               }
-        
-               static void Main (string[] args)
-               {
-                       object x = null;
-                       string strTypes = null;
-                       string argValues = null;
-                       
-                       if (args.Length == 1) {
-                               Type t = Type.GetType (args[0]);
-                               Console.WriteLine ("\nPlease enter the arguments to the constructor for type {0}", t.ToString());
-                               strTypes = Console.ReadLine ();
-                               Console.WriteLine ("\nPlease enter the values");
-                               argValues = Console.ReadLine ();
-                               Type[] types = ToTypeArray (strTypes.Split (','));
-                               string[] param = argValues.Split (',');
-                               
-                               x = LiveCreateObject (t, types, param);
-                       } else {
-                               x = StaticCreateObject ();
-                       }
-                       
-                       string fileName = x.GetType().FullName + ".xml";
-                       Stream output = new FileStream (fileName, FileMode.Create,
-                                                       FileAccess.Write, FileShare.None);
-                       IFormatter formatter = new SoapFormatter ();
-                       
-                       formatter.Serialize ((Stream) output, x);
-                       output.Close ();
-               }
-               
-               public static Type[] ToTypeArray (string[] strTypes)
-               {
-                       Type[] t = new Type [strTypes.Length];
-                       
-                       for (int i = 0; i < strTypes.Length; i++)
-                               t [i] = StringToType (strTypes [i]);
-                       return t;
-               }
-               
-               public static Type StringToType (string s)
-               {
-                       switch (s) {
-                       case "bool":
-                               return typeof (System.Boolean);
-                               break;
-                       case "byte":
-                               return typeof (System.Byte);
-                               break;
-                       case "sbyte":
-                               return typeof (System.SByte);
-                               break;
-                       case "char":
-                               return typeof (System.Char);
-                               break;
-                       case "decimal":
-                               return typeof (System.Decimal);
-                               break;
-                       case "double":
-                               return typeof (System.Double);
-                               break;
-                       case "float":
-                               return typeof (System.Single);
-                               break;
-                       case "int":
-                               return typeof (System.Int32);
-                               break;
-                       case "uint":
-                               return typeof (System.UInt32);
-                               break;
-                       case "long":
-                               return typeof (System.Int64);
-                               break;
-                       case "ulong":
-                               return typeof (System.UInt64);
-                               break;
-                       case "object":
-                               return typeof (System.Object);
-                               break;
-                       case "short":
-                               return typeof (System.Int16);
-                               break;
-                       case "ushort":
-                               return typeof (System.UInt16);
-                               break;
-                       case "string":
-                               return typeof (System.String);
-                               break;
-                       default:
-                               return Type.GetType (s);
-                               break;
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/misc/verifier.cs b/mcs/tools/misc/verifier.cs
deleted file mode 100644 (file)
index 2526814..0000000
+++ /dev/null
@@ -1,1587 +0,0 @@
-//
-// verifier.cs: compares two assemblies and reports differences.
-//
-// Author:
-//   Sergey Chaban (serge@wildwestsoftware.com)
-//
-// (C) Sergey Chaban (serge@wildwestsoftware.com)
-//
-
-using System;
-using System.IO;
-using System.Collections;
-using System.Reflection;
-
-namespace Mono.Verifier {
-
-
-
-       ////////////////////////////////
-       // Collections
-       ////////////////////////////////
-
-       public abstract class MemberCollection : IEnumerable {
-
-               public delegate MemberInfo [] InfoQuery (Type type, BindingFlags bindings);
-               public delegate bool MemberComparer (MemberInfo mi1, MemberInfo mi2);
-
-               protected SortedList list;
-               protected MemberComparer comparer;
-
-               protected BindingFlags bindings;
-
-               protected MemberCollection (Type type, InfoQuery query, MemberComparer comparer, BindingFlags bindings)
-               {
-                       if (query == null)
-                               throw new NullReferenceException ("Invalid query delegate.");
-
-                       if (comparer == null)
-                               throw new NullReferenceException ("Invalid comparer.");
-
-                       this.comparer = comparer;
-                       this.bindings = bindings;
-
-                       this.list = new SortedList ();
-
-                       MemberInfo [] data = query (type, bindings);
-                       foreach (MemberInfo info in data) {
-                               this.list [info.Name] = info;
-                       }
-               }
-
-
-
-               public MemberInfo this [string name] {
-                       get {
-                               return list [name] as MemberInfo;
-                       }
-               }
-
-
-               public override int GetHashCode ()
-               {
-                       return list.GetHashCode ();
-               }
-
-
-               public override bool Equals (object o)
-               {
-                       bool res = (o is MemberCollection);
-                       if (res) {
-                               MemberCollection another = o as MemberCollection;
-                               IEnumerator it = GetEnumerator ();
-                               while (it.MoveNext () && res) {
-                                       MemberInfo inf1 = it.Current as MemberInfo;
-                                       MemberInfo inf2 = another [inf1.Name];
-                                       res &= comparer (inf1, inf2);
-                               }
-                       }
-                       return res;
-               }
-
-
-
-               public static bool operator == (MemberCollection c1, MemberCollection c2)
-               {
-                       return c1.Equals (c2);
-               }
-
-               public static bool operator != (MemberCollection c1, MemberCollection c2)
-               {
-                       return !(c1 == c2);
-               }
-
-
-
-               public IEnumerator GetEnumerator()
-               {
-                       return new Iterator (this);
-               }
-
-
-               internal class Iterator : IEnumerator  {
-                       private MemberCollection host;
-                       private int pos;
-
-                       internal Iterator (MemberCollection host)
-                       {
-                               this.host=host;
-                               this.Reset ();
-                       }
-
-                       /// <summary></summary>
-                       public object Current
-                       {
-                               get {
-                                       if (host != null && pos >=0 && pos < host.list.Count) {
-                                               return host.list.GetByIndex (pos);
-                                       } else {
-                                               return null;
-                                       }
-                               }
-                       }
-
-                       /// <summary></summary>
-                       public bool MoveNext ()
-                       {
-                               if (host!=null) {
-                                       return (++pos) < host.list.Count;
-                               } else {
-                                       return false;
-                               }
-                       }
-
-                       /// <summary></summary>
-                       public void Reset ()
-                       {
-                               this.pos = -1;
-                       }
-               }
-
-       }
-
-
-
-
-       //--- Method collections
-
-       /// <summary>
-       /// Abstract collection of class' methods.
-       /// </summary>
-       public abstract class MethodCollectionBase : MemberCollection {
-
-
-               protected MethodCollectionBase (Type type, BindingFlags bindings)
-                      : base (type, new InfoQuery (Query), new MemberComparer (Comparer), bindings)
-               {
-               }
-
-
-               private static MemberInfo [] Query (Type type, BindingFlags bindings)
-               {
-                       // returns MethodInfo []
-                       return type.GetMethods (bindings);
-               }
-
-               private static bool Comparer (MemberInfo mi1, MemberInfo mi2)
-               {
-                       bool res = false;
-                       if (mi1 is MethodInfo && (mi2 == null || mi2 is MethodInfo)) {
-                               MethodInfo inf1 = mi1 as MethodInfo;
-                               MethodInfo inf2 = mi2 as MethodInfo;
-                               res = Compare.Methods (inf1, inf2);
-                       } else {
-                               Verifier.log.Write ("internal-error", "Wrong comparer arguments.", ImportanceLevel.HIGH);
-                       }
-                       return res;
-               }
-       }
-
-
-
-       /// <summary>
-       /// Collection of public instance methods of a class.
-       /// </summary>
-       public class PublicMethods : MethodCollectionBase {
-
-               public PublicMethods (Type type)
-                      : base (type, BindingFlags.Public | BindingFlags.Instance)
-               {
-               }
-       }
-
-       /// <summary>
-       /// Collection of public static methods of a class.
-       /// </summary>
-       public class PublicStaticMethods : MethodCollectionBase {
-
-               public PublicStaticMethods (Type type)
-                      : base (type, BindingFlags.Public | BindingFlags.Static)
-               {
-               }
-       }
-
-       /// <summary>
-       /// Collection of non-public instance methods of a class.
-       /// </summary>
-       public class NonPublicMethods : MethodCollectionBase {
-
-               public NonPublicMethods (Type type)
-                      : base (type, BindingFlags.NonPublic | BindingFlags.Instance)
-               {
-               }
-       }
-
-       /// <summary>
-       /// Collection of non-public static methods of a class.
-       /// </summary>
-       public class NonPublicStaticMethods : MethodCollectionBase {
-
-               public NonPublicStaticMethods (Type type)
-                      : base (type, BindingFlags.NonPublic | BindingFlags.Static)
-               {
-               }
-       }
-
-
-
-
-
-       //--- Field collections
-
-       public abstract class FieldCollectionBase : MemberCollection {
-
-
-               protected FieldCollectionBase (Type type, BindingFlags bindings)
-                      : base (type, new InfoQuery (Query), new MemberComparer (Comparer), bindings)
-               {
-               }
-
-
-               private static MemberInfo [] Query (Type type, BindingFlags bindings)
-               {
-                       // returns FieldInfo []
-                       return type.GetFields (bindings);
-               }
-
-               private static bool Comparer (MemberInfo mi1, MemberInfo mi2)
-               {
-                       bool res = false;
-                       if (mi1 is FieldInfo && (mi2 == null || mi2 is FieldInfo)) {
-                               FieldInfo inf1 = mi1 as FieldInfo;
-                               FieldInfo inf2 = mi2 as FieldInfo;
-                               res = Compare.Fields (inf1, inf2);
-                       } else {
-                               Verifier.log.Write ("internal-error", "Wrong comparer arguments.", ImportanceLevel.HIGH);
-                       }
-                       return res;
-               }
-       }
-
-
-       public class PublicFields : FieldCollectionBase {
-
-               public PublicFields (Type type)
-                      : base (type, BindingFlags.Public | BindingFlags.Instance)
-               {
-               }
-       }
-
-       public class PublicStaticFields : FieldCollectionBase {
-
-               public PublicStaticFields (Type type)
-                      : base (type, BindingFlags.Public | BindingFlags.Static)
-               {
-               }
-       }
-
-       public class NonPublicFields : FieldCollectionBase {
-
-               public NonPublicFields (Type type)
-                      : base (type, BindingFlags.NonPublic | BindingFlags.Instance)
-               {
-               }
-       }
-
-       public class NonPublicStaticFields : FieldCollectionBase {
-
-               public NonPublicStaticFields (Type type)
-                      : base (type, BindingFlags.NonPublic | BindingFlags.Static)
-               {
-               }
-       }
-
-
-
-
-
-       public abstract class AbstractTypeStuff {
-               public readonly Type type;
-
-               public AbstractTypeStuff (Type type)
-               {
-                       if (type == null)
-                               throw new NullReferenceException ("Invalid type.");
-
-                       this.type = type;
-               }
-
-               public override int GetHashCode ()
-               {
-                       return type.GetHashCode ();
-               }
-
-               public static bool operator == (AbstractTypeStuff t1, AbstractTypeStuff t2)
-               {
-                       if ((t1 as object) == null) {
-                               if ((t2 as object) == null) return true;
-                               return false;
-                       }
-                       return t1.Equals (t2);
-               }
-
-               public static bool operator != (AbstractTypeStuff t1, AbstractTypeStuff t2)
-               {
-                       return !(t1 == t2);
-               }
-
-               public override bool Equals (object o)
-               {
-                       return (o is AbstractTypeStuff && CompareTypes (o as AbstractTypeStuff));
-               }
-
-               protected virtual bool CompareTypes (AbstractTypeStuff that)
-               {
-                       Verifier.Log.Write ("info", "Comparing types.", ImportanceLevel.LOW);
-                       bool res;
-
-                       res = Compare.Types (this.type, that.type);
-
-                       return res;
-               }
-
-       }
-
-
-
-
-       /// <summary>
-       ///  Represents a class.
-       /// </summary>
-       public class ClassStuff : AbstractTypeStuff {
-
-               public PublicMethods publicMethods;
-               public PublicStaticMethods publicStaticMethods;
-               public NonPublicMethods nonpublicMethods;
-               public NonPublicStaticMethods nonpublicStaticMethods;
-
-               public PublicFields publicFields;
-               public PublicStaticFields publicStaticFields;
-               public NonPublicFields nonpublicFields;
-               public NonPublicStaticFields nonpublicStaticFields;
-
-               public ClassStuff (Type type) : base (type)
-               {
-                       publicMethods = new PublicMethods (type);
-                       publicStaticMethods = new PublicStaticMethods (type);
-                       nonpublicMethods = new NonPublicMethods (type);
-                       nonpublicStaticMethods = new NonPublicStaticMethods (type);
-
-                       publicFields = new PublicFields (type);
-                       publicStaticFields = new PublicStaticFields (type);
-                       nonpublicFields = new NonPublicFields (type);
-                       nonpublicStaticFields = new NonPublicStaticFields (type);
-               }
-
-
-               public override int GetHashCode ()
-               {
-                       return base.GetHashCode ();
-               }
-
-               private bool CompareMethods (ClassStuff that)
-               {
-                       bool res = true;
-                       bool ok;
-
-                       Verifier.Log.Write ("info", "Comparing public instance methods.", ImportanceLevel.LOW);
-                       ok = (this.publicMethods == that.publicMethods);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       Verifier.Log.Write ("info", "Comparing public static methods.", ImportanceLevel.LOW);
-                       ok = (this.publicStaticMethods == that.publicStaticMethods);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       Verifier.Log.Write ("info", "Comparing non-public instance methods.", ImportanceLevel.LOW);
-                       ok = (this.nonpublicMethods == that.nonpublicMethods);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       Verifier.Log.Write ("info", "Comparing non-public static methods.", ImportanceLevel.LOW);
-                       ok = (this.nonpublicStaticMethods == that.nonpublicStaticMethods);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       return res;
-               }
-
-
-               private bool CompareFields (ClassStuff that)
-               {
-                       bool res = true;
-                       bool ok;
-
-                       Verifier.Log.Write ("info", "Comparing public instance fields.", ImportanceLevel.LOW);
-                       ok = (this.publicFields == that.publicFields);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       Verifier.Log.Write ("info", "Comparing public static fields.", ImportanceLevel.LOW);
-                       ok = (this.publicStaticFields == that.publicStaticFields);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       Verifier.Log.Write ("info", "Comparing non-public instance fields.", ImportanceLevel.LOW);
-                       ok = (this.nonpublicFields == that.nonpublicFields);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       Verifier.Log.Write ("info", "Comparing non-public static fields.", ImportanceLevel.LOW);
-                       ok = (this.nonpublicStaticFields == that.nonpublicStaticFields);
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-                       return res;
-               }
-
-
-               public override bool Equals (object o)
-               {
-                       bool res = (o is ClassStuff);
-                       if (res) {
-                               ClassStuff that = o as ClassStuff;
-
-                               res &= this.CompareTypes (that);
-                               if (!res && Verifier.stopOnError) return res;
-
-                               res &= this.CompareMethods (that);
-                               if (!res && Verifier.stopOnError) return res;
-
-                               res &= this.CompareFields (that);
-                               if (!res && Verifier.stopOnError) return res;
-
-                       }
-                       return res;
-               }
-
-       }
-
-
-
-       /// <summary>
-       ///  Represents an interface.
-       /// </summary>
-       public class InterfaceStuff : AbstractTypeStuff {
-
-               public PublicMethods publicMethods;
-
-               public InterfaceStuff (Type type) : base (type)
-               {
-                       publicMethods = new PublicMethods (type);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return base.GetHashCode ();
-               }
-
-               public override bool Equals (object o)
-               {
-                       bool res = (o is InterfaceStuff);
-                       if (res) {
-                               bool ok;
-                               InterfaceStuff that = o as InterfaceStuff;
-
-                               res = this.CompareTypes (that);
-                               if (!res && Verifier.stopOnError) return res;
-
-                               Verifier.Log.Write ("info", "Comparing interface methods.", ImportanceLevel.LOW);
-                               ok = (this.publicMethods == that.publicMethods);
-                               res &= ok;
-                               if (!ok && Verifier.stopOnError) return res;
-                       }
-                       return res;
-               }
-
-       }
-
-
-
-       /// <summary>
-       ///  Represents an enumeration.
-       /// </summary>
-       public class EnumStuff : AbstractTypeStuff {
-
-               //public FieldInfo [] members;
-
-               public string baseType;
-               public Hashtable enumTable;
-               public bool isFlags;
-
-               public EnumStuff (Type type) : base (type)
-               {
-                       //members = type.GetFields (BindingFlags.Public | BindingFlags.Static);
-
-                       Array values = Enum.GetValues (type);
-                       Array names = Enum.GetNames (type);
-
-                       baseType = Enum.GetUnderlyingType (type).Name;
-
-                       enumTable = new Hashtable ();
-
-                       object [] attrs = type.GetCustomAttributes (false);
-                       isFlags = (attrs != null && attrs.Length > 0);
-                       if (isFlags) {
-                               foreach (object attr in attrs) {
-                                       isFlags |= (attr is FlagsAttribute);
-                               }
-                       }
-
-                       int indx = 0;
-                       foreach (string id in names) {
-                               enumTable [id] = Convert.ToInt64(values.GetValue(indx) as Enum);
-                               ++indx;
-                       }
-               }
-
-               public override int GetHashCode ()
-               {
-                       return base.GetHashCode ();
-               }
-
-               public override bool Equals (object o)
-               {
-                       bool res = (o is EnumStuff);
-                       bool ok;
-
-                       if (res) {
-                               EnumStuff that = o as EnumStuff;
-                               ok = this.CompareTypes (that);
-                               res &= ok;
-                               if (!ok && Verifier.stopOnError) return res;
-
-                               ok = (this.baseType == that.baseType);
-                               res &= ok;
-                               if (!ok) {
-                                       Verifier.log.Write ("error",
-                                               String.Format ("Underlying types mismatch [{0}, {1}].", this.baseType, that.baseType),
-                                               ImportanceLevel.MEDIUM);
-                                       if (Verifier.stopOnError) return res;
-                               }
-
-                               Verifier.Log.Write ("info", "Comparing [Flags] attribute.");
-                               ok = !(this.isFlags ^ that.isFlags);
-                               res &= ok;
-                               if (!ok) {
-                                       Verifier.log.Write ("error",
-                                               String.Format ("[Flags] attribute mismatch ({0} : {1}).", this.isFlags ? "Yes" : "No", that.isFlags ? "Yes" : "No"),
-                                           ImportanceLevel.MEDIUM);
-                                       if (Verifier.stopOnError) return res;
-                               }
-
-                               Verifier.Log.Write ("info", "Comparing enum values.");
-
-                               ICollection names = enumTable.Keys;
-                               foreach (string id in names) {
-                                       ok = that.enumTable.ContainsKey (id);
-                                       res &= ok;
-                                       if (!ok) {
-                                               Verifier.log.Write ("error", String.Format("{0} absent in enumeration.", id),
-                                                       ImportanceLevel.MEDIUM);
-                                               if (Verifier.stopOnError) return res;
-                                       }
-
-                                       if (ok) {
-                                               long val1 = (long) this.enumTable [id];
-                                               long val2 = (long) that.enumTable [id];
-                                               ok = (val1 == val2);
-                                               res &= ok;
-                                               if (!ok) {
-                                                       Verifier.log.Write ("error",
-                                                               String.Format ("Enum values mismatch [{0}: {1} != {2}].", id, val1, val2),
-                                                               ImportanceLevel.MEDIUM);
-                                                       if (Verifier.stopOnError) return res;
-                                               }
-                                       }
-                               }
-                       }
-                       return res;
-               }
-       }
-
-
-
-       public sealed class TypeArray {
-               public static readonly TypeArray empty = new TypeArray (Type.EmptyTypes);
-
-               public Type [] types;
-
-               public TypeArray (Type [] types)
-               {
-                       this.types = new Type [types.Length];
-                       for (int i = 0; i < types.Length; i++) {
-                               this.types.SetValue (types.GetValue (i), i);
-                       }
-               }
-       }
-
-
-
-       public class AssemblyLoader {
-               public delegate void Hook (TypeArray assemblyTypes);
-
-               private static Hashtable cache;
-
-               private Hook hook;
-
-               static AssemblyLoader ()
-               {
-                       cache = new Hashtable (11);
-               }
-
-               public AssemblyLoader (Hook hook)
-               {
-                       if (hook == null)
-                               throw new NullReferenceException ("Invalid loader hook.");
-
-                       this.hook = hook;
-               }
-
-
-               public bool LoadFrom (string assemblyName)
-               {
-                       bool res = false;
-                       try {
-                               TypeArray types = TypeArray.empty;
-
-                               lock (cache) {
-                                       if (cache.Contains (assemblyName)) {
-                                               types = (cache [assemblyName] as TypeArray);
-                                               if (types == null) types = TypeArray.empty;
-                                       } else {
-                                               Assembly asm = Assembly.LoadFrom (assemblyName);
-                                               Type [] allTypes = asm.GetTypes ();
-                                               if (allTypes == null) allTypes = Type.EmptyTypes;
-                                               types = new TypeArray (allTypes);
-                                               cache [assemblyName] = types;
-                                       }
-                               }
-                               hook (types);
-                               res = true;
-                       } catch (ReflectionTypeLoadException rtle) {
-                               // FIXME: Should we try to recover? Use loaded portion of types.
-                               Type [] loaded = rtle.Types;
-                               for (int i = 0, xCnt = 0; i < loaded.Length; i++) {
-                                       if (loaded [i] == null) {
-                                               Verifier.log.Write ("fatal error",
-                                                   String.Format ("Unable to load {0}, reason - {1}", loaded [i], rtle.LoaderExceptions [xCnt++]),
-                                                   ImportanceLevel.LOW);
-                                       }
-                               }
-                       } catch (FileNotFoundException fnfe) {
-                                       Verifier.log.Write ("fatal error", fnfe.ToString (), ImportanceLevel.LOW);
-                       } catch (Exception x) {
-                                       Verifier.log.Write ("fatal error", x.ToString (), ImportanceLevel.LOW);
-                       }
-
-                       return res;
-               }
-
-       }
-
-
-
-
-       public abstract class AbstractTypeCollection : SortedList {
-
-               private AssemblyLoader loader;
-
-               public AbstractTypeCollection ()
-               {
-                       loader = new AssemblyLoader (new AssemblyLoader.Hook (LoaderHook));
-               }
-
-               public AbstractTypeCollection (string assemblyName) : this ()
-               {
-                       LoadFrom (assemblyName);
-               }
-
-               public abstract void LoaderHook (TypeArray types);
-
-
-               public bool LoadFrom (string assemblyName)
-               {
-                       return loader.LoadFrom (assemblyName);
-               }
-
-       }
-
-
-
-       public class ClassCollection : AbstractTypeCollection {
-
-               public ClassCollection () : base ()
-               {
-               }
-
-               public ClassCollection (string assemblyName)
-               : base (assemblyName)
-               {
-               }
-
-
-               public override void LoaderHook (TypeArray types)
-               {
-                       foreach (Type type in types.types) {
-                               if (type.IsClass) {
-                                       this [type.FullName] = new ClassStuff (type);
-                               }
-                       }
-               }
-
-       }
-
-
-       public class InterfaceCollection : AbstractTypeCollection {
-
-               public InterfaceCollection () : base ()
-               {
-               }
-
-               public InterfaceCollection (string assemblyName)
-               : base (assemblyName)
-               {
-               }
-
-
-               public override void LoaderHook (TypeArray types)
-               {
-                       foreach (Type type in types.types) {
-                               if (type.IsInterface) {
-                                       this [type.FullName] = new InterfaceStuff (type);
-                               }
-                       }
-               }
-
-       }
-
-
-
-       public class EnumCollection : AbstractTypeCollection {
-
-               public EnumCollection () : base ()
-               {
-               }
-
-               public EnumCollection (string assemblyName)
-               : base (assemblyName)
-               {
-               }
-
-               public override void LoaderHook (TypeArray types)
-               {
-                       foreach (Type type in types.types) {
-                               if (type.IsEnum) {
-                                       this [type.FullName] = new EnumStuff (type);
-                               }
-                       }
-               }
-       }
-
-
-
-       public class AssemblyStuff {
-
-               public string name;
-               public bool valid;
-
-               public ClassCollection classes;
-               public InterfaceCollection interfaces;
-               public EnumCollection enums;
-
-
-               protected delegate bool Comparer (AssemblyStuff asm1, AssemblyStuff asm2);
-               private static ArrayList comparers;
-
-               static AssemblyStuff ()
-               {
-                       comparers = new ArrayList ();
-                       comparers.Add (new Comparer (CompareNumClasses));
-                       comparers.Add (new Comparer (CompareNumInterfaces));
-                       comparers.Add (new Comparer (CompareClasses));
-                       comparers.Add (new Comparer (CompareInterfaces));
-                       comparers.Add (new Comparer (CompareEnums));
-               }
-
-               protected static bool CompareNumClasses (AssemblyStuff asm1, AssemblyStuff asm2)
-               {
-                       bool res = (asm1.classes.Count == asm2.classes.Count);
-                       if (!res) Verifier.Log.Write ("error", "Number of classes mismatch.", ImportanceLevel.MEDIUM);
-                       return res;
-               }
-
-               protected static bool CompareNumInterfaces (AssemblyStuff asm1, AssemblyStuff asm2)
-               {
-                       bool res = (asm1.interfaces.Count == asm2.interfaces.Count);
-                       if (!res) Verifier.Log.Write ("error", "Number of interfaces mismatch.", ImportanceLevel.MEDIUM);
-                       return res;
-               }
-
-
-               protected static bool CompareClasses (AssemblyStuff asm1, AssemblyStuff asm2)
-               {
-                       bool res = true;
-                       Verifier.Log.Write ("info", "Comparing classes.");
-
-                       foreach (DictionaryEntry c in asm1.classes) {
-                               string className = c.Key as string;
-
-                               if (Verifier.Excluded.Contains (className)) {
-                                       Verifier.Log.Write ("info", String.Format ("Ignoring class {0}.", className), ImportanceLevel.MEDIUM);
-                                       continue;
-                               }
-
-                               Verifier.Log.Write ("class", className);
-
-                               ClassStuff class1 = c.Value as ClassStuff;
-                               ClassStuff class2 = asm2.classes [className] as ClassStuff;
-
-                               if (class2 == null) {
-                                       Verifier.Log.Write ("error", String.Format ("There is no such class in {0}", asm2.name));
-                                       res = false;
-                                       if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
-                                       continue;
-                               }
-
-                               res &= (class1 == class2);
-                               if (!res && Verifier.stopOnError) return res;
-                       }
-
-                       return res;
-               }
-
-
-               protected static bool CompareInterfaces (AssemblyStuff asm1, AssemblyStuff asm2)
-               {
-                       bool res = true;
-                       Verifier.Log.Write ("info", "Comparing interfaces.");
-
-                       foreach (DictionaryEntry ifc in asm1.interfaces) {
-                               string ifcName = ifc.Key as string;
-                               Verifier.Log.Write ("interface", ifcName);
-
-                               InterfaceStuff ifc1 = ifc.Value as InterfaceStuff;
-                               InterfaceStuff ifc2 = asm2.interfaces [ifcName] as InterfaceStuff;
-
-                               if (ifc2 == null) {
-                                       Verifier.Log.Write ("error", String.Format ("There is no such interface in {0}", asm2.name));
-                                       res = false;
-                                       if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
-                                       continue;
-                               }
-
-                               res &= (ifc1 == ifc2);
-                               if (!res && Verifier.stopOnError) return res;
-
-                       }
-
-                       return res;
-               }
-
-
-               protected static bool CompareEnums (AssemblyStuff asm1, AssemblyStuff asm2)
-               {
-                       bool res = true;
-                       Verifier.Log.Write ("info", "Comparing enums.");
-
-                       foreach (DictionaryEntry e in asm1.enums) {
-                               string enumName = e.Key as string;
-                               Verifier.Log.Write ("enum", enumName);
-
-                               EnumStuff e1 = e.Value as EnumStuff;
-                               EnumStuff e2 = asm2.enums [enumName] as EnumStuff;
-
-                               if (e2 == null) {
-                                       Verifier.Log.Write ("error", String.Format ("There is no such enum in {0}", asm2.name));
-                                       res = false;
-                                       if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
-                                       continue;
-                               }
-                               res &= (e1 == e2);
-                               if (!res && Verifier.stopOnError) return res;
-                       }
-
-                       return res;
-               }
-
-
-
-               public AssemblyStuff (string assemblyName)
-               {
-                       this.name = assemblyName;
-                       valid = false;
-               }
-
-               public bool Load ()
-               {
-                       bool res = true;
-                       bool ok;
-
-                       classes = new ClassCollection ();
-                       ok = classes.LoadFrom (name);
-                       res &= ok;
-                       if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load classes from {0}.", name), ImportanceLevel.HIGH);
-
-                       interfaces = new InterfaceCollection ();
-                       ok = interfaces.LoadFrom (name);
-                       res &= ok;
-                       if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load interfaces from {0}.", name), ImportanceLevel.HIGH);
-
-                       enums = new EnumCollection ();
-                       ok = enums.LoadFrom (name);
-                       res &= ok;
-                       if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load enums from {0}.", name), ImportanceLevel.HIGH);
-
-                       valid = res;
-                       return res;
-               }
-
-
-               public override bool Equals (object o)
-               {
-                       bool res = (o is AssemblyStuff);
-                       if (res) {
-                               AssemblyStuff that = o as AssemblyStuff;
-                               IEnumerator it = comparers.GetEnumerator ();
-                               while ((res || !Verifier.stopOnError) && it.MoveNext ()) {
-                                       Comparer compare = it.Current as Comparer;
-                                       res &= compare (this, that);
-                               }
-                       }
-                       return res;
-               }
-
-
-               public static bool operator == (AssemblyStuff asm1, AssemblyStuff asm2)
-               {
-                       return asm1.Equals (asm2);
-               }
-
-               public static bool operator != (AssemblyStuff asm1, AssemblyStuff asm2)
-               {
-                       return !(asm1 == asm2);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return classes.GetHashCode () ^ interfaces.GetHashCode ();
-               }
-
-
-               public override string ToString ()
-               {
-                       string res;
-                       if (valid) {
-                               res = String.Format ("Asssembly {0}, valid, {1} classes, {2} interfaces, {3} enums.",
-                                            name, classes.Count, interfaces.Count, enums.Count);
-                       } else {
-                               res = String.Format ("Asssembly {0}, invalid.", name);
-                       }
-                       return res;
-               }
-
-       }
-
-
-
-
-       ////////////////////////////////
-       // Compare
-       ////////////////////////////////
-
-       public sealed class Compare {
-
-               private Compare ()
-               {
-               }
-
-
-               public static bool Parameters (ParameterInfo[] params1, ParameterInfo[] params2)
-               {
-                       bool res = true;
-                       if (params1.Length != params2.Length) {
-                               Verifier.Log.Write ("Parameter count mismatch.");
-                               return false;
-                       }
-
-                       int count = params1.Length;
-
-                       for (int i = 0; i < count && res; i++) {
-                               if (params1 [i].Name != params2 [i].Name) {
-                                       Verifier.Log.Write ("error", String.Format ("Parameters names mismatch {0}, {1}.", params1 [i].Name, params2 [i].Name));
-                                       res = false;
-                                       if (Verifier.stopOnError) break;
-                               }
-
-                               Verifier.Log.Write ("parameter", params1 [i].Name);
-
-                               if (!Compare.Types (params1 [i].ParameterType, params2 [i].ParameterType)) {
-                                       Verifier.Log.Write ("error", String.Format ("Parameters types mismatch {0}, {1}.", params1 [i].ParameterType, params2 [i].ParameterType));
-                                       res = false;
-                                       if (Verifier.stopOnError) break;
-                               }
-
-
-                               if (Verifier.checkOptionalFlags) {
-                                       if (params1 [i].IsIn != params2 [i].IsIn) {
-                                               Verifier.Log.Write ("error", "[in] mismatch.");
-                                               res = false;
-                                               if (Verifier.stopOnError) break;
-                                       }
-
-                                       if (params1 [i].IsOut != params2 [i].IsOut) {
-                                               Verifier.Log.Write ("error", "[out] mismatch.");
-                                               res = false;
-                                               if (Verifier.stopOnError) break;
-                                       }
-
-                                       if (params1 [i].IsRetval != params2 [i].IsRetval) {
-                                               Verifier.Log.Write ("error", "[ref] mismatch.");
-                                               res = false;
-                                               if (Verifier.stopOnError) break;
-                                       }
-
-                                       if (params1 [i].IsOptional != params2 [i].IsOptional) {
-                                               Verifier.Log.Write ("error", "Optional flag mismatch.");
-                                               res = false;
-                                               if (Verifier.stopOnError) break;
-                                       }
-
-                               } // checkOptionalFlags
-
-
-                       }
-
-                       return res;
-               }
-
-
-
-               public static bool Methods (MethodInfo mi1, MethodInfo mi2)
-               {
-                       
-                       if (mi2 == null) {
-                               Verifier.Log.Write ("error", String.Format ("There is no such method {0}.", mi1.Name), ImportanceLevel.MEDIUM);
-                               return false;
-                       }
-
-
-                       Verifier.Log.Flush ();
-                       Verifier.Log.Write ("method", String.Format ("{0}.", mi1.Name));
-                       bool res = true;
-                       bool ok;
-                       string expected;
-
-                       ok = Compare.Types (mi1.ReturnType, mi2.ReturnType);
-                       res &= ok;
-                       if (!ok) {
-                               Verifier.Log.Write ("error", "Return types mismatch.", ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-
-
-
-                       ok = (mi1.IsAbstract == mi2.IsAbstract);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (mi1.IsAbstract) ? "abstract" : "non-abstract";
-                               Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       ok = (mi1.IsVirtual == mi2.IsVirtual);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (mi1.IsVirtual) ? "virtual" : "non-virtual";
-                               Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       ok = (mi1.IsFinal == mi2.IsFinal);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (mi1.IsFinal) ? "final" : "overridable";
-                               Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-
-
-                       // compare access modifiers
-
-                       ok = (mi1.IsPrivate == mi2.IsPrivate);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (mi1.IsPublic) ? "public" : "private";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-
-                       ok = (mi1.IsFamily == mi2.IsFamily);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (mi1.IsFamily) ? "protected" : "!protected";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       ok = (mi1.IsAssembly == mi2.IsAssembly);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (mi1.IsAssembly) ? "internal" : "!internal";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-
-                       ok = (mi1.IsStatic == mi2.IsStatic);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (mi1.IsStatic) ? "static" : "instance";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-
-
-                       // parameters
-
-                       ok = Compare.Parameters (mi1.GetParameters (), mi2.GetParameters ());
-                       res &= ok;
-                       if (!ok && Verifier.stopOnError) return res;
-
-
-                       ok = (mi1.CallingConvention == mi2.CallingConvention);
-                       res &= ok;
-                       if (!ok) {
-                               Verifier.Log.Write ("error", "Calling conventions mismatch.", ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-
-
-
-                       return res;
-               }
-
-
-               public static bool Fields (FieldInfo fi1, FieldInfo fi2)
-               {
-                       if (fi2 == null) {
-                               Verifier.Log.Write ("error", String.Format ("There is no such field {0}.", fi1.Name), ImportanceLevel.MEDIUM);
-                               return false;
-                       }
-
-                       bool res = true;
-                       bool ok;
-                       string expected;
-
-                       Verifier.Log.Write ("field", String.Format ("{0}.", fi1.Name));
-
-                       ok = (fi1.IsPrivate == fi2.IsPrivate);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (fi1.IsPublic) ? "public" : "private";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       ok = (fi1.IsFamily == fi2.IsFamily);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (fi1.IsFamily) ? "protected" : "!protected";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       ok = (fi1.IsAssembly == fi2.IsAssembly);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (fi1.IsAssembly) ? "internal" : "!internal";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       ok = (fi1.IsInitOnly == fi2.IsInitOnly);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (fi1.IsInitOnly) ? "readonly" : "!readonly";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       ok = (fi1.IsStatic == fi2.IsStatic);
-                       res &= ok;
-                       if (!ok) {
-                               expected = (fi1.IsStatic) ? "static" : "instance";
-                               Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
-                               if (Verifier.stopOnError) return res;
-                       }
-
-                       return res;
-               }
-
-
-
-               public static bool Types (Type type1, Type type2)
-               {
-                       // NOTE:
-                       // simply calling type1.Equals (type2) won't work,
-                       // types are in different assemblies hence they have
-                       // different (fully-qualified) names.
-                       int eqFlags = 0;
-                       eqFlags |= (type1.IsAbstract  == type2.IsAbstract)  ? 0 : 0x001;
-                       eqFlags |= (type1.IsClass     == type2.IsClass)     ? 0 : 0x002;
-                       eqFlags |= (type1.IsValueType == type2.IsValueType) ? 0 : 0x004;
-                       eqFlags |= (type1.IsPublic    == type2.IsPublic)    ? 0 : 0x008;
-                       eqFlags |= (type1.IsSealed    == type2.IsSealed)    ? 0 : 0x010;
-                       eqFlags |= (type1.IsEnum      == type2.IsEnum)      ? 0 : 0x020;
-                       eqFlags |= (type1.IsPointer   == type2.IsPointer)   ? 0 : 0x040;
-                       eqFlags |= (type1.IsPrimitive == type2.IsPrimitive) ? 0 : 0x080;
-                       bool res = (eqFlags == 0);
-
-                       if (!res) {
-                               // TODO: convert flags into descriptive message.
-                               Verifier.Log.Write ("error", "Types mismatch (0x" + eqFlags.ToString("X") + ").", ImportanceLevel.HIGH);
-                       }
-
-
-                       bool ok;
-
-                       ok = (type1.Attributes & TypeAttributes.BeforeFieldInit) ==
-                            (type2.Attributes & TypeAttributes.BeforeFieldInit);
-                       if (!ok) {
-                               Verifier.Log.Write ("error", "Types attributes mismatch: BeforeFieldInit.", ImportanceLevel.HIGH);
-                       }
-                       res &= ok;
-
-                       ok = (type1.Attributes & TypeAttributes.ExplicitLayout) ==
-                            (type2.Attributes & TypeAttributes.ExplicitLayout);
-                       if (!ok) {
-                               Verifier.Log.Write ("error", "Types attributes mismatch: ExplicitLayout.", ImportanceLevel.HIGH);
-                       }
-                       res &= ok;
-
-                       ok = (type1.Attributes & TypeAttributes.SequentialLayout) ==
-                            (type2.Attributes & TypeAttributes.SequentialLayout);
-                       if (!ok) {
-                               Verifier.Log.Write ("error", "Types attributes mismatch: SequentialLayout.", ImportanceLevel.HIGH);
-                       }
-                       res &= ok;
-
-                       ok = (type1.Attributes & TypeAttributes.Serializable) ==
-                            (type2.Attributes & TypeAttributes.Serializable);
-                       if (!ok) {
-                               Verifier.Log.Write ("error", "Types attributes mismatch: Serializable.", ImportanceLevel.HIGH);
-                       }
-                       res &= ok;
-
-                       return res;
-               }
-
-       }
-
-
-
-
-       ////////////////////////////////
-       // Log
-       ////////////////////////////////
-
-       public enum ImportanceLevel : int {
-               LOW = 0, MEDIUM, HIGH
-       }
-
-
-       public interface ILogger {
-
-               void Write (string tag, string msg, ImportanceLevel importance);
-               void Write (string msg, ImportanceLevel level);
-               void Write (string tag, string msg);
-               void Write (string msg);
-               ImportanceLevel DefaultImportance {get; set;}
-               void Flush ();
-               void Close ();
-       }
-
-
-       public abstract class AbstractLogger : ILogger {
-               private ImportanceLevel defImportance = ImportanceLevel.MEDIUM;
-
-               public abstract void Write (string tag, string msg, ImportanceLevel importance);
-               public abstract void Write (string msg, ImportanceLevel level);
-
-               public virtual void Write (string tag, string msg)
-               {
-                       Write (tag, msg, DefaultImportance);
-               }
-
-               public virtual void Write (string msg)
-               {
-                       Write (msg, DefaultImportance);
-               }
-
-               public virtual ImportanceLevel DefaultImportance {
-                       get {
-                               return defImportance;
-                       }
-                       set {
-                               defImportance = value < ImportanceLevel.LOW
-                                                ? ImportanceLevel.LOW
-                                                : value > ImportanceLevel.HIGH
-                                                  ? ImportanceLevel.HIGH
-                                                  : value;
-                       }
-               }
-
-               public abstract void Flush ();
-               public abstract void Close ();
-
-       }
-
-
-
-       public class TextLogger : AbstractLogger {
-
-               private TextWriter writer;
-
-               public TextLogger (TextWriter writer)
-               {
-                       if (writer == null)
-                               throw new NullReferenceException ();
-
-                       this.writer = writer;
-               }
-
-               private void DoWrite (string tag, string msg)
-               {
-                       if (tag != null && tag.Length > 0) {
-                               writer.WriteLine ("[{0}]\t{1}", tag, msg);
-                       } else {
-                               writer.WriteLine ("\t\t" + msg);
-                       }
-               }
-
-               public override void Write (string tag, string msg, ImportanceLevel importance)
-               {
-                       int v = Log.VerboseLevel;
-                       switch (v) {
-                       case 0 :
-                               break;
-                       case 1 :
-                               if (importance >= ImportanceLevel.HIGH) {
-                                       DoWrite (tag, msg);
-                               }
-                               break;
-                       case 2 :
-                               if (importance >= ImportanceLevel.MEDIUM) {
-                                       DoWrite (tag, msg);
-                               }
-                               break;
-                       case 3 :
-                               DoWrite (tag, msg);
-                               break;
-                       default:
-                               break;
-                       }
-               }
-
-               public override void Write (string msg, ImportanceLevel importance)
-               {
-                       Write (null, msg, importance);
-               }
-
-               public override void Flush ()
-               {
-                       Console.Out.Flush ();
-               }
-
-               public override void Close ()
-               {
-                       if (writer != Console.Out && writer != Console.Error) {
-                               writer.Close ();
-                       }
-               }
-       }
-
-
-
-       public sealed class Log {
-
-               private static int verbose = 3;
-
-               private ArrayList consumers;
-
-               public Log (bool useDefault)
-               {
-                       consumers = new ArrayList ();
-                       if (useDefault) AddConsumer (new TextLogger (Console.Out));
-               }
-
-               public Log () : this (true)
-               {
-               }
-
-
-               public static int VerboseLevel {
-                       get {
-                               return verbose;
-                       }
-                       set {
-                               verbose = (value < 0)
-                                          ? 0
-                                          : (value > 3)
-                                            ? 3 : value;
-                       }
-               }
-
-               public void AddConsumer (ILogger consumer)
-               {
-                       consumers.Add (consumer);
-               }
-
-
-               public void Write (string tag, string msg, ImportanceLevel importance)
-               {
-                       foreach (ILogger logger in consumers) {
-                               if (tag == null || tag == "") {
-                                       logger.Write (msg, importance);
-                               } else {
-                                       logger.Write (tag, msg, importance);
-                               }
-                       }
-               }
-
-               public void Write (string msg, ImportanceLevel importance)
-               {
-                       Write (null, msg, importance);
-               }
-
-
-               public void Write (string tag, string msg)
-               {
-                       foreach (ILogger logger in consumers) {
-                               if (tag == null || tag == "") {
-                                       logger.Write (msg);
-                               } else {
-                                       logger.Write (tag, msg);
-                               }
-                       }
-               }
-
-               public void Write (string msg)
-               {
-                       Write (null, msg);
-               }
-
-
-               public void Flush ()
-               {
-                       foreach (ILogger logger in consumers) {
-                               logger.Flush ();
-                       }
-               }
-
-
-               public void Close ()
-               {
-                       foreach (ILogger logger in consumers) {
-                               logger.Flush ();
-                               logger.Close ();
-                       }
-               }
-
-       }
-
-
-
-
-
-
-       ////////////////////////////////
-       // Main
-       ////////////////////////////////
-
-       public class Verifier {
-
-               public static readonly Log log = new Log ();
-               public static bool stopOnError = false;
-               public static bool ignoreMissingTypes = true;
-               public static bool checkOptionalFlags = true;
-
-               private static readonly IList excluded;
-
-               static Verifier ()
-               {
-                       excluded = new ArrayList ();
-                       excluded.Add ("<PrivateImplementationDetails>");
-               }
-
-
-               private Verifier ()
-               {
-               }
-
-               public static Log Log {
-                       get {
-                               return log;
-                       }
-               }
-
-               public static IList Excluded {
-                       get {
-                               return excluded;
-                       }
-               }
-
-
-
-               public static void Main (String [] args)
-               {
-                       if (args.Length < 2) {
-                               Console.WriteLine ("Usage: verifier assembly1 assembly2");
-                       } else {
-                               string name1 = args [0];
-                               string name2 = args [1];
-
-                               bool ok = false;
-
-                               AssemblyStuff asm1 = new AssemblyStuff (name1);
-                               AssemblyStuff asm2 = new AssemblyStuff (name2);
-                               ok = asm1.Load ();
-                               if (!ok) {
-                                       Console.WriteLine ("Unable to load assembly {0}.", name1);
-                                       Environment.Exit (-1);
-                               }
-
-                               ok = asm2.Load ();
-                               if (!ok) {
-                                       Console.WriteLine ("Unable to load assembly {0}.", name2);
-                                       Environment.Exit (-1);
-                               }
-
-
-                               try {
-                                       ok = (asm1 == asm2);
-                               } catch {
-                                       ok = false;
-                               } finally {
-                                       Log.Close ();
-                               }
-
-                               if (!ok) {
-                                       Console.WriteLine ("--- not equal");
-                                       Environment.Exit (-1);
-                               }
-                       }
-               }
-
-       }
-
-
-}
-
index 2155da3f2774c3b5b148f65f1fb38082402c521a..9bcd6450ffadac88318de36d2435a38747cf1808 100644 (file)
@@ -36,4 +36,5 @@
        <UsingTask TaskName="Microsoft.Build.Tasks.Warning"             AssemblyName="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.WriteCodeFragment"   AssemblyName="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        <UsingTask TaskName="Microsoft.Build.Tasks.WriteLinesToFile"    AssemblyName="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.XmlPeek"             AssemblyName="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 </Project>
index 01964063c0f816152a271f79b580b1139aa4d190..192b8dabad308835480287a1f379517897fac766 100644 (file)
@@ -35,4 +35,5 @@
        <UsingTask TaskName="Microsoft.Build.Tasks.Warning"             AssemblyName="Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.WriteCodeFragment"   AssemblyName="Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        <UsingTask TaskName="Microsoft.Build.Tasks.WriteLinesToFile"    AssemblyName="Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.XmlPeek"             AssemblyName="Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 </Project>
index b183750f9e2d3c504d182c263b2084a98a5c0a50..caf108e39ced7cc76263a253d1d79c1d31f0999a 100644 (file)
@@ -36,4 +36,5 @@
        <UsingTask TaskName="Microsoft.Build.Tasks.Warning"             AssemblyName="Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.WriteCodeFragment"   AssemblyName="Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        <UsingTask TaskName="Microsoft.Build.Tasks.WriteLinesToFile"    AssemblyName="Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.XmlPeek"             AssemblyName="Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 </Project>
index 4fe2e248be7fcf25b053db356f8a0d7c24cb882e..bac7e8749989225afd4371dc853b4ee6a64d3303 100644 (file)
@@ -1037,8 +1037,11 @@ static void console_close (gpointer handle, gpointer data)
 
        g_free (console_handle->filename);
 
-       if (fd > 2)
+       if (fd > 2) {
+               if (console_handle->share_info)
+                       _wapi_handle_share_release (console_handle->share_info);
                close (fd);
+       }
 }
 
 static WapiFileType console_getfiletype(void)
@@ -1159,6 +1162,9 @@ static void pipe_close (gpointer handle, gpointer data)
 
        /* No filename with pipe handles */
 
+       if (pipe_handle->share_info)
+               _wapi_handle_share_release (pipe_handle->share_info);
+
        close (fd);
 }
 
@@ -1630,6 +1636,10 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
 #endif
        if (S_ISFIFO (statbuf.st_mode)) {
                handle_type = WAPI_HANDLE_PIPE;
+               /* maintain invariant that pipes have no filename */
+               file_handle.filename = NULL;
+               g_free (filename);
+               filename = NULL;
        } else if (S_ISCHR (statbuf.st_mode)) {
                handle_type = WAPI_HANDLE_CONSOLE;
        } else {
index 211c92bba176c3d054a87177385a527bec908998..1011818361818960c0573dbd552c34c9d5bcc016 100644 (file)
 #define WaitForMultipleObjects wapi_WaitForMultipleObjects
 #define WaitForMultipleObjectsEx wapi_WaitForMultipleObjectsEx
 #define WaitForInputIdle wapi_WaitForInputIdle
+#define GetThreadPriority wapi_GetThreadPriority
+#define SetThreadPriority wapi_SetThreadPriority
 
 #endif /* __WAPI_REMAP_H__ */
index 20d55eb878f37e7be555c5bd39ba222a4df43476..d618bef480307dc0ebc45309dc886a1bc2f82184 100644 (file)
@@ -2528,7 +2528,7 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
                if (*exc)
                        mono_error_cleanup (&error);
                else
-                       *exc = mono_error_convert_to_exception (&error);
+                       *exc = (MonoObject*)mono_error_convert_to_exception (&error);
        }
 
        if (*exc) {
index be250d67bd9b65585e02a62f776a543adba1e356..381d102b39bddab4358193835d8bb065ac4b454c 100644 (file)
@@ -105,7 +105,6 @@ static const AssemblyVersionMap framework_assemblies [] = {
        {"Mono.Security.Win32", 0},
        {"Mono.Xml.Ext", 0},
        {"Novell.Directory.Ldap", 0},
-       {"Npgsql", 0},
        {"PEAPI", 0},
        {"System", 0},
        {"System.ComponentModel.Composition", 2},
@@ -3050,13 +3049,13 @@ mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *
        mono_assembly_name_free (aname);
        g_free (aname);
        if (corlib != NULL)
-               return corlib;
+               goto return_corlib_and_facades;
 
        // This unusual directory layout can occur if mono is being built and run out of its own source repo
        if (assemblies_path) { // Custom assemblies path set via MONO_PATH or mono_set_assemblies_path
                corlib = load_in_path ("mscorlib.dll", (const char**)assemblies_path, status, FALSE);
                if (corlib)
-                       return corlib;
+                       goto return_corlib_and_facades;
        }
 
        /* Normal case: Load corlib from mono/<version> */
@@ -3065,14 +3064,15 @@ mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *
                corlib = load_in_path (corlib_file, (const char**)assemblies_path, status, FALSE);
                if (corlib) {
                        g_free (corlib_file);
-                       return corlib;
+                       goto return_corlib_and_facades;
                }
        }
        corlib = load_in_path (corlib_file, default_path, status, FALSE);
        g_free (corlib_file);
-       
+
+return_corlib_and_facades:
        if (corlib && !strcmp (runtime->framework_version, "4.5"))  // FIXME: stop hardcoding 4.5 here
-               default_path [1] = g_strdup_printf ("%s/mono/4.5/Facades", default_path [0]);
+               default_path [1] = g_strdup_printf ("%s/Facades", corlib->basedir);
                
        return corlib;
 }
index 538371bf50cf4938bd72ceefb026f1e6a48348f2..9a4aafe05979712ab971ba788ace1a40c142612f 100644 (file)
@@ -399,7 +399,7 @@ ICALL(MATH_17, "Tan", ves_icall_System_Math_Tan)
 ICALL(MATH_18, "Tanh", ves_icall_System_Math_Tanh)
 
 ICALL_TYPE(MCATTR, "System.MonoCustomAttrs", MCATTR_1)
-ICALL(MCATTR_1, "GetCustomAttributesDataInternal", mono_reflection_get_custom_attrs_data)
+ICALL(MCATTR_1, "GetCustomAttributesDataInternal", ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal)
 ICALL(MCATTR_2, "GetCustomAttributesInternal", custom_attrs_get_by_type)
 ICALL(MCATTR_3, "IsDefinedInternal", custom_attrs_defined_internal)
 
index 4c456dfaedd0f5c6d7df87a90350a68992b60d64..ba18aac5ac1dc12273a31838da77f1d752ee9b99 100644 (file)
@@ -1273,16 +1273,16 @@ get_caller_no_reflection (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed
 }
 
 static MonoReflectionType *
-type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase)
+type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoError *error)
 {
-       MonoError error;
-       MonoReflectionType *ret;
        MonoMethod *m, *dest;
 
        MonoType *type = NULL;
        MonoAssembly *assembly = NULL;
        gboolean type_resolve = FALSE;
 
+       mono_error_init (error);
+
        /*
         * We must compute the calling assembly as type loading must happen under a metadata context.
         * For example. The main assembly is a.exe and Type.GetType is called from dir/b.dll. Without
@@ -1330,42 +1330,15 @@ type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase)
        if (!type) 
                return NULL;
 
-       ret = mono_type_get_object_checked (mono_domain_get (), type, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
-
-       return ret;
+       return mono_type_get_object_checked (mono_domain_get (), type, error);
 }
 
-#ifdef UNUSED
-MonoReflectionType *
-mono_type_get (const char *str)
-{
-       char *copy = g_strdup (str);
-       MonoTypeNameParse info;
-       MonoReflectionType *type;
-       gboolean parsedOk;
-
-       parsedOk = mono_reflection_parse_type(copy, &info);
-       if (!parsedOk) {
-               mono_reflection_free_type_info (&info);
-               g_free(copy);
-               return NULL;
-       }
-
-       type = type_from_parsed_name (&info, FALSE);
-
-       mono_reflection_free_type_info (&info);
-       g_free(copy);
-
-       return type;
-}
-#endif
-
 ICALL_EXPORT MonoReflectionType*
 ves_icall_type_from_name (MonoString *name,
                          MonoBoolean throwOnError,
                          MonoBoolean ignoreCase)
 {
+       MonoError error;
        char *str = mono_string_to_utf8 (name);
        MonoTypeNameParse info;
        MonoReflectionType *type;
@@ -1383,11 +1356,19 @@ ves_icall_type_from_name (MonoString *name,
                return NULL;
        }
 
-       type = type_from_parsed_name (&info, ignoreCase);
+       type = type_from_parsed_name (&info, ignoreCase, &error);
 
        mono_reflection_free_type_info (&info);
        g_free (str);
 
+       if (!mono_error_ok (&error)) {
+               if (throwOnError)
+                       mono_error_set_pending_exception (&error);
+               else
+                       mono_error_cleanup (&error);
+               return NULL;
+       }
+
        if (type == NULL){
                MonoException *e = NULL;
                
@@ -4595,13 +4576,14 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAss
 }
 
 static MonoObject*
-create_version (MonoDomain *domain, guint32 major, guint32 minor, guint32 build, guint32 revision)
+create_version (MonoDomain *domain, guint32 major, guint32 minor, guint32 build, guint32 revision, MonoError *error)
 {
        static MonoClass *System_Version = NULL;
        static MonoMethod *create_version = NULL;
-       MonoError error;
        MonoObject *result;
        gpointer args [4];
+
+       mono_error_init (error);
        
        if (!System_Version) {
                System_Version = mono_class_from_name (mono_defaults.corlib, "System", "Version");
@@ -4619,11 +4601,11 @@ create_version (MonoDomain *domain, guint32 major, guint32 minor, guint32 build,
        args [1] = &minor;
        args [2] = &build;
        args [3] = &revision;
-       result = mono_object_new_checked (domain, System_Version, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
+       result = mono_object_new_checked (domain, System_Version, error);
+       return_val_if_nok (error, NULL);
 
-       mono_runtime_invoke_checked (create_version, result, args, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
+       mono_runtime_invoke_checked (create_version, result, args, error);
+       return_val_if_nok (error, NULL);
 
        return result;
 }
@@ -4659,6 +4641,7 @@ ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAsse
        }
 
        for (i = 0; i < count; i++) {
+               MonoObject *version;
                MonoReflectionAssemblyName *aname;
                guint32 cols [MONO_ASSEMBLYREF_SIZE];
 
@@ -4677,7 +4660,11 @@ ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAsse
                aname->flags = cols [MONO_ASSEMBLYREF_FLAGS];
                aname->versioncompat = 1; /* SameMachine (default) */
                aname->hashalg = ASSEMBLY_HASH_SHA1; /* SHA1 (default) */
-               MONO_OBJECT_SETREF (aname, version, create_version (domain, aname->major, aname->minor, aname->build, aname->revision));
+
+               version = create_version (domain, aname->major, aname->minor, aname->build, aname->revision, &error);
+               mono_error_raise_exception (&error);
+
+               MONO_OBJECT_SETREF (aname, version, version);
 
                if (create_culture) {
                        gpointer args [2];
@@ -5161,10 +5148,9 @@ ves_icall_MonoMethod_get_core_clr_security_level (MonoReflectionMethod *rfield)
 }
 
 static void
-fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *aname, MonoAssemblyName *name, const char *absolute, gboolean by_default_version, gboolean default_publickey, gboolean default_token)
+fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *aname, MonoAssemblyName *name, const char *absolute, gboolean by_default_version, gboolean default_publickey, gboolean default_token, MonoError *error)
 {
        static MonoMethod *create_culture = NULL;
-       MonoError error;
        MonoObject *obj;
        gpointer args [2];
        guint32 pkey_len;
@@ -5172,6 +5158,8 @@ fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *a
        gchar *codebase;
        MonoBoolean assembly_ref = 0;
 
+       mono_error_init (error);
+
        MONO_OBJECT_SETREF (aname, name, mono_string_new (domain, name->name));
        aname->major = name->major;
        aname->minor = name->minor;
@@ -5182,8 +5170,14 @@ fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *a
        aname->versioncompat = 1; /* SameMachine (default) */
        aname->processor_architecture = name->arch;
 
-       if (by_default_version)
-               MONO_OBJECT_SETREF (aname, version, create_version (domain, name->major, name->minor, name->build, name->revision));
+       if (by_default_version) {
+               MonoObject *version;
+
+               version = create_version (domain, name->major, name->minor, name->build, name->revision, error);
+               return_if_nok (error);
+
+               MONO_OBJECT_SETREF (aname, version, version);
+       }
 
        codebase = NULL;
        if (absolute != NULL && *absolute != '\0') {
@@ -5227,8 +5221,8 @@ fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *a
                args [0] = mono_string_new (domain, name->culture);
                args [1] = &assembly_ref;
 
-               obj = mono_runtime_invoke_checked (create_culture, NULL, args, &error);
-               mono_error_raise_exception (&error); /* FIXME don't raise here */
+               obj = mono_runtime_invoke_checked (create_culture, NULL, args, error);
+               return_if_nok (error);
 
                MONO_OBJECT_SETREF (aname, cultureInfo, obj);
        }
@@ -5281,20 +5275,19 @@ ves_icall_System_Reflection_Assembly_get_fullName (MonoReflectionAssembly *assem
 ICALL_EXPORT void
 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
 {
+       MonoError error;
        gchar *absolute;
        MonoAssembly *mass = assembly->assembly;
 
        if (g_path_is_absolute (mass->image->name)) {
-               fill_reflection_assembly_name (mono_object_domain (assembly),
-                       aname, &mass->aname, mass->image->name, TRUE,
-                       TRUE, TRUE);
+               fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, mass->image->name, TRUE, TRUE, TRUE, &error);
+               mono_error_set_pending_exception (&error);
                return;
        }
        absolute = g_build_filename (mass->basedir, mass->image->name, NULL);
 
-       fill_reflection_assembly_name (mono_object_domain (assembly),
-               aname, &mass->aname, absolute, TRUE, TRUE,
-               TRUE);
+       fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, absolute, TRUE, TRUE, TRUE, &error);
+       mono_error_set_pending_exception (&error);
 
        g_free (absolute);
 }
@@ -5302,6 +5295,7 @@ ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly,
 ICALL_EXPORT void
 ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoString *fname, MonoReflectionAssemblyName *aname)
 {
+       MonoError error;
        char *filename;
        MonoImageOpenStatus status = MONO_IMAGE_OK;
        gboolean res;
@@ -5337,11 +5331,11 @@ ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoString *fname,
                return;
        }
 
-       fill_reflection_assembly_name (mono_domain_get (), aname, &name, filename,
-               TRUE, FALSE, TRUE);
+       fill_reflection_assembly_name (mono_domain_get (), aname, &name, filename, TRUE, FALSE, TRUE, &error);
+       mono_error_set_pending_exception (&error);
 
-       g_free (filename);
        mono_image_close (image);
+       g_free (filename);
 }
 
 ICALL_EXPORT MonoBoolean
@@ -5389,15 +5383,16 @@ mono_module_type_is_visible (MonoTableInfo *tdef, MonoImage *image, int type)
 }
 
 static MonoArray*
-mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **exceptions, MonoBoolean exportedOnly)
+mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **exceptions, MonoBoolean exportedOnly, MonoError *error)
 {
-       MonoError error;
        MonoReflectionType *rt;
        MonoArray *res;
        MonoClass *klass;
        MonoTableInfo *tdef = &image->tables [MONO_TABLE_TYPEDEF];
        int i, count;
 
+       mono_error_init (error);
+
        /* we start the count from 1 because we skip the special type <Module> */
        if (exportedOnly) {
                count = 0;
@@ -5413,17 +5408,17 @@ mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **excepti
        count = 0;
        for (i = 1; i < tdef->rows; ++i) {
                if (!exportedOnly || mono_module_type_is_visible (tdef, image, i + 1)) {
-                       klass = mono_class_get_checked (image, (i + 1) | MONO_TOKEN_TYPE_DEF, &error);
+                       klass = mono_class_get_checked (image, (i + 1) | MONO_TOKEN_TYPE_DEF, error);
                        mono_loader_assert_no_error (); /* Plug any leaks */
-                       g_assert (mono_error_ok (&error));
+                       mono_error_assert_ok (error);
                        
                        if (klass) {
-                               rt = mono_type_get_object_checked (domain, &klass->byval_arg, &error);
-                               mono_error_raise_exception (&error); /* FIXME don't raise here */
+                               rt = mono_type_get_object_checked (domain, &klass->byval_arg, error);
+                               return_val_if_nok (error, NULL);
 
                                mono_array_setref (res, count, rt);
                        } else {
-                               MonoException *ex = mono_error_convert_to_exception (&error);
+                               MonoException *ex = mono_error_convert_to_exception (error);
                                mono_array_setref (*exceptions, count, ex);
                        }
                        count++;
@@ -5436,6 +5431,7 @@ mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **excepti
 ICALL_EXPORT MonoArray*
 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
 {
+       MonoError error;
        MonoArray *res = NULL;
        MonoArray *exceptions = NULL;
        MonoImage *image = NULL;
@@ -5449,7 +5445,8 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
        g_assert (!assembly_is_dynamic (assembly->assembly));
        image = assembly->assembly->image;
        table = &image->tables [MONO_TABLE_FILE];
-       res = mono_module_get_types (domain, image, &exceptions, exportedOnly);
+       res = mono_module_get_types (domain, image, &exceptions, exportedOnly, &error);
+       mono_error_raise_exception (&error);
 
        /* Append data from all modules in the assembly */
        for (i = 0; i < table->rows; ++i) {
@@ -5457,7 +5454,11 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
                        MonoImage *loaded_image = mono_assembly_load_module (image->assembly, i + 1);
                        if (loaded_image) {
                                MonoArray *ex2;
-                               MonoArray *res2 = mono_module_get_types (domain, loaded_image, &ex2, exportedOnly);
+                               MonoArray *res2;
+
+                               res2 = mono_module_get_types (domain, loaded_image, &ex2, exportedOnly, &error);
+                               mono_error_raise_exception (&error);
+
                                /* Append the new types to the end of the array */
                                if (mono_array_length (res2) > 0) {
                                        guint32 len1, len2;
@@ -5543,6 +5544,7 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
 ICALL_EXPORT gboolean
 ves_icall_System_Reflection_AssemblyName_ParseName (MonoReflectionAssemblyName *name, MonoString *assname)
 {
+       MonoError error;
        MonoAssemblyName aname;
        MonoDomain *domain = mono_object_domain (name);
        char *val;
@@ -5557,8 +5559,8 @@ ves_icall_System_Reflection_AssemblyName_ParseName (MonoReflectionAssemblyName *
                return FALSE;
        }
        
-       fill_reflection_assembly_name (domain, name, &aname, "", is_version_defined,
-               FALSE, is_token_defined);
+       fill_reflection_assembly_name (domain, name, &aname, "", is_version_defined, FALSE, is_token_defined, &error);
+       mono_error_set_pending_exception (&error);
 
        mono_assembly_name_free (&aname);
        g_free ((guint8*) aname.public_key);
@@ -5646,13 +5648,18 @@ ves_icall_System_Reflection_Module_GetMDStreamVersion (MonoImage *image)
 ICALL_EXPORT MonoArray*
 ves_icall_System_Reflection_Module_InternalGetTypes (MonoReflectionModule *module)
 {
+       MonoError error;
        MonoArray *exceptions;
        int i;
 
        if (!module->image)
                return mono_array_new (mono_object_domain (module), mono_defaults.monotype_class, 0);
        else {
-               MonoArray *res = mono_module_get_types (mono_object_domain (module), module->image, &exceptions, FALSE);
+               MonoArray *res;
+
+               res = mono_module_get_types (mono_object_domain (module), module->image, &exceptions, FALSE, &error);
+               mono_error_raise_exception (&error);
+
                for (i = 0; i < mono_array_length (exceptions); ++i) {
                        MonoException *ex = mono_array_get (exceptions, MonoException *, i);
                        if (ex) {
@@ -7741,6 +7748,17 @@ custom_attrs_get_by_type (MonoObject *obj, MonoReflectionType *attr_type)
        }
 }
 
+ICALL_EXPORT MonoArray*
+ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal (MonoObject *obj)
+{
+       MonoError error;
+       MonoArray *result;
+       result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+
 ICALL_EXPORT MonoString*
 ves_icall_Mono_Runtime_GetDisplayName (void)
 {
index 0c1d28130aff76741a2bc76e03d5cd84ea9dfdd8..b05a8416aac761b86579a210988f5627e168bc6d 100644 (file)
@@ -1009,6 +1009,12 @@ mono_monitor_enter (MonoObject *obj)
 }
 
 gboolean 
+mono_monitor_enter_fast (MonoObject *obj)
+{
+       return mono_monitor_try_enter_internal (obj, 0, FALSE) == 1;
+}
+
+gboolean
 mono_monitor_try_enter (MonoObject *obj, guint32 ms)
 {
        return mono_monitor_try_enter_internal (obj, ms, FALSE) == 1;
@@ -1100,7 +1106,6 @@ ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject
 void
 mono_monitor_enter_v4 (MonoObject *obj, char *lock_taken)
 {
-
        if (*lock_taken == 1) {
                mono_set_pending_exception (mono_get_exception_argument ("lockTaken", "lockTaken is already true"));
                return;
@@ -1109,6 +1114,23 @@ mono_monitor_enter_v4 (MonoObject *obj, char *lock_taken)
        ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (obj, INFINITE, lock_taken);
 }
 
+/*
+ * mono_monitor_enter_v4_fast:
+ *
+ *   Same as mono_monitor_enter_v4, but return immediately if the
+ * monitor cannot be acquired.
+ * Returns TRUE if the lock was acquired, FALSE otherwise.
+ */
+gboolean
+mono_monitor_enter_v4_fast (MonoObject *obj, char *lock_taken)
+{
+       if (*lock_taken == 1)
+               return FALSE;
+       gint32 res = mono_monitor_try_enter_internal (obj, 0, TRUE);
+       *lock_taken = res == 1;
+       return res == 1;
+}
+
 gboolean 
 ves_icall_System_Threading_Monitor_Monitor_test_owner (MonoObject *obj)
 {
index bd796254034eac6f4fee232c63554231442536c3..f8e89936ba93067e658532d75e2e05e042321e0b 100644 (file)
@@ -106,6 +106,9 @@ MONO_API void mono_locks_dump (gboolean include_untaken);
 void mono_monitor_init (void);
 void mono_monitor_cleanup (void);
 
+gboolean mono_monitor_enter_fast (MonoObject *obj);
+gboolean mono_monitor_enter_v4_fast (MonoObject *obj, char *lock_taken);
+
 guint32 mono_monitor_get_object_monitor_gchandle (MonoObject *object);
 
 void mono_monitor_threads_sync_members_offset (int *status_offset, int *nest_offset);
index 9ff3b451281e4940dbc2b47e8f1917ad989e0352..f445b436172f47095af789edaddac055c35dffdb 100644 (file)
@@ -11,6 +11,9 @@
 MonoObject*
 mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass, MonoError *error);
 
+MonoArray*
+mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error);
+
 char*
 mono_identifier_unescape_type_name_chars (char* identifier);
 
index 7786598405280f56a2659bffba7de06af1edb0be..49cac40c7adb4c7b782d3718bd00118507e94f60 100644 (file)
@@ -6661,12 +6661,11 @@ mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly)
        MonoError error;
        MonoReflectionAssembly *result;
        result = mono_assembly_get_object_checked (domain, assembly, &error);
-       if (!result)
-               mono_error_set_pending_exception (&error);
+       mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */
        return result;
 }
 /*
- * mono_assembly_get_object:
+ * mono_assembly_get_object_checked:
  * @domain: an app domain
  * @assembly: an assembly
  *
@@ -6764,7 +6763,7 @@ mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_ind
        MonoError error;
        MonoReflectionModule *result;
        result = mono_module_file_get_object_checked (domain, image, table_index, &error);
-       mono_error_raise_exception (&error);
+       mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */
        return result;
 }
 
@@ -10019,10 +10018,31 @@ mono_reflection_get_custom_attrs (MonoObject *obj)
  */
 MonoArray*
 mono_reflection_get_custom_attrs_data (MonoObject *obj)
+{
+       MonoError error;
+       MonoArray* result;
+       result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
+       mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */
+       return result;
+}
+
+/*
+ * mono_reflection_get_custom_attrs_data_checked:
+ * @obj: a reflection obj handle
+ * @error: set on error
+ *
+ * Returns an array of System.Reflection.CustomAttributeData,
+ * which include information about attributes reflected on
+ * types loaded using the Reflection Only methods
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error)
 {
        MonoArray *result;
        MonoCustomAttrInfo *cinfo;
 
+       mono_error_init (error);
+
        cinfo = mono_reflection_get_custom_attrs_info (obj);
        if (cinfo) {
                result = mono_custom_attrs_data_construct (cinfo);
@@ -10031,6 +10051,9 @@ mono_reflection_get_custom_attrs_data (MonoObject *obj)
        } else
                result = mono_array_new (mono_domain_get (), mono_defaults.customattribute_data_class, 0);
 
+       if (mono_loader_get_last_error ())
+               mono_error_set_from_loader_error (error);
+
        return result;
 }
 
index e3e84f11e7311e200c42f3f07696affb8fbad8e4..a8bdff969b0d1ba22e7bae710de50b99775c5f40 100644 (file)
@@ -70,6 +70,7 @@ MONO_API MonoObject *mono_get_dbnull_object (MonoDomain *domain);
 
 MONO_API MonoArray*  mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error);
 MONO_API MonoArray*  mono_reflection_get_custom_attrs (MonoObject *obj);
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoArray*  mono_reflection_get_custom_attrs_data (MonoObject *obj);
 MONO_API MonoArray*  mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);
 
index 74ee377c49a8eb5f2275bbc7f8f2e9539398b801..8f86228dce17bece01892b1e24934f67aa7af264 100644 (file)
@@ -2738,7 +2738,7 @@ sgen_client_degraded_allocation (size_t size)
        static int last_major_gc_warned = -1;
        static int num_degraded = 0;
 
-       if (last_major_gc_warned < gc_stats.major_gc_count) {
+       if (last_major_gc_warned < (int)gc_stats.major_gc_count) {
                ++num_degraded;
                if (num_degraded == 1 || num_degraded == 3)
                        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "Warning: Degraded allocation.  Consider increasing nursery-size if the warning persists.");
index 9bd451ee71cba9001ba2466177cafdc3bb833455..6867741e3ce39026918ea56b45a7c028cbe2e9a8 100644 (file)
@@ -202,9 +202,10 @@ static void mono_free_static_data (gpointer* static_data);
 static void mono_init_static_data_info (StaticDataInfo *static_data);
 static guint32 mono_alloc_static_data_slot (StaticDataInfo *static_data, guint32 size, guint32 align);
 static gboolean mono_thread_resume (MonoInternalThread* thread);
-static void abort_thread_internal (MonoInternalThread *thread, gboolean can_raise_exception, gboolean install_async_abort);
-static void suspend_thread_internal (MonoInternalThread *thread, gboolean interrupt);
-static void self_suspend_internal (MonoInternalThread *thread);
+static void async_abort_internal (MonoInternalThread *thread, gboolean install_async_abort);
+static void self_abort_internal (void);
+static void async_suspend_internal (MonoInternalThread *thread, gboolean interrupt);
+static void self_suspend_internal (void);
 
 static MonoException* mono_thread_execute_interruption (void);
 static void ref_stack_destroy (gpointer rs);
@@ -2145,9 +2146,9 @@ void ves_icall_System_Threading_Thread_Interrupt_internal (MonoThread *this_obj)
        throw_ = current != thread && (thread->state & ThreadState_WaitSleepJoin);
 
        UNLOCK_THREAD (thread);
-       
+
        if (throw_) {
-               abort_thread_internal (thread, TRUE, FALSE);
+               async_abort_internal (thread, FALSE);
        }
 }
 
@@ -2209,7 +2210,10 @@ ves_icall_System_Threading_Thread_Abort (MonoInternalThread *thread, MonoObject
 
        UNLOCK_THREAD (thread);
 
-       abort_thread_internal (thread, TRUE, TRUE);
+       if (thread == mono_thread_internal_current ())
+               self_abort_internal ();
+       else
+               async_abort_internal (thread, TRUE);
 }
 
 void
@@ -2309,7 +2313,15 @@ mono_thread_suspend (MonoInternalThread *thread)
        }
        
        thread->state |= ThreadState_SuspendRequested;
-       suspend_thread_internal (thread, FALSE);
+
+       if (thread == mono_thread_internal_current ()) {
+               /* calls UNLOCK_THREAD (thread) */
+               self_suspend_internal ();
+       } else {
+               /* calls UNLOCK_THREAD (thread) */
+               async_suspend_internal (thread, FALSE);
+       }
+
        return TRUE;
 }
 
@@ -2417,7 +2429,10 @@ void mono_thread_internal_stop (MonoInternalThread *thread)
        
        UNLOCK_THREAD (thread);
        
-       abort_thread_internal (thread, TRUE, TRUE);
+       if (thread == mono_thread_internal_current ())
+               self_abort_internal ();
+       else
+               async_abort_internal (thread, TRUE);
 }
 
 void mono_thread_stop (MonoThread *thread)
@@ -3285,8 +3300,9 @@ void mono_thread_suspend_all_other_threads (void)
                                thread->state &= ~ThreadState_AbortRequested;
                        
                        thread->state |= ThreadState_SuspendRequested;
-                       /* Signal the thread to suspend */
-                       suspend_thread_internal (thread, TRUE);
+
+                       /* Signal the thread to suspend + calls UNLOCK_THREAD (thread) */
+                       async_suspend_internal (thread, TRUE);
                }
                if (eventidx <= 0) {
                        /* 
@@ -4336,7 +4352,8 @@ mono_thread_execute_interruption (void)
                return thread->abort_exc;
        }
        else if ((thread->state & ThreadState_SuspendRequested) != 0) {
-               self_suspend_internal (thread);         
+               /* calls UNLOCK_THREAD (thread) */
+               self_suspend_internal ();
                return NULL;
        }
        else if ((thread->state & ThreadState_StopRequested) != 0) {
@@ -4676,7 +4693,7 @@ typedef struct {
 } AbortThreadData;
 
 static SuspendThreadResult
-abort_thread_critical (MonoThreadInfo *info, gpointer ud)
+async_abort_critical (MonoThreadInfo *info, gpointer ud)
 {
        AbortThreadData *data = (AbortThreadData *)ud;
        MonoInternalThread *thread = data->thread;
@@ -4718,41 +4735,45 @@ abort_thread_critical (MonoThreadInfo *info, gpointer ud)
 }
 
 static void
-abort_thread_internal (MonoInternalThread *thread, gboolean can_raise_exception, gboolean install_async_abort)
+async_abort_internal (MonoInternalThread *thread, gboolean install_async_abort)
 {
-       AbortThreadData data = { 0 };
-       data.thread = thread;
-       data.install_async_abort = install_async_abort;
+       AbortThreadData data;
 
-       /*
-       FIXME this is insanely broken, it doesn't cause interruption to happen
-       synchronously since passing FALSE to mono_thread_request_interruption makes sure it returns NULL
-       */
-       if (thread == mono_thread_internal_current ()) {
-               /* Do it synchronously */
-               MonoException *exc = mono_thread_request_interruption (can_raise_exception); 
-               if (exc)
-                       mono_raise_exception (exc);
+       g_assert (thread != mono_thread_internal_current ());
 
-               mono_thread_info_self_interrupt ();
-
-               return;
-       }
+       data.thread = thread;
+       data.install_async_abort = install_async_abort;
+       data.interrupt_token = NULL;
 
-       mono_thread_info_safe_suspend_and_run (thread_get_tid (thread), TRUE, abort_thread_critical, &data);
+       mono_thread_info_safe_suspend_and_run (thread_get_tid (thread), TRUE, async_abort_critical, &data);
        if (data.interrupt_token)
                mono_thread_info_finish_interrupt (data.interrupt_token);
        /*FIXME we need to wait for interruption to complete -- figure out how much into interruption we should wait for here*/
 }
 
-typedef struct{
+static void
+self_abort_internal (void)
+{
+       MonoException *exc;
+
+       /* FIXME this is insanely broken, it doesn't cause interruption to happen synchronously
+        * since passing FALSE to mono_thread_request_interruption makes sure it returns NULL */
+
+       exc = mono_thread_request_interruption (TRUE);
+       if (exc)
+               mono_raise_exception (exc);
+
+       mono_thread_info_self_interrupt ();
+}
+
+typedef struct {
        MonoInternalThread *thread;
        gboolean interrupt;
        MonoThreadInfoInterruptToken *interrupt_token;
 } SuspendThreadData;
 
 static SuspendThreadResult
-suspend_thread_critical (MonoThreadInfo *info, gpointer ud)
+async_suspend_critical (MonoThreadInfo *info, gpointer ud)
 {
        SuspendThreadData *data = (SuspendThreadData *)ud;
        MonoInternalThread *thread = data->thread;
@@ -4777,41 +4798,43 @@ suspend_thread_critical (MonoThreadInfo *info, gpointer ud)
                return MonoResumeThread;
        }
 }
-       
+
+/* LOCKING: called with @thread synch_cs held, and releases it */
 static void
-suspend_thread_internal (MonoInternalThread *thread, gboolean interrupt)
+async_suspend_internal (MonoInternalThread *thread, gboolean interrupt)
 {
-       if (thread == mono_thread_internal_current ()) {
-               mono_thread_info_begin_self_suspend ();
-               //XXX replace this with better named functions
-               thread->state &= ~ThreadState_SuspendRequested;
-               thread->state |= ThreadState_Suspended;
-               UNLOCK_THREAD (thread);
-               mono_thread_info_end_self_suspend ();
-       } else {
-               SuspendThreadData data = { 0 };
-               data.thread = thread;
-               data.interrupt = interrupt;
+       SuspendThreadData data;
 
-               mono_thread_info_safe_suspend_and_run (thread_get_tid (thread), interrupt, suspend_thread_critical, &data);
-               if (data.interrupt_token)
-                       mono_thread_info_finish_interrupt (data.interrupt_token);
-               UNLOCK_THREAD (thread);
-       }
+       g_assert (thread != mono_thread_internal_current ());
+
+       data.thread = thread;
+       data.interrupt = interrupt;
+       data.interrupt_token = NULL;
+
+       mono_thread_info_safe_suspend_and_run (thread_get_tid (thread), interrupt, async_suspend_critical, &data);
+       if (data.interrupt_token)
+               mono_thread_info_finish_interrupt (data.interrupt_token);
+
+       UNLOCK_THREAD (thread);
 }
 
-/*This is called with @thread synch_cs held and it must release it*/
+/* LOCKING: called with @thread synch_cs held, and releases it */
 static void
-self_suspend_internal (MonoInternalThread *thread)
+self_suspend_internal (void)
 {
+       MonoInternalThread *thread;
+
+       thread = mono_thread_internal_current ();
+
        mono_thread_info_begin_self_suspend ();
        thread->state &= ~ThreadState_SuspendRequested;
        thread->state |= ThreadState_Suspended;
+
        UNLOCK_THREAD (thread);
+
        mono_thread_info_end_self_suspend ();
 }
 
-
 /*
  * mono_thread_is_foreign:
  * @thread: the thread to query
index f980ec9d35e368b8d6756c3856934f00862e790e..772105fd258340dea73132f38e21cf16505c2092 100644 (file)
@@ -7356,9 +7356,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
        if (acfg->aot_opts.llvm_only) {
                GSList *l;
 
-               if (cfg->method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE && strstr (mono_method_full_name (cfg->method, 1), "ParallelLoopState"))
-                       printf ("HIT!\n");
-
                if (!cfg->method->wrapper_type || cfg->method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE)
                        /* These only need out wrappers */
                        add_gsharedvt_wrappers (acfg, mono_method_signature (cfg->method), FALSE, TRUE);
@@ -7947,10 +7944,7 @@ emit_llvm_file (MonoAotCompile *acfg)
        if (acfg->aot_opts.llvm_only) {
                /* Use the stock clang from xcode */
                // FIXME: arch
-               // FIXME: -O2
-               // FIXME: llc/opt flags
-               command = g_strdup_printf ("clang -march=x86-64 -fpic -msse -msse2 -msse3 -msse4 -O0 -fno-optimize-sibling-calls -Wno-override-module -c -o \"%s\" \"%s.opt.bc\"", acfg->llvm_ofile, acfg->tmpbasename);
-               //command = g_strdup_printf ("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -Qunused-arguments -miphoneos-version-min=8.2 -arch arm64 -fpic -O0 -c -o \"%s\" \"%s.bc\"", acfg->llvm_ofile, acfg->tmpbasename);
+               command = g_strdup_printf ("clang -march=x86-64 -fpic -msse -msse2 -msse3 -msse4 -O2 -fno-optimize-sibling-calls -Wno-override-module -c -o \"%s\" \"%s.opt.bc\"", acfg->llvm_ofile, acfg->tmpbasename);
 
                aot_printf (acfg, "Executing clang: %s\n", command);
                if (execute_system (command) != 0)
index 0b6c4a6ecf6fa6f1acb4e6695509f1c0d28d415b..b082a6e3b0f2f7b0ed66b398e7e2d495020f6cbf 100644 (file)
@@ -4599,7 +4599,7 @@ mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_
  * Returns NULL if the something cannot be loaded.
  */
 gpointer
-mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
+mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error)
 {
 #ifdef MONO_ARCH_AOT_SUPPORTED
        guint8 *p, *target, *plt_entry;
@@ -4607,9 +4607,10 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code
        MonoAotModule *module = (MonoAotModule*)aot_module;
        gboolean res, no_ftnptr = FALSE;
        MonoMemPool *mp;
-       MonoError error;
        gboolean using_gsharedvt = FALSE;
 
+       mono_error_init (error);
+
        //printf ("DYN: %p %d\n", aot_module, plt_info_offset);
 
        p = &module->blob [plt_info_offset];
@@ -4636,12 +4637,14 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code
         */
        if (mono_aot_only && ji.type == MONO_PATCH_INFO_METHOD && !ji.data.method->is_generic && !mono_method_check_context_used (ji.data.method) && !(ji.data.method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) &&
                !mono_method_needs_static_rgctx_invoke (ji.data.method, FALSE) && !using_gsharedvt) {
-               target = (guint8 *)mono_jit_compile_method (ji.data.method, &error);
-               if (!mono_error_ok (&error))
-                       mono_error_raise_exception (&error);
+               target = (guint8 *)mono_jit_compile_method (ji.data.method, error);
+               if (!mono_error_ok (error))
+                       return NULL;
                no_ftnptr = TRUE;
        } else {
-               target = (guint8 *)mono_resolve_patch_target (NULL, mono_domain_get (), NULL, &ji, TRUE);
+               target = (guint8 *)mono_resolve_patch_target_checked (NULL, mono_domain_get (), NULL, &ji, TRUE, error);
+               if (!mono_error_ok (error))
+                       return NULL;
        }
 
        /*
@@ -4729,7 +4732,7 @@ mono_aot_get_plt_entry (guint8 *code)
                return NULL;
 
 #ifdef TARGET_ARM
-       if (is_thumb_code (amodule, code))
+       if (is_thumb_code (amodule, code - 4))
                return mono_arm_get_thumb_plt_entry (code);
 #endif
 
@@ -5728,7 +5731,7 @@ mono_aot_get_plt_entry (guint8 *code)
 }
 
 gpointer
-mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
+mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error)
 {
        return NULL;
 }
index 258e930d20164548e7657beb5c17a865f6223259..a4910feb18003f48f13f6d6a994522daf1039c27 100644 (file)
@@ -336,13 +336,16 @@ mono_constant_fold_ins (MonoCompile *cfg, MonoInst *ins, MonoInst *arg1, MonoIns
                                }
                                break;
                        case OP_COND_EXC_EQ:
-                               if (overwrite) {
-                                       NULLIFY_INS (ins);
-                                       NULLIFY_INS (next);
-                               } else {
-                                       ALLOC_DEST (cfg, dest, ins);
-                                       dest->opcode = OP_ICONST;
-                                       dest->inst_c0 = res;
+                               res = arg1->inst_c0 == arg2->inst_c0;
+                               if (!res) {
+                                       if (overwrite) {
+                                               NULLIFY_INS (ins);
+                                               NULLIFY_INS (next);
+                                       } else {
+                                               ALLOC_DEST (cfg, dest, ins);
+                                               dest->opcode = OP_ICONST;
+                                               dest->inst_c0 = res;
+                                       }
                                }
                                break;
                        case OP_NOP:
index edece583b1c76defecd337447f51b568dc82060f..cc25ae065d6916d516c5c0c1c695b98bb9784f29 100644 (file)
@@ -56,6 +56,7 @@
 #include <mono/metadata/security-core-clr.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/profiler.h>
+#include <mono/metadata/monitor.h>
 #include <mono/metadata/debug-mono-symfile.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-memory-model.h>
@@ -5981,7 +5982,6 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
                } else 
                        return NULL;
        } else if (cmethod->klass == mono_defaults.object_class) {
-
                if (strcmp (cmethod->name, "GetType") == 0 && fsig->param_count + fsig->hasthis == 1) {
                        int dreg = alloc_ireg_ref (cfg);
                        int vt_reg = alloc_preg (cfg);
@@ -6079,12 +6079,38 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
                } else
                        return NULL;
        } else if (cmethod->klass == runtime_helpers_class) {
-
                if (strcmp (cmethod->name, "get_OffsetToStringData") == 0 && fsig->param_count == 0) {
                        EMIT_NEW_ICONST (cfg, ins, MONO_STRUCT_OFFSET (MonoString, chars));
                        return ins;
                } else
                        return NULL;
+       } else if (cmethod->klass == mono_defaults.monitor_class) {
+               gboolean is_enter = FALSE;
+               gboolean is_v4 = FALSE;
+
+               if (!strcmp (cmethod->name, "enter_with_atomic_var") && mono_method_signature (cmethod)->param_count == 2) {
+                       is_enter = TRUE;
+                       is_v4 = TRUE;
+               }
+               if (!strcmp (cmethod->name, "Enter") && mono_method_signature (cmethod)->param_count == 1)
+                       is_enter = TRUE;
+
+               if (is_enter) {
+                       /*
+                        * To make async stack traces work, icalls which can block should have a wrapper.
+                        * For Monitor.Enter, emit two calls: a fastpath which doesn't have a wrapper, and a slowpath, which does.
+                        */
+                       MonoBasicBlock *end_bb;
+
+                       NEW_BBLOCK (cfg, end_bb);
+
+                       ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4_fast : (gpointer)mono_monitor_enter_fast, args);
+                       MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ICOMPARE_IMM, -1, ins->dreg, 0);
+                       MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBNE_UN, end_bb);
+                       ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4 : (gpointer)mono_monitor_enter, args);
+                       MONO_START_BB (cfg, end_bb);
+                       return ins;
+               }
        } else if (cmethod->klass == mono_defaults.thread_class) {
                if (strcmp (cmethod->name, "SpinWait_nop") == 0 && fsig->param_count == 0) {
                        MONO_INST_NEW (cfg, ins, OP_RELAXED_NOP);
index cb5ddd33e79032ea2a81781d811f6df9ef68e754..6fab934f479b6d7503dffc9e043e367814bc9db2 100644 (file)
@@ -28,6 +28,7 @@
 #include <llvm/IR/Function.h>
 #include <llvm/IR/IRBuilder.h>
 #include <llvm/IR/Module.h>
+#include <llvm/IR/DIBuilder.h>
 
 #include "mini-llvm-cpp.h"
 
@@ -216,3 +217,11 @@ mono_llvm_set_call_preserveall_cc (LLVMValueRef func)
 {
        unwrap<CallInst>(func)->setCallingConv (CallingConv::PreserveAll);
 }
+
+void
+mono_llvm_create_di_compile_unit (LLVMModuleRef module)
+{
+       DIBuilder d(*unwrap(module));
+
+       d.createCompileUnit (0, "X", "Y", "Z", false, "", 0, "", DIBuilder::DebugEmissionKind::FullDebug, true);
+}
index 78bccd07ff9422a5adcc1ddc75af0343f5a84a8c..9e551e2557d8ace03612505abb36b9c4f2c2310f 100644 (file)
@@ -111,6 +111,9 @@ mono_llvm_set_unhandled_exception_handler (void);
 void
 default_mono_llvm_unhandled_exception (void);
 
+void
+mono_llvm_create_di_compile_unit (LLVMModuleRef module);
+
 G_END_DECLS
 
 #endif /* __MONO_MINI_LLVM_CPP_H__ */  
index 3484ed3faecd954d4e87bd83f8e16699f43d47a8..ae0767d176978ff9c286055cca1c9e96de665d47 100644 (file)
@@ -7999,6 +7999,8 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name)
        emit_dbg_info (&aot_module, filename, cu_name);
        emit_aot_file_info (&aot_module);
 
+       mono_llvm_create_di_compile_unit (aot_module.lmodule);
+
        /*
         * Replace GOT entries for directly callable methods with the methods themselves.
         * It would be easier to implement this by predefining all methods before compiling
index 997f198c80bfedde195bbaefcae02441f87c40fb..170cc65e7bd98d7bab78a20e6b21c046a19554cf 100644 (file)
@@ -48,6 +48,7 @@
 #include <mono/metadata/attach.h>
 #include <mono/metadata/runtime.h>
 #include <mono/metadata/reflection-internals.h>
+#include <mono/metadata/monitor.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
@@ -711,6 +712,19 @@ register_icall_no_wrapper (gpointer func, const char *name, const char *sigstr)
        mono_register_jit_icall_full (func, name, sig, TRUE, FALSE, name);
 }
 
+static void
+register_icall_with_wrapper (gpointer func, const char *name, const char *sigstr)
+{
+       MonoMethodSignature *sig;
+
+       if (sigstr)
+               sig = mono_create_icall_signature (sigstr);
+       else
+               sig = NULL;
+
+       mono_register_jit_icall_full (func, name, sig, FALSE, FALSE, NULL);
+}
+
 static void
 register_dyn_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
 {
@@ -1341,11 +1355,13 @@ mono_patch_info_equal (gconstpointer ka, gconstpointer kb)
 }
 
 gpointer
-mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors)
+mono_resolve_patch_target_checked (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors, MonoError *error)
 {
        unsigned char *ip = patch_info->ip.i + code;
        gconstpointer target = NULL;
 
+       mono_error_init (error);
+
        switch (patch_info->type) {
        case MONO_PATCH_INFO_BB:
                /*
@@ -1558,29 +1574,27 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
        case MONO_PATCH_INFO_TYPE_FROM_HANDLE: {
                gpointer handle;
                MonoClass *handle_class;
-               MonoError error;
 
                handle = mono_ldtoken_checked (patch_info->data.token->image,
-                                                          patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, &error);
-               if (!mono_error_ok (&error))
-                       g_error ("Could not patch ldtoken due to %s", mono_error_get_message (&error));
+                                                          patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
+               if (!mono_error_ok (error))
+                       g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
                mono_class_init (handle_class);
                mono_class_init (mono_class_from_mono_type ((MonoType *)handle));
 
-               target = mono_type_get_object_checked (domain, (MonoType *)handle, &error);
-               mono_error_raise_exception (&error);
-
+               target = mono_type_get_object_checked (domain, (MonoType *)handle, error);
+               if (!mono_error_ok (error))
+                       return NULL;
                break;
        }
        case MONO_PATCH_INFO_LDTOKEN: {
                gpointer handle;
                MonoClass *handle_class;
-               MonoError error;
 
                handle = mono_ldtoken_checked (patch_info->data.token->image,
-                                                          patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, &error);
-               if (!mono_error_ok (&error))
-                       g_error ("Could not patch ldtoken due to %s", mono_error_get_message (&error));
+                                                          patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
+               if (!mono_error_ok (error))
+                       g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
                mono_class_init (handle_class);
 
                target = handle;
@@ -1598,8 +1612,10 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                        if (run_cctors) {
                                target = mono_lookup_pinvoke_call (patch_info->data.method, &exc_class, &exc_arg);
                                if (!target) {
-                                       if (mono_aot_only)
-                                               mono_raise_exception (mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg));
+                                       if (mono_aot_only) {
+                                               mono_error_set_exception_instance (error, mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg));
+                                               return NULL;
+                                       }
                                        g_error ("Unable to resolve pinvoke method '%s' Re-run with MONO_LOG_LEVEL=debug for more information.\n", mono_method_full_name (patch_info->data.method, TRUE));
                                }
                        } else {
@@ -1714,6 +1730,17 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
        return (gpointer)target;
 }
 
+gpointer
+mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors)
+{
+       MonoError error;
+       gpointer res;
+
+       res = mono_resolve_patch_target_checked (method, domain, code, patch_info, run_cctors, &error);
+       mono_error_raise_exception (&error); /* FIXME don't raise here */
+       return res;
+}
+
 void
 mini_init_gsctx (MonoDomain *domain, MonoMemPool *mp, MonoGenericContext *context, MonoGenericSharingContext *gsctx)
 {
@@ -3948,6 +3975,11 @@ register_icalls (void)
        register_icall (mono_get_assembly_object, "mono_get_assembly_object", "object ptr", TRUE);
        register_icall (mono_get_method_object, "mono_get_method_object", "object ptr", TRUE);
 
+       register_icall_with_wrapper (mono_monitor_enter, "mono_monitor_enter", "void obj");
+       register_icall_with_wrapper (mono_monitor_enter_v4, "mono_monitor_enter_v4", "void obj ptr");
+       register_icall_no_wrapper (mono_monitor_enter_fast, "mono_monitor_enter_fast", "int obj");
+       register_icall_no_wrapper (mono_monitor_enter_v4_fast, "mono_monitor_enter_v4_fast", "int obj ptr");
+
 #ifdef TARGET_IOS
        register_icall (pthread_getspecific, "pthread_getspecific", "ptr ptr", TRUE);
 #endif
index a28fd9168d38616ba856829ab4f7987fbee9db3a..a624f37d37e1aa1a857c73f886feaeee657cbca4 100644 (file)
@@ -1006,11 +1006,16 @@ mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *aot_module,
 {
        guint32 plt_info_offset = mono_aot_get_plt_info_offset (regs, code);
        gpointer res;
+       MonoError error;
 
        trampoline_calls ++;
 
-       res = mono_aot_plt_resolve (aot_module, plt_info_offset, code);
+       res = mono_aot_plt_resolve (aot_module, plt_info_offset, code, &error);
        if (!res) {
+               if (!mono_error_ok (&error)) {
+                       mono_error_set_pending_exception (&error);
+                       return NULL;
+               }
                if (mono_loader_get_last_error ()) {
                        MonoError error;
 
index 81ef032a467a828e45969b030b7a06130135b251..1b1c728f248b36ad128429b235aa9607940e4754 100644 (file)
@@ -2324,6 +2324,7 @@ guint     mono_patch_info_hash (gconstpointer data);
 gint      mono_patch_info_equal (gconstpointer ka, gconstpointer kb);
 MonoJumpInfo *mono_patch_info_list_prepend  (MonoJumpInfo *list, int ip, MonoJumpInfoType type, gconstpointer target);
 gpointer  mono_resolve_patch_target         (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors) MONO_LLVM_INTERNAL;
+gpointer  mono_resolve_patch_target_checked (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors, MonoError *error) MONO_LLVM_INTERNAL;
 gpointer  mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji);
 gpointer  mono_jit_find_compiled_method     (MonoDomain *domain, MonoMethod *method);
 gpointer  mono_jit_compile_method           (MonoMethod *method, MonoError *error);
@@ -2438,7 +2439,7 @@ guint32   mono_aot_get_plt_info_offset      (mgreg_t *regs, guint8 *code);
 gboolean  mono_aot_get_cached_class_info    (MonoClass *klass, MonoCachedClassInfo *res);
 gboolean  mono_aot_get_class_from_name      (MonoImage *image, const char *name_space, const char *name, MonoClass **klass);
 MonoJitInfo* mono_aot_find_jit_info         (MonoDomain *domain, MonoImage *image, gpointer addr);
-gpointer mono_aot_plt_resolve               (gpointer aot_module, guint32 plt_info_offset, guint8 *code);
+gpointer mono_aot_plt_resolve               (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error);
 void     mono_aot_patch_plt_entry           (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr);
 gpointer mono_aot_get_method_from_vt_slot   (MonoDomain *domain, MonoVTable *vtable, int slot);
 gpointer mono_aot_create_specific_trampoline   (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
index 1dc7a5e64cd6bbea5246e4570f7a0dbb7d321535..39cf237bf87a15ac51d69d4da8c1eee9f47cc52d 100644 (file)
@@ -115,6 +115,6 @@ endif
 suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
 suppression_DATA = mono-profiler-log.suppression
 
-EXTRA_DIST=utils.c utils.h proflog.h perf_event.h \
+EXTRA_DIST=utils.c utils.h proflog.h \
        $(PLOG_TESTS_SRC) ptestrunner.pl \
        $(suppression_DATA)
diff --git a/mono/profiler/perf_event.h b/mono/profiler/perf_event.h
deleted file mode 100644 (file)
index 3137aea..0000000
+++ /dev/null
@@ -1,1147 +0,0 @@
-/*
- * Performance events:
- *
- *    Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
- *    Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
- *    Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
- *
- * Data type definitions, declarations, prototypes.
- *
- *    Started by: Thomas Gleixner and Ingo Molnar
- *
- * For licencing details see kernel-base/COPYING
- */
-#ifndef _LINUX_PERF_EVENT_H
-#define _LINUX_PERF_EVENT_H
-
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#include <asm/byteorder.h>
-
-#include "mono/utils/mono-compiler.h"
-
-/*
- * User-space ABI bits:
- */
-
-/*
- * attr.type
- */
-enum perf_type_id {
-       PERF_TYPE_HARDWARE                      = 0,
-       PERF_TYPE_SOFTWARE                      = 1,
-       PERF_TYPE_TRACEPOINT                    = 2,
-       PERF_TYPE_HW_CACHE                      = 3,
-       PERF_TYPE_RAW                           = 4,
-       PERF_TYPE_BREAKPOINT                    = 5,
-
-       PERF_TYPE_MAX,                          /* non-ABI */
-};
-
-/*
- * Generalized performance event event_id types, used by the
- * attr.event_id parameter of the sys_perf_event_open()
- * syscall:
- */
-enum perf_hw_id {
-       /*
-        * Common hardware events, generalized by the kernel:
-        */
-       PERF_COUNT_HW_CPU_CYCLES                = 0,
-       PERF_COUNT_HW_INSTRUCTIONS              = 1,
-       PERF_COUNT_HW_CACHE_REFERENCES          = 2,
-       PERF_COUNT_HW_CACHE_MISSES              = 3,
-       PERF_COUNT_HW_BRANCH_INSTRUCTIONS       = 4,
-       PERF_COUNT_HW_BRANCH_MISSES             = 5,
-       PERF_COUNT_HW_BUS_CYCLES                = 6,
-
-       PERF_COUNT_HW_MAX,                      /* non-ABI */
-};
-
-/*
- * Generalized hardware cache events:
- *
- *       { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
- *       { read, write, prefetch } x
- *       { accesses, misses }
- */
-enum perf_hw_cache_id {
-       PERF_COUNT_HW_CACHE_L1D                 = 0,
-       PERF_COUNT_HW_CACHE_L1I                 = 1,
-       PERF_COUNT_HW_CACHE_LL                  = 2,
-       PERF_COUNT_HW_CACHE_DTLB                = 3,
-       PERF_COUNT_HW_CACHE_ITLB                = 4,
-       PERF_COUNT_HW_CACHE_BPU                 = 5,
-
-       PERF_COUNT_HW_CACHE_MAX,                /* non-ABI */
-};
-
-enum perf_hw_cache_op_id {
-       PERF_COUNT_HW_CACHE_OP_READ             = 0,
-       PERF_COUNT_HW_CACHE_OP_WRITE            = 1,
-       PERF_COUNT_HW_CACHE_OP_PREFETCH         = 2,
-
-       PERF_COUNT_HW_CACHE_OP_MAX,             /* non-ABI */
-};
-
-enum perf_hw_cache_op_result_id {
-       PERF_COUNT_HW_CACHE_RESULT_ACCESS       = 0,
-       PERF_COUNT_HW_CACHE_RESULT_MISS         = 1,
-
-       PERF_COUNT_HW_CACHE_RESULT_MAX,         /* non-ABI */
-};
-
-/*
- * Special "software" events provided by the kernel, even if the hardware
- * does not support performance events. These events measure various
- * physical and sw events of the kernel (and allow the profiling of them as
- * well):
- */
-enum perf_sw_ids {
-       PERF_COUNT_SW_CPU_CLOCK                 = 0,
-       PERF_COUNT_SW_TASK_CLOCK                = 1,
-       PERF_COUNT_SW_PAGE_FAULTS               = 2,
-       PERF_COUNT_SW_CONTEXT_SWITCHES          = 3,
-       PERF_COUNT_SW_CPU_MIGRATIONS            = 4,
-       PERF_COUNT_SW_PAGE_FAULTS_MIN           = 5,
-       PERF_COUNT_SW_PAGE_FAULTS_MAJ           = 6,
-       PERF_COUNT_SW_ALIGNMENT_FAULTS          = 7,
-       PERF_COUNT_SW_EMULATION_FAULTS          = 8,
-
-       PERF_COUNT_SW_MAX,                      /* non-ABI */
-};
-
-/*
- * Bits that can be set in attr.sample_type to request information
- * in the overflow packets.
- */
-enum perf_event_sample_format {
-       PERF_SAMPLE_IP                          = 1U << 0,
-       PERF_SAMPLE_TID                         = 1U << 1,
-       PERF_SAMPLE_TIME                        = 1U << 2,
-       PERF_SAMPLE_ADDR                        = 1U << 3,
-       PERF_SAMPLE_READ                        = 1U << 4,
-       PERF_SAMPLE_CALLCHAIN                   = 1U << 5,
-       PERF_SAMPLE_ID                          = 1U << 6,
-       PERF_SAMPLE_CPU                         = 1U << 7,
-       PERF_SAMPLE_PERIOD                      = 1U << 8,
-       PERF_SAMPLE_STREAM_ID                   = 1U << 9,
-       PERF_SAMPLE_RAW                         = 1U << 10,
-
-       PERF_SAMPLE_MAX = 1U << 11,             /* non-ABI */
-};
-
-/*
- * The format of the data returned by read() on a perf event fd,
- * as specified by attr.read_format:
- *
- * struct read_format {
- *     { u64           value;
- *       { u64         time_enabled; } && PERF_FORMAT_ENABLED
- *       { u64         time_running; } && PERF_FORMAT_RUNNING
- *       { u64         id;           } && PERF_FORMAT_ID
- *     } && !PERF_FORMAT_GROUP
- *
- *     { u64           nr;
- *       { u64         time_enabled; } && PERF_FORMAT_ENABLED
- *       { u64         time_running; } && PERF_FORMAT_RUNNING
- *       { u64         value;
- *         { u64       id;           } && PERF_FORMAT_ID
- *       }             cntr[nr];
- *     } && PERF_FORMAT_GROUP
- * };
- */
-enum perf_event_read_format {
-       PERF_FORMAT_TOTAL_TIME_ENABLED          = 1U << 0,
-       PERF_FORMAT_TOTAL_TIME_RUNNING          = 1U << 1,
-       PERF_FORMAT_ID                          = 1U << 2,
-       PERF_FORMAT_GROUP                       = 1U << 3,
-
-       PERF_FORMAT_MAX = 1U << 4,              /* non-ABI */
-};
-
-#define PERF_ATTR_SIZE_VER0    64      /* sizeof first published struct */
-
-/*
- * Hardware event_id to monitor via a performance monitoring event:
- */
-struct perf_event_attr {
-
-       /*
-        * Major type: hardware/software/tracepoint/etc.
-        */
-       __u32                   type;
-
-       /*
-        * Size of the attr structure, for fwd/bwd compat.
-        */
-       __u32                   size;
-
-       /*
-        * Type specific configuration information.
-        */
-       __u64                   config;
-
-       union {
-               __u64           sample_period;
-               __u64           sample_freq;
-       };
-
-       __u64                   sample_type;
-       __u64                   read_format;
-
-       __u64                   disabled       :  1, /* off by default        */
-                               inherit        :  1, /* children inherit it   */
-                               pinned         :  1, /* must always be on PMU */
-                               exclusive      :  1, /* only group on PMU     */
-                               exclude_user   :  1, /* don't count user      */
-                               exclude_kernel :  1, /* ditto kernel          */
-                               exclude_hv     :  1, /* ditto hypervisor      */
-                               exclude_idle   :  1, /* don't count when idle */
-                               mmap           :  1, /* include mmap data     */
-                               comm           :  1, /* include comm data     */
-                               freq           :  1, /* use freq, not period  */
-                               inherit_stat   :  1, /* per task counts       */
-                               enable_on_exec :  1, /* next exec enables     */
-                               task           :  1, /* trace fork/exit       */
-                               watermark      :  1, /* wakeup_watermark      */
-                               /*
-                                * precise_ip:
-                                *
-                                *  0 - SAMPLE_IP can have arbitrary skid
-                                *  1 - SAMPLE_IP must have constant skid
-                                *  2 - SAMPLE_IP requested to have 0 skid
-                                *  3 - SAMPLE_IP must have 0 skid
-                                *
-                                *  See also PERF_RECORD_MISC_EXACT_IP
-                                */
-                               precise_ip     :  2, /* skid constraint       */
-                               mmap_data      :  1, /* non-exec mmap data    */
-
-                               __reserved_1   : 46;
-
-       union {
-               __u32           wakeup_events;    /* wakeup every n events */
-               __u32           wakeup_watermark; /* bytes before wakeup   */
-       };
-
-       __u32                   bp_type;
-       __u64                   bp_addr;
-       __u64                   bp_len;
-};
-
-/*
- * Ioctls that can be done on a perf event fd:
- */
-#define PERF_EVENT_IOC_ENABLE          _IO ('$', 0)
-#define PERF_EVENT_IOC_DISABLE         _IO ('$', 1)
-#define PERF_EVENT_IOC_REFRESH         _IO ('$', 2)
-#define PERF_EVENT_IOC_RESET           _IO ('$', 3)
-#define PERF_EVENT_IOC_PERIOD          _IOW('$', 4, __u64)
-#define PERF_EVENT_IOC_SET_OUTPUT      _IO ('$', 5)
-#define PERF_EVENT_IOC_SET_FILTER      _IOW('$', 6, char *)
-
-enum perf_event_ioc_flags {
-       PERF_IOC_FLAG_GROUP             = 1U << 0,
-};
-
-/*
- * Structure of the page that can be mapped via mmap
- */
-struct perf_event_mmap_page {
-       __u32   version;                /* version number of this structure */
-       __u32   compat_version;         /* lowest version this is compat with */
-
-       /*
-        * Bits needed to read the hw events in user-space.
-        *
-        *   u32 seq;
-        *   s64 count;
-        *
-        *   do {
-        *     seq = pc->lock;
-        *
-        *     barrier()
-        *     if (pc->index) {
-        *       count = pmc_read(pc->index - 1);
-        *       count += pc->offset;
-        *     } else
-        *       goto regular_read;
-        *
-        *     barrier();
-        *   } while (pc->lock != seq);
-        *
-        * NOTE: for obvious reason this only works on self-monitoring
-        *       processes.
-        */
-       __u32   lock;                   /* seqlock for synchronization */
-       __u32   index;                  /* hardware event identifier */
-       __s64   offset;                 /* add to hardware event value */
-       __u64   time_enabled;           /* time event active */
-       __u64   time_running;           /* time event on cpu */
-
-               /*
-                * Hole for extension of the self monitor capabilities
-                */
-
-       __u64   __reserved[123];        /* align to 1k */
-
-       /*
-        * Control data for the mmap() data buffer.
-        *
-        * User-space reading the @data_head value should issue an rmb(), on
-        * SMP capable platforms, after reading this value -- see
-        * perf_event_wakeup().
-        *
-        * When the mapping is PROT_WRITE the @data_tail value should be
-        * written by userspace to reflect the last read data. In this case
-        * the kernel will not over-write unread data.
-        */
-       __u64   data_head;              /* head in the data section */
-       __u64   data_tail;              /* user-space written tail */
-};
-
-#define PERF_RECORD_MISC_CPUMODE_MASK          (7 << 0)
-#define PERF_RECORD_MISC_CPUMODE_UNKNOWN       (0 << 0)
-#define PERF_RECORD_MISC_KERNEL                        (1 << 0)
-#define PERF_RECORD_MISC_USER                  (2 << 0)
-#define PERF_RECORD_MISC_HYPERVISOR            (3 << 0)
-#define PERF_RECORD_MISC_GUEST_KERNEL          (4 << 0)
-#define PERF_RECORD_MISC_GUEST_USER            (5 << 0)
-
-/*
- * Indicates that the content of PERF_SAMPLE_IP points to
- * the actual instruction that triggered the event. See also
- * perf_event_attr::precise_ip.
- */
-#define PERF_RECORD_MISC_EXACT_IP              (1 << 14)
-/*
- * Reserve the last bit to indicate some extended misc field
- */
-#define PERF_RECORD_MISC_EXT_RESERVED          (1 << 15)
-
-struct perf_event_header {
-       __u32   type;
-       __u16   misc;
-       __u16   size;
-};
-
-enum perf_event_type {
-
-       /*
-        * The MMAP events record the PROT_EXEC mappings so that we can
-        * correlate userspace IPs to code. They have the following structure:
-        *
-        * struct {
-        *      struct perf_event_header        header;
-        *
-        *      u32                             pid, tid;
-        *      u64                             addr;
-        *      u64                             len;
-        *      u64                             pgoff;
-        *      char                            filename[];
-        * };
-        */
-       PERF_RECORD_MMAP                        = 1,
-
-       /*
-        * struct {
-        *      struct perf_event_header        header;
-        *      u64                             id;
-        *      u64                             lost;
-        * };
-        */
-       PERF_RECORD_LOST                        = 2,
-
-       /*
-        * struct {
-        *      struct perf_event_header        header;
-        *
-        *      u32                             pid, tid;
-        *      char                            comm[];
-        * };
-        */
-       PERF_RECORD_COMM                        = 3,
-
-       /*
-        * struct {
-        *      struct perf_event_header        header;
-        *      u32                             pid, ppid;
-        *      u32                             tid, ptid;
-        *      u64                             time;
-        * };
-        */
-       PERF_RECORD_EXIT                        = 4,
-
-       /*
-        * struct {
-        *      struct perf_event_header        header;
-        *      u64                             time;
-        *      u64                             id;
-        *      u64                             stream_id;
-        * };
-        */
-       PERF_RECORD_THROTTLE                    = 5,
-       PERF_RECORD_UNTHROTTLE                  = 6,
-
-       /*
-        * struct {
-        *      struct perf_event_header        header;
-        *      u32                             pid, ppid;
-        *      u32                             tid, ptid;
-        *      u64                             time;
-        * };
-        */
-       PERF_RECORD_FORK                        = 7,
-
-       /*
-        * struct {
-        *      struct perf_event_header        header;
-        *      u32                             pid, tid;
-        *
-        *      struct read_format              values;
-        * };
-        */
-       PERF_RECORD_READ                        = 8,
-
-       /*
-        * struct {
-        *      struct perf_event_header        header;
-        *
-        *      { u64                   ip;       } && PERF_SAMPLE_IP
-        *      { u32                   pid, tid; } && PERF_SAMPLE_TID
-        *      { u64                   time;     } && PERF_SAMPLE_TIME
-        *      { u64                   addr;     } && PERF_SAMPLE_ADDR
-        *      { u64                   id;       } && PERF_SAMPLE_ID
-        *      { u64                   stream_id;} && PERF_SAMPLE_STREAM_ID
-        *      { u32                   cpu, res; } && PERF_SAMPLE_CPU
-        *      { u64                   period;   } && PERF_SAMPLE_PERIOD
-        *
-        *      { struct read_format    values;   } && PERF_SAMPLE_READ
-        *
-        *      { u64                   nr,
-        *        u64                   ips[nr];  } && PERF_SAMPLE_CALLCHAIN
-        *
-        *      #
-        *      # The RAW record below is opaque data wrt the ABI
-        *      #
-        *      # That is, the ABI doesn't make any promises wrt to
-        *      # the stability of its content, it may vary depending
-        *      # on event, hardware, kernel version and phase of
-        *      # the moon.
-        *      #
-        *      # In other words, PERF_SAMPLE_RAW contents are not an ABI.
-        *      #
-        *
-        *      { u32                   size;
-        *        char                  data[size];}&& PERF_SAMPLE_RAW
-        * };
-        */
-       PERF_RECORD_SAMPLE                      = 9,
-
-       PERF_RECORD_MAX,                        /* non-ABI */
-};
-
-enum perf_callchain_context {
-       PERF_CONTEXT_HV                 = (__u64)-32,
-       PERF_CONTEXT_KERNEL             = (__u64)-128,
-       PERF_CONTEXT_USER               = (__u64)-512,
-
-       PERF_CONTEXT_GUEST              = (__u64)-2048,
-       PERF_CONTEXT_GUEST_KERNEL       = (__u64)-2176,
-       PERF_CONTEXT_GUEST_USER         = (__u64)-2560,
-
-       PERF_CONTEXT_MAX                = (__u64)-4095,
-};
-
-#define PERF_FLAG_FD_NO_GROUP  (1U << 0)
-#define PERF_FLAG_FD_OUTPUT    (1U << 1)
-
-#ifdef __KERNEL__
-/*
- * Kernel-internal data types and definitions:
- */
-
-#ifdef CONFIG_PERF_EVENTS
-# include <asm/perf_event.h>
-# include <asm/local64.h>
-#endif
-
-struct perf_guest_info_callbacks {
-       int (*is_in_guest) (void);
-       int (*is_user_mode) (void);
-       unsigned long (*get_guest_ip) (void);
-};
-
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
-#include <asm/hw_breakpoint.h>
-#endif
-
-#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/rculist.h>
-#include <linux/rcupdate.h>
-#include <linux/spinlock.h>
-#include <linux/hrtimer.h>
-#include <linux/fs.h>
-#include <linux/pid_namespace.h>
-#include <linux/workqueue.h>
-#include <linux/ftrace.h>
-#include <linux/cpu.h>
-#include <linux/irq_work.h>
-#include <linux/jump_label_ref.h>
-#include <asm/atomic.h>
-#include <asm/local.h>
-
-#define PERF_MAX_STACK_DEPTH           255
-
-struct perf_callchain_entry {
-       __u64                           nr;
-       __u64                           ip[PERF_MAX_STACK_DEPTH];
-};
-
-struct perf_raw_record {
-       u32                             size;
-       void                            *data;
-};
-
-struct perf_branch_entry {
-       __u64                           from;
-       __u64                           to;
-       __u64                           flags;
-};
-
-struct perf_branch_stack {
-       __u64                           nr;
-       struct perf_branch_entry        entries[0];
-};
-
-struct task_struct;
-
-/**
- * struct hw_perf_event - performance event hardware details:
- */
-struct hw_perf_event {
-#ifdef CONFIG_PERF_EVENTS
-       union {
-               struct { /* hardware */
-                       u64             config;
-                       u64             last_tag;
-                       unsigned long   config_base;
-                       unsigned long   event_base;
-                       int             idx;
-                       int             last_cpu;
-               };
-               struct { /* software */
-                       struct hrtimer  hrtimer;
-               };
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
-               struct { /* breakpoint */
-                       struct arch_hw_breakpoint       info;
-                       struct list_head                bp_list;
-                       /*
-                        * Crufty hack to avoid the chicken and egg
-                        * problem hw_breakpoint has with context
-                        * creation and event initalization.
-                        */
-                       struct task_struct              *bp_target;
-               };
-#endif
-       };
-       int                             state;
-       local64_t                       prev_count;
-       u64                             sample_period;
-       u64                             last_period;
-       local64_t                       period_left;
-       u64                             interrupts;
-
-       u64                             freq_time_stamp;
-       u64                             freq_count_stamp;
-#endif
-};
-
-/*
- * hw_perf_event::state flags
- */
-#define PERF_HES_STOPPED       0x01 /* the counter is stopped */
-#define PERF_HES_UPTODATE      0x02 /* event->count up-to-date */
-#define PERF_HES_ARCH          0x04
-
-struct perf_event;
-
-/*
- * Common implementation detail of pmu::{start,commit,cancel}_txn
- */
-#define PERF_EVENT_TXN 0x1
-
-/**
- * struct pmu - generic performance monitoring unit
- */
-struct pmu {
-       struct list_head                entry;
-
-       int * __percpu                  pmu_disable_count;
-       struct perf_cpu_context * __percpu pmu_cpu_context;
-       int                             task_ctx_nr;
-
-       /*
-        * Fully disable/enable this PMU, can be used to protect from the PMI
-        * as well as for lazy/batch writing of the MSRs.
-        */
-       void (*pmu_enable)              (struct pmu *pmu); /* optional */
-       void (*pmu_disable)             (struct pmu *pmu); /* optional */
-
-       /*
-        * Try and initialize the event for this PMU.
-        * Should return -ENOENT when the @event doesn't match this PMU.
-        */
-       int (*event_init)               (struct perf_event *event);
-
-#define PERF_EF_START  0x01            /* start the counter when adding    */
-#define PERF_EF_RELOAD 0x02            /* reload the counter when starting */
-#define PERF_EF_UPDATE 0x04            /* update the counter when stopping */
-
-       /*
-        * Adds/Removes a counter to/from the PMU, can be done inside
-        * a transaction, see the ->*_txn() methods.
-        */
-       int  (*add)                     (struct perf_event *event, int flags);
-       void (*del)                     (struct perf_event *event, int flags);
-
-       /*
-        * Starts/Stops a counter present on the PMU. The PMI handler
-        * should stop the counter when perf_event_overflow() returns
-        * !0. ->start() will be used to continue.
-        */
-       void (*start)                   (struct perf_event *event, int flags);
-       void (*stop)                    (struct perf_event *event, int flags);
-
-       /*
-        * Updates the counter value of the event.
-        */
-       void (*read)                    (struct perf_event *event);
-
-       /*
-        * Group events scheduling is treated as a transaction, add
-        * group events as a whole and perform one schedulability test.
-        * If the test fails, roll back the whole group
-        *
-        * Start the transaction, after this ->add() doesn't need to
-        * do schedulability tests.
-        */
-       void (*start_txn)       (struct pmu *pmu); /* optional */
-       /*
-        * If ->start_txn() disabled the ->add() schedulability test
-        * then ->commit_txn() is required to perform one. On success
-        * the transaction is closed. On error the transaction is kept
-        * open until ->cancel_txn() is called.
-        */
-       int  (*commit_txn)      (struct pmu *pmu); /* optional */
-       /*
-        * Will cancel the transaction, assumes ->del() is called
-        * for each successfull ->add() during the transaction.
-        */
-       void (*cancel_txn)      (struct pmu *pmu); /* optional */
-};
-
-/**
- * enum perf_event_active_state - the states of a event
- */
-enum perf_event_active_state {
-       PERF_EVENT_STATE_ERROR          = -2,
-       PERF_EVENT_STATE_OFF            = -1,
-       PERF_EVENT_STATE_INACTIVE       =  0,
-       PERF_EVENT_STATE_ACTIVE         =  1,
-};
-
-struct file;
-
-#define PERF_BUFFER_WRITABLE           0x01
-
-struct perf_buffer {
-       atomic_t                        refcount;
-       struct rcu_head                 rcu_head;
-#ifdef CONFIG_PERF_USE_VMALLOC
-       struct work_struct              work;
-       int                             page_order;     /* allocation order  */
-#endif
-       int                             nr_pages;       /* nr of data pages  */
-       int                             writable;       /* are we writable   */
-
-       atomic_t                        poll;           /* POLL_ for wakeups */
-
-       local_t                         head;           /* write position    */
-       local_t                         nest;           /* nested writers    */
-       local_t                         events;         /* event limit       */
-       local_t                         wakeup;         /* wakeup stamp      */
-       local_t                         lost;           /* nr records lost   */
-
-       long                            watermark;      /* wakeup watermark  */
-
-       struct perf_event_mmap_page     *user_page;
-       void                            *data_pages[0];
-};
-
-struct perf_sample_data;
-
-typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
-                                       struct perf_sample_data *,
-                                       struct pt_regs *regs);
-
-enum perf_group_flag {
-       PERF_GROUP_SOFTWARE = 0x1,
-};
-
-#define SWEVENT_HLIST_BITS     8
-#define SWEVENT_HLIST_SIZE     (1 << SWEVENT_HLIST_BITS)
-
-struct swevent_hlist {
-       struct hlist_head       heads[SWEVENT_HLIST_SIZE];
-       struct rcu_head         rcu_head;
-};
-
-#define PERF_ATTACH_CONTEXT    0x01
-#define PERF_ATTACH_GROUP      0x02
-#define PERF_ATTACH_TASK       0x04
-
-/**
- * struct perf_event - performance event kernel representation:
- */
-struct perf_event {
-#ifdef CONFIG_PERF_EVENTS
-       struct list_head                group_entry;
-       struct list_head                event_entry;
-       struct list_head                sibling_list;
-       struct hlist_node               hlist_entry;
-       int                             nr_siblings;
-       int                             group_flags;
-       struct perf_event               *group_leader;
-       struct pmu                      *pmu;
-
-       enum perf_event_active_state    state;
-       unsigned int                    attach_state;
-       local64_t                       count;
-       atomic64_t                      child_count;
-
-       /*
-        * These are the total time in nanoseconds that the event
-        * has been enabled (i.e. eligible to run, and the task has
-        * been scheduled in, if this is a per-task event)
-        * and running (scheduled onto the CPU), respectively.
-        *
-        * They are computed from tstamp_enabled, tstamp_running and
-        * tstamp_stopped when the event is in INACTIVE or ACTIVE state.
-        */
-       u64                             total_time_enabled;
-       u64                             total_time_running;
-
-       /*
-        * These are timestamps used for computing total_time_enabled
-        * and total_time_running when the event is in INACTIVE or
-        * ACTIVE state, measured in nanoseconds from an arbitrary point
-        * in time.
-        * tstamp_enabled: the notional time when the event was enabled
-        * tstamp_running: the notional time when the event was scheduled on
-        * tstamp_stopped: in INACTIVE state, the notional time when the
-        *      event was scheduled off.
-        */
-       u64                             tstamp_enabled;
-       u64                             tstamp_running;
-       u64                             tstamp_stopped;
-
-       struct perf_event_attr          attr;
-       struct hw_perf_event            hw;
-
-       struct perf_event_context       *ctx;
-       struct file                     *filp;
-
-       /*
-        * These accumulate total time (in nanoseconds) that children
-        * events have been enabled and running, respectively.
-        */
-       atomic64_t                      child_total_time_enabled;
-       atomic64_t                      child_total_time_running;
-
-       /*
-        * Protect attach/detach and child_list:
-        */
-       struct mutex                    child_mutex;
-       struct list_head                child_list;
-       struct perf_event               *parent;
-
-       int                             oncpu;
-       int                             cpu;
-
-       struct list_head                owner_entry;
-       struct task_struct              *owner;
-
-       /* mmap bits */
-       struct mutex                    mmap_mutex;
-       atomic_t                        mmap_count;
-       int                             mmap_locked;
-       struct user_struct              *mmap_user;
-       struct perf_buffer              *buffer;
-
-       /* poll related */
-       wait_queue_head_t               waitq;
-       struct fasync_struct            *fasync;
-
-       /* delayed work for NMIs and such */
-       int                             pending_wakeup;
-       int                             pending_kill;
-       int                             pending_disable;
-       struct irq_work                 pending;
-
-       atomic_t                        event_limit;
-
-       void (*destroy)(struct perf_event *);
-       struct rcu_head                 rcu_head;
-
-       struct pid_namespace            *ns;
-       u64                             id;
-
-       perf_overflow_handler_t         overflow_handler;
-
-#ifdef CONFIG_EVENT_TRACING
-       struct ftrace_event_call        *tp_event;
-       struct event_filter             *filter;
-#endif
-
-#endif /* CONFIG_PERF_EVENTS */
-};
-
-enum perf_event_context_type {
-       task_context,
-       cpu_context,
-};
-
-/**
- * struct perf_event_context - event context structure
- *
- * Used as a container for task events and CPU events as well:
- */
-struct perf_event_context {
-       enum perf_event_context_type    type;
-       struct pmu                      *pmu;
-       /*
-        * Protect the states of the events in the list,
-        * nr_active, and the list:
-        */
-       raw_spinlock_t                  lock;
-       /*
-        * Protect the list of events.  Locking either mutex or lock
-        * is sufficient to ensure the list doesn't change; to change
-        * the list you need to lock both the mutex and the spinlock.
-        */
-       struct mutex                    mutex;
-
-       struct list_head                pinned_groups;
-       struct list_head                flexible_groups;
-       struct list_head                event_list;
-       int                             nr_events;
-       int                             nr_active;
-       int                             is_active;
-       int                             nr_stat;
-       atomic_t                        refcount;
-       struct task_struct              *task;
-
-       /*
-        * Context clock, runs when context enabled.
-        */
-       u64                             time;
-       u64                             timestamp;
-
-       /*
-        * These fields let us detect when two contexts have both
-        * been cloned (inherited) from a common ancestor.
-        */
-       struct perf_event_context       *parent_ctx;
-       u64                             parent_gen;
-       u64                             generation;
-       int                             pin_count;
-       struct rcu_head                 rcu_head;
-};
-
-/*
- * Number of contexts where an event can trigger:
- *     task, softirq, hardirq, nmi.
- */
-#define PERF_NR_CONTEXTS       4
-
-/**
- * struct perf_event_cpu_context - per cpu event context structure
- */
-struct perf_cpu_context {
-       struct perf_event_context       ctx;
-       struct perf_event_context       *task_ctx;
-       int                             active_oncpu;
-       int                             exclusive;
-       struct list_head                rotation_list;
-       int                             jiffies_interval;
-};
-
-struct perf_output_handle {
-       struct perf_event               *event;
-       struct perf_buffer              *buffer;
-       unsigned long                   wakeup;
-       unsigned long                   size;
-       void                            *addr;
-       int                             page;
-       int                             nmi;
-       int                             sample;
-};
-
-#ifdef CONFIG_PERF_EVENTS
-
-extern int perf_pmu_register(struct pmu *pmu);
-extern void perf_pmu_unregister(struct pmu *pmu);
-
-extern int perf_num_counters(void);
-extern const char *perf_pmu_name(void);
-extern void __perf_event_task_sched_in(struct task_struct *task);
-extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
-
-extern atomic_t perf_task_events;
-
-static inline void perf_event_task_sched_in(struct task_struct *task)
-{
-       COND_STMT(&perf_task_events, __perf_event_task_sched_in(task));
-}
-
-static inline
-void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
-{
-       COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next));
-}
-
-extern int perf_event_init_task(struct task_struct *child);
-extern void perf_event_exit_task(struct task_struct *child);
-extern void perf_event_free_task(struct task_struct *task);
-extern void perf_event_delayed_put(struct task_struct *task);
-extern void perf_event_print_debug(void);
-extern void perf_pmu_disable(struct pmu *pmu);
-extern void perf_pmu_enable(struct pmu *pmu);
-extern int perf_event_task_disable(void);
-extern int perf_event_task_enable(void);
-extern void perf_event_update_userpage(struct perf_event *event);
-extern int perf_event_release_kernel(struct perf_event *event);
-extern struct perf_event *
-perf_event_create_kernel_counter(struct perf_event_attr *attr,
-                               int cpu,
-                               struct task_struct *task,
-                               perf_overflow_handler_t callback);
-extern u64 perf_event_read_value(struct perf_event *event,
-                                u64 *enabled, u64 *running);
-
-struct perf_sample_data {
-       u64                             type;
-
-       u64                             ip;
-       struct {
-               u32     pid;
-               u32     tid;
-       }                               tid_entry;
-       u64                             time;
-       u64                             addr;
-       u64                             id;
-       u64                             stream_id;
-       struct {
-               u32     cpu;
-               u32     reserved;
-       }                               cpu_entry;
-       u64                             period;
-       struct perf_callchain_entry     *callchain;
-       struct perf_raw_record          *raw;
-};
-
-static inline
-void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
-{
-       data->addr = addr;
-       data->raw  = NULL;
-}
-
-extern void perf_output_sample(struct perf_output_handle *handle,
-                              struct perf_event_header *header,
-                              struct perf_sample_data *data,
-                              struct perf_event *event);
-extern void perf_prepare_sample(struct perf_event_header *header,
-                               struct perf_sample_data *data,
-                               struct perf_event *event,
-                               struct pt_regs *regs);
-
-extern int perf_event_overflow(struct perf_event *event, int nmi,
-                                struct perf_sample_data *data,
-                                struct pt_regs *regs);
-
-/*
- * Return 1 for a software event, 0 for a hardware event
- */
-static inline int is_software_event(struct perf_event *event)
-{
-       return event->pmu->task_ctx_nr == perf_sw_context;
-}
-
-extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
-
-extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
-
-#ifndef perf_arch_fetch_caller_regs
-static inline void
-perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { }
-#endif
-
-/*
- * Take a snapshot of the regs. Skip ip and frame pointer to
- * the nth caller. We only need a few of the regs:
- * - ip for PERF_SAMPLE_IP
- * - cs for user_mode() tests
- * - bp for callchains
- * - eflags, for future purposes, just in case
- */
-static inline void perf_fetch_caller_regs(struct pt_regs *regs)
-{
-       memset(regs, 0, sizeof(*regs));
-
-       perf_arch_fetch_caller_regs(regs, CALLER_ADDR0);
-}
-
-static MONO_ALWAYS_INLINE void
-perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
-{
-       struct pt_regs hot_regs;
-
-       JUMP_LABEL(&perf_swevent_enabled[event_id], have_event);
-       return;
-
-have_event:
-       if (!regs) {
-               perf_fetch_caller_regs(&hot_regs);
-               regs = &hot_regs;
-       }
-       __perf_sw_event(event_id, nr, nmi, regs, addr);
-}
-
-extern void perf_event_mmap(struct vm_area_struct *vma);
-extern struct perf_guest_info_callbacks *perf_guest_cbs;
-extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
-extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
-
-extern void perf_event_comm(struct task_struct *tsk);
-extern void perf_event_fork(struct task_struct *tsk);
-
-/* Callchains */
-DECLARE_PER_CPU(struct perf_callchain_entry, perf_callchain_entry);
-
-extern void perf_callchain_user(struct perf_callchain_entry *entry,
-                               struct pt_regs *regs);
-extern void perf_callchain_kernel(struct perf_callchain_entry *entry,
-                                 struct pt_regs *regs);
-
-
-static inline void
-perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
-{
-       if (entry->nr < PERF_MAX_STACK_DEPTH)
-               entry->ip[entry->nr++] = ip;
-}
-
-extern int sysctl_perf_event_paranoid;
-extern int sysctl_perf_event_mlock;
-extern int sysctl_perf_event_sample_rate;
-
-static inline bool perf_paranoid_tracepoint_raw(void)
-{
-       return sysctl_perf_event_paranoid > -1;
-}
-
-static inline bool perf_paranoid_cpu(void)
-{
-       return sysctl_perf_event_paranoid > 0;
-}
-
-static inline bool perf_paranoid_kernel(void)
-{
-       return sysctl_perf_event_paranoid > 1;
-}
-
-extern void perf_event_init(void);
-extern void perf_tp_event(u64 addr, u64 count, void *record,
-                         int entry_size, struct pt_regs *regs,
-                         struct hlist_head *head, int rctx);
-extern void perf_bp_event(struct perf_event *event, void *data);
-
-#ifndef perf_misc_flags
-#define perf_misc_flags(regs)  (user_mode(regs) ? PERF_RECORD_MISC_USER : \
-                                PERF_RECORD_MISC_KERNEL)
-#define perf_instruction_pointer(regs) instruction_pointer(regs)
-#endif
-
-extern int perf_output_begin(struct perf_output_handle *handle,
-                            struct perf_event *event, unsigned int size,
-                            int nmi, int sample);
-extern void perf_output_end(struct perf_output_handle *handle);
-extern void perf_output_copy(struct perf_output_handle *handle,
-                            const void *buf, unsigned int len);
-extern int perf_swevent_get_recursion_context(void);
-extern void perf_swevent_put_recursion_context(int rctx);
-extern void perf_event_enable(struct perf_event *event);
-extern void perf_event_disable(struct perf_event *event);
-extern void perf_event_task_tick(void);
-#else
-static inline void
-perf_event_task_sched_in(struct task_struct *task)                     { }
-static inline void
-perf_event_task_sched_out(struct task_struct *task,
-                           struct task_struct *next)                   { }
-static inline int perf_event_init_task(struct task_struct *child)      { return 0; }
-static inline void perf_event_exit_task(struct task_struct *child)     { }
-static inline void perf_event_free_task(struct task_struct *task)      { }
-static inline void perf_event_delayed_put(struct task_struct *task)    { }
-static inline void perf_event_print_debug(void)                                { }
-static inline int perf_event_task_disable(void)                                { return -EINVAL; }
-static inline int perf_event_task_enable(void)                         { return -EINVAL; }
-
-static inline void
-perf_sw_event(u32 event_id, u64 nr, int nmi,
-                    struct pt_regs *regs, u64 addr)                    { }
-static inline void
-perf_bp_event(struct perf_event *event, void *data)                    { }
-
-static inline int perf_register_guest_info_callbacks
-(struct perf_guest_info_callbacks *callbacks) { return 0; }
-static inline int perf_unregister_guest_info_callbacks
-(struct perf_guest_info_callbacks *callbacks) { return 0; }
-
-static inline void perf_event_mmap(struct vm_area_struct *vma)         { }
-static inline void perf_event_comm(struct task_struct *tsk)            { }
-static inline void perf_event_fork(struct task_struct *tsk)            { }
-static inline void perf_event_init(void)                               { }
-static inline int  perf_swevent_get_recursion_context(void)            { return -1; }
-static inline void perf_swevent_put_recursion_context(int rctx)                { }
-static inline void perf_event_enable(struct perf_event *event)         { }
-static inline void perf_event_disable(struct perf_event *event)                { }
-static inline void perf_event_task_tick(void)                          { }
-#endif
-
-#define perf_output_put(handle, x) \
-       perf_output_copy((handle), &(x), sizeof(x))
-
-/*
- * This has to have a higher priority than migration_notifier in sched.c.
- */
-#define perf_cpu_notifier(fn)                                  \
-do {                                                           \
-       static struct notifier_block fn##_nb __cpuinitdata =    \
-               { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
-       fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE,             \
-               (void *)(unsigned long)smp_processor_id());     \
-       fn(&fn##_nb, (unsigned long)CPU_STARTING,               \
-               (void *)(unsigned long)smp_processor_id());     \
-       fn(&fn##_nb, (unsigned long)CPU_ONLINE,                 \
-               (void *)(unsigned long)smp_processor_id());     \
-       register_cpu_notifier(&fn##_nb);                        \
-} while (0)
-
-#endif /* __KERNEL__ */
-#endif /* _LINUX_PERF_EVENT_H */
index 9120ae06916850b4154f96828b7bb34757b40a41..9f24cae696df82d5736c847f31339ef6e920b30b 100644 (file)
 
 #include <unistd.h>
 #include <sys/syscall.h>
-#include "perf_event.h"
 
 #ifdef ENABLE_PERF_EVENTS
+#include <linux/perf_event.h>
+
 #define USE_PERF_EVENTS 1
 
 static int read_perf_mmap (MonoProfiler* prof, int cpu);
index 349eff5401457757c9757591a398a275d7990aab..2c69c7d932f24a5109cbc92e289676dcb2fc86ca 100644 (file)
@@ -101,7 +101,7 @@ alloc_degraded (GCVTable vtable, size_t size, gboolean for_mature)
        if (!for_mature) {
                sgen_client_degraded_allocation (size);
                SGEN_ATOMIC_ADD_P (degraded_mode, size);
-               sgen_ensure_free_space (size);
+               sgen_ensure_free_space (size, GENERATION_OLD);
        } else {
                if (sgen_need_major_collection (size))
                        sgen_perform_collection (size, GENERATION_OLD, "mature allocation failure", !for_mature);
@@ -271,7 +271,7 @@ sgen_alloc_obj_nolock (GCVTable vtable, size_t size)
                                         * always loop we will loop endlessly in the case of
                                         * OOM).
                                         */
-                                       sgen_ensure_free_space (real_size);
+                                       sgen_ensure_free_space (real_size, GENERATION_NURSERY);
                                        if (!degraded_mode)
                                                p = (void **)sgen_nursery_alloc (size);
                                }
@@ -288,7 +288,7 @@ sgen_alloc_obj_nolock (GCVTable vtable, size_t size)
                                p = (void **)sgen_nursery_alloc_range (tlab_size, size, &alloc_size);
                                if (!p) {
                                        /* See comment above in similar case. */
-                                       sgen_ensure_free_space (tlab_size);
+                                       sgen_ensure_free_space (tlab_size, GENERATION_NURSERY);
                                        if (!degraded_mode)
                                                p = (void **)sgen_nursery_alloc_range (tlab_size, size, &alloc_size);
                                }
index 5a0e871e22fecc779083f53fea42bc4945f6849a..11a8998478e765e8083e337c57a9f48c6fb7a9ee 100644 (file)
@@ -190,12 +190,6 @@ typedef mword SgenDescriptor;
  */
 #define SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO 0.33
 
-/*
- * How much more we allow the heap to grow, relative to the allowance, while doing
- * a concurrent collection, before forcing its finish.
- */
-#define SGEN_DEFAULT_CONCURRENT_HEAP_ALLOWANCE_RATIO 0.25
-
 /*
  * Default ratio of memory we want to release in a major collection in relation to the the current heap size.
  *
index 11be768a007fe9ad227ab5a4fcdff2e51dc0b12c..89af85f4387d92646edc38554aa138dd0b9dbdec 100644 (file)
@@ -1972,6 +1972,7 @@ major_finish_collection (const char *reason, size_t old_next_pin_slot, gboolean
        time_major_fragment_creation += TV_ELAPSED (atv, btv);
 
        binary_protocol_sweep_begin (GENERATION_OLD, !major_collector.sweeps_lazily);
+       sgen_memgov_major_pre_sweep ();
 
        TV_GETTIME (atv);
        time_major_free_bigobjs += TV_ELAPSED (btv, atv);
@@ -2152,12 +2153,12 @@ major_finish_concurrent_collection (gboolean forced)
  * LOCKING: The GC lock MUST be held.
  */
 void
-sgen_ensure_free_space (size_t size)
+sgen_ensure_free_space (size_t size, int generation)
 {
        int generation_to_collect = -1;
        const char *reason = NULL;
 
-       if (size > SGEN_MAX_SMALL_OBJ_SIZE) {
+       if (generation == GENERATION_OLD) {
                if (sgen_need_major_collection (size)) {
                        reason = "LOS overflow";
                        generation_to_collect = GENERATION_OLD;
index afd5ba5dce858c2721c9a7e53d6113d2205b9c83..4b2f895d890badc5f42157ebe4009f57211ad1b4 100644 (file)
@@ -802,7 +802,7 @@ enum {
 void sgen_pin_object (GCObject *object, SgenGrayQueue *queue);
 void sgen_set_pinned_from_failed_allocation (mword objsize);
 
-void sgen_ensure_free_space (size_t size);
+void sgen_ensure_free_space (size_t size, int generation);
 void sgen_gc_collect (int generation);
 void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish);
 
index 8cc92e34553f5008105bcc16fdc80232c1cb595c..a89ec99fe353517580f0695f6d45e68859a18101 100644 (file)
@@ -380,7 +380,7 @@ sgen_los_alloc_large_inner (GCVTable vtable, size_t size)
        los_segment_index += size + sizeof (LOSObject);
        g_assert (los_segment_index <= LOS_SEGMENT_SIZE);
 #else
-       sgen_ensure_free_space (size);
+       sgen_ensure_free_space (size, GENERATION_OLD);
 
 #ifdef USE_MALLOC
        obj = malloc (size + sizeof (LOSObject));
index 929d86031fee406233d691cde0c4933781f1e9ad..7aaaa0221e1d900931d9f052314379a3a00271e5 100644 (file)
@@ -1401,8 +1401,8 @@ bitcount (mword d)
        int count = 0;
 
 #ifdef __GNUC__
-       if (sizeof (mword) == sizeof (unsigned long))
-               count += __builtin_popcountl (d);
+       if (sizeof (mword) == 8)
+               count += __builtin_popcountll (d);
        else
                count += __builtin_popcount (d);
 #else
index ce34f7f4a67a7d304ff038e674c01aa38651e0c5..611ae5c118f4d66b7e1eb982fd4d32048e78a20b 100644 (file)
@@ -56,6 +56,9 @@ static gboolean debug_print_allowance = FALSE;
 /* use this to tune when to do a major/minor collection */
 static mword major_collection_trigger_size;
 
+static mword major_pre_sweep_heap_size;
+static mword major_start_heap_size;
+
 static mword last_major_num_sections = 0;
 static mword last_los_memory_usage = 0;
 
@@ -73,6 +76,7 @@ static void
 sgen_memgov_calculate_minor_collection_allowance (void)
 {
        size_t new_major, new_heap_size, allowance_target, allowance;
+       size_t decrease;
 
        if (!need_calculate_minor_collection_allowance)
                return;
@@ -90,6 +94,16 @@ sgen_memgov_calculate_minor_collection_allowance (void)
 
        allowance = MAX (allowance_target, MIN_MINOR_COLLECTION_ALLOWANCE);
 
+       /*
+        * For the concurrent collector, we decrease the allowance relative to the memory
+        * growth during the M&S phase, survival rate of the collection and the allowance
+        * ratio.
+        */
+       decrease = (major_pre_sweep_heap_size - major_start_heap_size) * ((float)new_heap_size / major_pre_sweep_heap_size) * (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO + 1);
+       if (decrease > allowance)
+               decrease = allowance;
+       allowance -= decrease;
+
        if (new_heap_size + allowance > soft_heap_limit) {
                if (new_heap_size > soft_heap_limit)
                        allowance = MIN_MINOR_COLLECTION_ALLOWANCE;
@@ -129,13 +143,14 @@ sgen_need_major_collection (mword space_needed)
                if (heap_size <= major_collection_trigger_size)
                        return FALSE; 
 
-               /* We allow the heap to grow an additional third of the allowance during a concurrent collection */
-               if ((heap_size - major_collection_trigger_size) >
-                               (major_collection_trigger_size
-                               * (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO / (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO + 1))
-                               * SGEN_DEFAULT_CONCURRENT_HEAP_ALLOWANCE_RATIO)) {
+               /*
+                * The more the heap grows, the more we need to decrease the allowance above,
+                * in order to have similar trigger sizes as the synchronous collector.
+                * If the heap grows so much that we would need to have a negative allowance,
+                * we force the finishing of the collection, to avoid increased memory usage.
+                */
+               if ((heap_size - major_start_heap_size) > major_start_heap_size * SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO)
                        return TRUE;
-               }
                return FALSE;
        }
 
@@ -163,13 +178,25 @@ sgen_memgov_minor_collection_end (void)
 {
 }
 
+void
+sgen_memgov_major_pre_sweep (void)
+{
+       if (sgen_concurrent_collection_in_progress ()) {
+               major_pre_sweep_heap_size = get_heap_size ();
+       } else {
+               /* We decrease the allowance only in the concurrent case */
+               major_pre_sweep_heap_size = major_start_heap_size;
+       }
+}
+
 void
 sgen_memgov_major_collection_start (void)
 {
        need_calculate_minor_collection_allowance = TRUE;
+       major_start_heap_size = get_heap_size ();
 
        if (debug_print_allowance) {
-               SGEN_LOG (0, "Starting collection with heap size %ld bytes", (long)get_heap_size ());
+               SGEN_LOG (0, "Starting collection with heap size %ld bytes", (long)major_start_heap_size);
        }
 }
 
index 0115ec6e0605e2755c4b28dc8c020b89f8ea9466..669b59734e99200ffadae2dc540a7b8137f6349c 100644 (file)
@@ -33,6 +33,7 @@ gboolean sgen_memgov_try_alloc_space (mword size, int space);
 void sgen_memgov_minor_collection_start (void);
 void sgen_memgov_minor_collection_end (void);
 
+void sgen_memgov_major_pre_sweep (void);
 void sgen_memgov_major_collection_start (void);
 void sgen_memgov_major_collection_end (gboolean forced);
 
index 3689ecf21b5065f94b4f85e203136976dadc485b..169a9e24c31e9c65ee75b0595c5d4d226bad6ded 100644 (file)
@@ -958,10 +958,13 @@ debug-casts:
 EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs sgen-domain-unload.cs sgen-weakref-stress.cs sgen-cementing-stress.cs sgen-case-23400.cs     finalizer-wait.cs critical-finalizers.cs sgen-domain-unload-2.cs sgen-suspend.cs sgen-new-threads-dont-join-stw.cs sgen-bridge-xref.cs bug-17590.cs sgen-toggleref.cs
 
 
-#those are actually configurations, eg plain_sgen-descriptors.exe
-#DISABLE_SGEN_TESTS =
+sgen-tests:
+       $(MAKE) sgen-regular-tests
+       $(MAKE) sgen-toggleref-tests
+       $(MAKE) sgen-bridge-tests
+       $(MAKE) sgen-bridge2-tests
 
-SGEN_TESTS =   \
+SGEN_REGULAR_TESTS =   \
        finalizer-wait.exe      \
        critical-finalizers.exe \
        sgen-descriptors.exe    \
@@ -975,132 +978,123 @@ SGEN_TESTS =    \
        gc-graystack-stress.exe \
        bug-17590.exe
 
-SGEN_CONFIGURATIONS =  \
-       "|plain"        \
-       "major=marksweep-conc|ms-conc"  \
-       "major=marksweep-conc,minor=split|ms-conc-split"        \
-       "minor=split|ms-split"  \
-       "minor=split,alloc-ratio=95|ms-split-95"        \
-       "|plain-clear-at-gc|clear-at-gc"        \
-       "major=marksweep-conc|ms-conc-clear-at-gc|clear-at-gc"  \
-       "minor=split|ms-split-clear-at-gc|clear-at-gc"
-
-
-#FIXME We should move to use SGEN_CONFIGURATIONS once sgen supports trailling commas or its argument list.
-SGEN_BRIDGE_CONFIGURATIONS =   \
-       "|plain"        \
-       ",major=marksweep-conc|ms-conc" \
-       "minor=split|ms-split"  \
-       "bridge-implementation=new|plain-new-bridge"    \
-       "bridge-implementation=new,major=marksweep-conc|ms-conc-new-bridge"     \
-       "bridge-implementation=new,minor=split|ms-split-new-bridge"     \
-       "bridge-implementation=tarjan|plain-tarjan-bridge"      \
-       "bridge-implementation=tarjan,minor=split|ms-split-tarjan-bridge"
-
-sgen-regular-tests: $(SGEN_TESTS)
-       @failed=0; \
-       passed=0; \
-       failed_tests="";\
-       if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       for test in $+; do      \
-               echo "...$$test";       \
-               for conf in $(SGEN_CONFIGURATIONS); do  \
-                       name=`echo $$conf | cut -d\| -f 2`;     \
-                       params=`echo $$conf | cut -d\| -f 1`;   \
-                       debug_opt=`echo $$conf | cut -d\| -f 3`;        \
-                       test_name="$${test}|$${name}";  \
-                       if MONO_GC_PARAMS="$$params" MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="$$debug_opt" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS);     \
-                       then \
-                               passed=`expr $${passed} + 1`; \
-                       else \
-                               if [ $$? = 2 ]; then break; fi; \
-                               failed=`expr $${failed} + 1`; \
-                               failed_tests="$${failed_tests} $$test_name"; \
-                       fi \
-               done    \
-       done;   \
-       echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
-       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
-         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
-
-sgen-bridge-tests1: sgen-bridge.exe sgen-bridge-major-fragmentation.exe
-       @failed=0; \
-       passed=0; \
-       failed_tests="";\
-       if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       for test in $+; do      \
-               echo "...$$test";       \
-               for conf in $(SGEN_BRIDGE_CONFIGURATIONS); do   \
-                       name=`echo $$conf | cut -d\| -f 2`;     \
-                       params=`echo $$conf | cut -d\| -f 1`;   \
-                       test_name="$${test}|$${name}";  \
-                       if MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="$${params}" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS); \
-                       then \
-                               passed=`expr $${passed} + 1`; \
-                       else \
-                               if [ $$? = 2 ]; then break; fi; \
-                               failed=`expr $${failed} + 1`; \
-                               failed_tests="$${failed_tests} $$test_name"; \
-                       fi \
-               done    \
-       done;   \
-       echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
-       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
-         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
-
-sgen-bridge-tests2: sgen-bridge-xref.exe
-       @failed=0; \
-       passed=0; \
-       failed_tests="";\
-       if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       for test in $+; do      \
-               echo "...$$test";       \
-               for conf in $(SGEN_BRIDGE_CONFIGURATIONS); do   \
-                       name=`echo $$conf | cut -d\| -f 2`;     \
-                       params=`echo $$conf | cut -d\| -f 1`;   \
-                       test_name="$${test}|$${name}";  \
-                       if MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="$${params}" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS);        \
-                       then \
-                               passed=`expr $${passed} + 1`; \
-                       else \
-                               if [ $$? = 2 ]; then break; fi; \
-                               failed=`expr $${failed} + 1`; \
-                               failed_tests="$${failed_tests} $$test_name"; \
-                       fi \
-               done    \
-       done;   \
-       echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
-       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
-         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
-
-sgen-toggleref-tests: sgen-toggleref.exe
-       @failed=0; \
-       passed=0; \
-       failed_tests="";\
-       if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       for test in $+; do      \
-               echo "...$$test";       \
-               for conf in $(SGEN_CONFIGURATIONS); do  \
-                       name=`echo $$conf | cut -d\| -f 2`;     \
-                       params=`echo $$conf | cut -d\| -f 1`;   \
-                       test_name="$${test}|$${name}";  \
-                       if MONO_GC_PARAMS="toggleref-test,$$params" MONO_ENV_OPTIONS="--gc=sgen" $(srcdir)/test-driver '$(with_mono_path) $(JITTEST_PROG_RUN)' $$test_name "$(DISABLED_TESTS_SGEN)" "$${dump_action}" $(RUNTIME_ARGS);  \
-                       then \
-                               passed=`expr $${passed} + 1`; \
-                       else \
-                               if [ $$? = 2 ]; then break; fi; \
-                               failed=`expr $${failed} + 1`; \
-                               failed_tests="$${failed_tests} $$test_name"; \
-                       fi \
-               done    \
-       done;   \
-       echo "$${passed} test(s) passed. $${failed} test(s) did not pass."; \
-       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
-         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
-
-sgen-bridge-tests: sgen-bridge-tests1 sgen-bridge-tests2
-
-sgen-tests: sgen-regular-tests sgen-bridge-tests sgen-toggleref-tests
+sgen-regular-tests: $(SGEN_REGULAR_TESTS)
+       $(MAKE) sgen-regular-tests-plain
+       $(MAKE) sgen-regular-tests-ms-conc
+       $(MAKE) sgen-regular-tests-ms-conc-split
+       $(MAKE) sgen-regular-tests-ms-split
+       $(MAKE) sgen-regular-tests-ms-split-95
+       $(MAKE) sgen-regular-tests-plain-clear-at-gc
+       $(MAKE) sgen-regular-tests-ms-conc-clear-at-gc
+       $(MAKE) sgen-regular-tests-ms-split-clear-at-gc
+
+sgen-regular-tests-plain: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-conc: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-conc-split: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-split: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-split-95: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-plain-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-conc-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-split-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+
+SGEN_TOGGLEREF_TESTS=  \
+       sgen-toggleref.exe
+
+sgen-toggleref-tests: $(SGEN_TOGGLEREF_TESTS)
+       $(MAKE) sgen-toggleref-tests-plain
+       $(MAKE) sgen-toggleref-tests-ms-conc
+       $(MAKE) sgen-toggleref-tests-ms-conc-split
+       $(MAKE) sgen-toggleref-tests-ms-split
+       $(MAKE) sgen-toggleref-tests-ms-split-95
+       $(MAKE) sgen-toggleref-tests-plain-clear-at-gc
+       $(MAKE) sgen-toggleref-tests-ms-conc-clear-at-gc
+       $(MAKE) sgen-toggleref-tests-ms-split-clear-at-gc
+
+sgen-toggleref-tests-plain: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+sgen-toggleref-tests-ms-conc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+sgen-toggleref-tests-ms-conc-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+sgen-toggleref-tests-ms-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+sgen-toggleref-tests-ms-split-95: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+sgen-toggleref-tests-plain-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+sgen-toggleref-tests-ms-conc-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+sgen-toggleref-tests-ms-split-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+
+SGEN_BRIDGE_TESTS=     \
+       sgen-bridge.exe \
+       sgen-bridge-major-fragmentation.exe
+
+sgen-bridge-tests: $(SGEN_BRIDGE_TESTS)
+       $(MAKE) sgen-bridge-tests-plain
+       $(MAKE) sgen-bridge-tests-ms-conc
+       $(MAKE) sgen-bridge-tests-ms-split
+       $(MAKE) sgen-bridge-tests-plain-new-bridge
+       $(MAKE) sgen-bridge-tests-ms-conc-new-bridge
+       $(MAKE) sgen-bridge-tests-ms-split-new-bridge
+       $(MAKE) sgen-bridge-tests-plain-tarjan-bridge
+       $(MAKE) sgen-bridge-tests-ms-split-tarjan-bridge
+
+sgen-bridge-tests-plain: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+sgen-bridge-tests-ms-conc: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+sgen-bridge-tests-ms-split: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+sgen-bridge-tests-plain-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+sgen-bridge-tests-ms-conc-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+sgen-bridge-tests-ms-split-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+sgen-bridge-tests-plain-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+sgen-bridge-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+
+SGEN_BRIDGE2_TESTS=    \
+       sgen-bridge-xref.exe
+
+sgen-bridge2-tests: $(SGEN_BRIDGE2_TESTS)
+       $(MAKE) sgen-bridge2-tests-plain
+       $(MAKE) sgen-bridge2-tests-ms-conc
+       $(MAKE) sgen-bridge2-tests-ms-split
+       $(MAKE) sgen-bridge2-tests-plain-new-bridge
+       $(MAKE) sgen-bridge2-tests-ms-conc-new-bridge
+       $(MAKE) sgen-bridge2-tests-ms-split-new-bridge
+       $(MAKE) sgen-bridge2-tests-plain-tarjan-bridge
+       $(MAKE) sgen-bridge2-tests-ms-split-tarjan-bridge
+
+sgen-bridge2-tests-plain: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+sgen-bridge2-tests-ms-conc: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+sgen-bridge2-tests-ms-split: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+sgen-bridge2-tests-plain-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+sgen-bridge2-tests-ms-conc-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+sgen-bridge2-tests-ms-split-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+sgen-bridge2-tests-plain-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+sgen-bridge2-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 
 AOT_CONFIGURATIONS=    \
        "|regular"      \
index cb2fc0983757332593bf06f99e62f07cbdb0ed50..97279d2fb6ddbd9e2dabf09dbb61ee5af68a174e 100644 (file)
@@ -339,6 +339,16 @@ public class Tests : LoadMissing {
                return 2;
        }
 
+       public static int test_0_reflection_on_field_with_missing_custom_attr () {
+               var t = typeof (BadOverridesDriver).Assembly.GetType ("FieldWithMissingCustomAttribute");
+               try {
+                       Console.WriteLine (t.GetFields ()[0].CustomAttributes);
+                       return 1;
+               } catch (FileNotFoundException) {
+                       return 0;
+               }
+               return 2;
+       }
 
        public static int Main () {
                return TestDriver.RunTests (typeof (Tests));
index 3f2da10c57a8f6d507acc718faf8cfb4cb179605..1ae933d277bc598f764b08c4a6f4cf3796d09daf 100644 (file)
 {\r
   .ver 0:0:0:0\r
 }\r
+.assembly extern notFoundAssembly\r
+{\r
+  .ver 0:0:0:0\r
+}\r
 \r
 .assembly 'load-missing'\r
 {\r
        .field  public class [t]Missing BrokenField\r
     .field  public static int32 WorkingField\r
 }\r
+\r
+.class public auto ansi beforefieldinit FieldWithMissingCustomAttribute\r
+{\r
+    .field     public object f\r
+    .custom    instance void class [notFoundAssembly]SomeAttribute::'.ctor'() = (01 00 00 00 ) // ....\r
+}\r
index 43a9f7184d569925fe0296c3bdb1b81ad2ffddd2..e92d3720656aedef8edd71c808d08874b841e643 100644 (file)
@@ -471,6 +471,7 @@ mono_install_assembly_preload_hook
 mono_install_assembly_refonly_preload_hook
 mono_install_assembly_refonly_search_hook
 mono_install_assembly_search_hook
+mono_install_load_aot_data_hook
 mono_install_runtime_cleanup
 mono_install_unhandled_exception_hook
 mono_is_debugger_attached
@@ -834,8 +835,12 @@ mono_thread_new_init
 mono_thread_set_main
 mono_thread_set_manage_callback
 mono_thread_stop
+mono_threads_assert_gc_safe_region
+mono_threads_assert_gc_unsafe_region
 mono_threads_attach_tools_thread
+mono_threads_enter_gc_safe_region
 mono_threads_enter_gc_unsafe_region
+mono_threads_exit_gc_safe_region
 mono_threads_exit_gc_unsafe_region
 mono_threads_get_default_stacksize
 mono_threads_request_thread_dump
index 7c0bd3ae53048befd062f00568109975274ed488..dc32801d088054e5a333d5ebdaaf7fdbbfb700c8 100644 (file)
@@ -473,6 +473,7 @@ mono_install_assembly_preload_hook
 mono_install_assembly_refonly_preload_hook
 mono_install_assembly_refonly_search_hook
 mono_install_assembly_search_hook
+mono_install_load_aot_data_hook
 mono_install_runtime_cleanup
 mono_install_unhandled_exception_hook
 mono_is_debugger_attached
@@ -836,8 +837,12 @@ mono_thread_new_init
 mono_thread_set_main
 mono_thread_set_manage_callback
 mono_thread_stop
+mono_threads_assert_gc_safe_region
+mono_threads_assert_gc_unsafe_region
 mono_threads_attach_tools_thread
+mono_threads_enter_gc_safe_region
 mono_threads_enter_gc_unsafe_region
+mono_threads_exit_gc_safe_region
 mono_threads_exit_gc_unsafe_region
 mono_threads_get_default_stacksize
 mono_threads_request_thread_dump
index 644491b94d5a399d0bcc48f8ff18a2c9ab083638..09d652d968f1cde4b036a93ff6b3819416a775b4 100644 (file)
     </project>
     <project dir="class/corlib" library="corlib-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -debug -optimize -r:./../../class/lib/net_4_x/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -r:Mono.Posix.dll -r:System.Core.dll -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -debug -optimize -r:./../../class/lib/net_4_x/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -r:Mono.Posix.dll -r:System.Core.dll -r:System.dll -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
       <output>net_4_x_corlib_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_corlib_test.dll</library_output>
     </project>
     <project dir="class/System.Web.Extensions" library="System.Web.Extensions-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -r:mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS -r:mscorlib.dll -r:System.Web.ApplicationServices.dll /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:System -r:System.Core -r:System.Drawing -r:System.Data -r:System.Data.Linq -r:System.Xml -r:System.Web -r:System.Web.Services -r:System.Configuration -r:System.EnterpriseServices -r:System.ServiceModel -doc:net_4_x_System.Web.Extensions_test.xml -nowarn:219,169,1591 /resource:Test/resources/Web.mono.config /resource:Test/resources/profile.config.4.x /resource:Test/resources/ListViewSort.aspx /resource:Test/resources/ListViewTest.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_1.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_2.aspx /resource:Test/resources/ListViewTotalRowCount_Bug604053.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithDerivedMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMasterInvalidPlaceHolder.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyDerived.master -r:SystemWebTestShim.dll -define:SYSTEM_WEB_EXTENSIONS</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -r:mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS -r:mscorlib.dll -r:System.Web.ApplicationServices.dll /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:System -r:System.Core -r:System.Drawing -r:System.Data -r:System.Data.Linq -r:System.Xml -r:System.Web -r:System.Web.Services -r:System.Configuration -r:System.EnterpriseServices -r:System.ServiceModel -doc:net_4_x_System.Web.Extensions_test.xml -nowarn:219,169,1591 /resource:Test/resources/Web.mono.config /resource:Test/resources/profile.config.4.x /resource:Test/resources/ListViewSort.aspx /resource:Test/resources/ListViewTest.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_1.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_2.aspx /resource:Test/resources/ListViewTotalRowCount_Bug604053.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithDerivedMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMasterInvalidPlaceHolder.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyDerived.master /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master -r:SystemWebTestShim.dll -define:SYSTEM_WEB_EXTENSIONS</flags>
       <output>net_4_x_System.Web.Extensions_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Web.Extensions_test.dll</library_output>