From: Vlad Brezae Date: Tue, 27 Sep 2016 10:10:01 +0000 (+0300) Subject: Merge pull request #3647 from BrzVlad/fix-sgen-internal-alloc X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=4df88aea4b841eed9614455a8b71d4a446a44cc6;hp=43f369a1073652cb211aea5bff28743ab7879f47;p=mono.git Merge pull request #3647 from BrzVlad/fix-sgen-internal-alloc [sgen] Fix sgen internal alloc --- diff --git a/README.md b/README.md index 2b583e599be..15e32dd886d 100644 --- a/README.md +++ b/README.md @@ -15,19 +15,22 @@ The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.or 6. [Configuration Options](#configuration-options) 7. [Working with Submodules](#working-with-submodules) -**Build Status** - -Officially supported architectures: - -| ubuntu-1404-amd64 | ubuntu-1404-i386 | debian-8-armel | debian-8-armhf | debian-8-arm64 | windows-amd64 | -|------------------------------|-----------------------------|---------------------------|---------------------------|-----------------------------|----------------------------| -| [![ubuntu-1404-amd64][1]][2] | [![ubuntu-1404-i386][3]][4] | [![debian-8-armel][5]][6] | [![debian-8-armhf][7]][8] | [![debian-8-arm64][9]][10] | [![windows-amd64][11]][12] | - -Community supported architectures: - -| centos-s390x | -|---------------------------| -| [![centos-s390x][13]][14] | +### Build Status + +| OS | Architecture | Status | +|--------------|--------------------|------------------------------| +| Ubuntu 14.04 | amd64 | [![ubuntu-1404-amd64][1]][2] | +| Ubuntu 14.04 | i386 | [![ubuntu-1404-i386][3]][4] | +| Debian 8 | armel | [![debian-8-armel][5]][6] | +| Debian 8 | armhf | [![debian-8-armhf][7]][8] | +| Debian 8 | arm64 | [![debian-8-arm64][9]][10] | +| OS X | amd64 | [![osx-amd64][11]][12] | +| OS X | i386 | [![osx-i386][13]][14] | +| Windows | amd64 | [![windows-amd64][15]][16] | +| Windows | i386 | [![windows-amd64][17]][18] | +| CentOS | s390x (cs) | [![centos-s390x][19]][20] | + +_(cs) = community supported architecture_ [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64/badge/icon [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64 @@ -39,10 +42,16 @@ Community supported architectures: [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/ [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/badge/icon [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/ -[11]: https://ci.appveyor.com/api/projects/status/1e61ebdfpbiei58v/branch/master?svg=true -[12]: https://ci.appveyor.com/project/ajlennon/mono-817/branch/master -[13]: https://jenkins.mono-project.com/job/z/label=centos-s390x/badge/icon -[14]: https://jenkins.mono-project.com/job/z/label=centos-s390x +[11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon +[12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/ +[13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon +[14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/ +[15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon +[16]: https://jenkins.mono-project.com/job/z/label=w64/ +[17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon +[18]: https://jenkins.mono-project.com/job/z/label=w32/ +[19]: https://jenkins.mono-project.com/job/z/label=centos-s390x/badge/icon +[20]: https://jenkins.mono-project.com/job/z/label=centos-s390x Compilation and Installation ============================ diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8fa713a07ef..00000000000 --- a/appveyor.yml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Appveyor configuration file for CI build of Mono on Windows (under Cygwin) -# -# For further details see http://www.appveyor.com -# - -# -# Custom environment variables -# -environment: - global: - CYG_ROOT: C:\cygwin - CYG_MIRROR: http://cygwin.mirror.constant.com - CYG_CACHE: C:\cygwin\var\cache\setup - CYG_BASH: C:\cygwin\bin\bash - -# -# Cache Cygwin files to speed up build -# -cache: - - '%CYG_CACHE%' - -# -# Do a shallow clone of the repo to speed up build -# -clone_depth: 1 - -# -# Initialisation prior to pulling the Mono repository -# Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail -# -init: - - git config --global core.autocrlf input - -# -# Install needed build dependencies -# -install: - - ps: 'Start-FileDownload "http://cygwin.com/setup-x86.exe" -FileName "setup-x86.exe"' - - 'setup-x86.exe --quiet-mode --no-shortcuts --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages autoconf,automake,bison,gcc-core,gcc-g++,mingw-runtime,mingw-binutils,mingw-gcc-core,mingw-gcc-g++,mingw-pthreads,mingw-w32api,libtool,make,python,gettext-devel,gettext,intltool,libiconv,pkg-config,git,curl,libxslt > NUL 2>&1' - - '%CYG_BASH% -lc "cygcheck -dc cygwin"' - -# Cygwin build script -# -# NOTES: -# -# The stdin/stdout file descriptor appears not to be valid for the Appveyor -# build which causes failures as certain functions attempt to redirect -# default file handles. Ensure a dummy file descriptor is opened with 'exec'. -# -build_script: - - 'echo Building...' - - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0 #include #include +#include #ifdef G_OS_WIN32 #include @@ -68,6 +69,26 @@ int mkstemp (char *tmp_template) return fd; } +gchar * +g_mkdtemp (char *tmp_template) +{ + gunichar2* utf16_template; + + utf16_template = u8to16 (tmp_template); + + utf16_template = _wmktemp(utf16_template); + if (utf16_template && *utf16_template) { + if (_wmkdir (utf16_template) == 0){ + char *ret = u16to8 (utf16_template); + g_free (utf16_template); + return ret; + } + } + + g_free (utf16_template); + return NULL; +} + #ifdef _MSC_VER #pragma warning(disable:4701) #endif diff --git a/eglib/src/glib.h b/eglib/src/glib.h index 23781c16852..d7173264c1b 100644 --- a/eglib/src/glib.h +++ b/eglib/src/glib.h @@ -887,6 +887,12 @@ gboolean g_file_test (const gchar *filename, GFileTest test); #define g_ascii_strtod strtod #define g_ascii_isalnum isalnum +#ifdef WIN32 +gchar *g_mkdtemp (gchar *tmpl); +#else +#define g_mkdtemp mkdtemp +#endif + /* * Pattern matching */ diff --git a/man/mkbundle.1 b/man/mkbundle.1 index 95861e0aeab..305cfcc7f72 100644 --- a/man/mkbundle.1 +++ b/man/mkbundle.1 @@ -159,10 +159,16 @@ flag to bundle all available encodings. Or you can use a comma delimited list of the workds CJK, MidWest, Other, Rare and West to specificy which encoding assemblies to distribute. .TP -.TP .I "-L path" Adds the `path' do the search list for assemblies. The rules are the same as for the compiler -lib: or -L flags. +.TP +.I "--library [LIB,]PATH" +Embeds the dynamic library file pointed to by `PATH' and optionally +give it the name `LIB' into the bundled executable. This is used to +ship native library dependencies that are unpacked at startup and +loaded from the runtime. +.TP .I "--lists-targets" Lists all of the available local cross compilation targets available as precompiled binaries on the Mono distribution server. diff --git a/mcs/build/common/basic-profile-check.cs b/mcs/build/common/basic-profile-check.cs index b9e02f62b26..631b764bf9d 100644 --- a/mcs/build/common/basic-profile-check.cs +++ b/mcs/build/common/basic-profile-check.cs @@ -40,7 +40,7 @@ class X { if (!Version.TryParse (field.GetValue (null) as string, out version)) return 4; - if (version < new Version (3, 8)) + if (version < new Version (4, 0)) return 5; return 0; diff --git a/mcs/class/Makefile b/mcs/class/Makefile index f9ff19f76da..e170ff9c996 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -51,9 +51,6 @@ mobile_common_dirs := \ System.Xml.Serialization \ Mono.CSharp \ Microsoft.CSharp \ - Mono.Security.Providers.DotNet \ - Mono.Security.Providers.NewSystemSource \ - Mono.Security.Providers.NewTls \ System.Runtime.InteropServices.RuntimeInformation \ System.Reflection.DispatchProxy \ System.Xml.XPath.XmlDocument \ @@ -140,10 +137,6 @@ xammac_4_5_dirs := \ System.Data.Linq \ System.Net.Http \ System.Net.Http.WebRequest \ - Mono.Security.Providers.DotNet \ - Mono.Security.Providers.OldTls \ - Mono.Security.Providers.NewSystemSource \ - Mono.Security.Providers.NewTls \ System.Runtime.InteropServices.RuntimeInformation \ System.Reflection.Context \ System.Net.Http.WinHttpHandler \ @@ -232,8 +225,6 @@ net_4_x_dirs := \ System.Web.Http \ System.Web.Http.SelfHost \ System.Web.Http.WebHost \ - Mono.Security.Providers.NewSystemSource \ - Mono.Security.Providers.NewTls \ System.Runtime.InteropServices.RuntimeInformation # These are the subdirs which depends on libs in net_4_x_dirs @@ -277,8 +268,6 @@ net_4_x_parallel_dirs := \ System.ComponentModel.Composition.4.5 \ System.Windows \ System.Xml.Serialization \ - Mono.Security.Providers.DotNet \ - Mono.Security.Providers.OldTls \ System.DirectoryServices.Protocols \ RabbitMQ.Client \ Microsoft.VisualC \ diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs index cf56b148f11..ae6d75bf406 100644 --- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs +++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs @@ -153,7 +153,10 @@ namespace Microsoft.Build.Tasks { { if (!string.IsNullOrEmpty (ToolPath)) return Path.Combine (ToolPath, ToolExe); - return ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest); + var possibleToolPath = ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest); + if (!string.IsNullOrEmpty(possibleToolPath)) + return possibleToolPath; + return ToolLocationHelper.GetPathToDotNetFrameworkBinFile(ToolExe); } [MonoTODO] diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs index 9c466c5ed9c..d03145e0df3 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs @@ -93,7 +93,8 @@ namespace Microsoft.CSharp.RuntimeBinder module.SetDeclaringAssembly (temp); var importer = new Compiler.ReflectionImporter (module, cc.BuiltinTypes) { - IgnorePrivateMembers = false + IgnorePrivateMembers = false, + IgnoreCompilerGeneratedField = false }; // Import all currently loaded assemblies diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs index 93e9a959eee..a5b902db573 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -420,7 +420,7 @@ namespace Mono.Debugger.Soft * with newer runtimes, and vice versa. */ internal const int MAJOR_VERSION = 2; - internal const int MINOR_VERSION = 43; + internal const int MINOR_VERSION = 44; enum WPSuspendPolicy { NONE = 0, @@ -590,6 +590,7 @@ namespace Mono.Debugger.Soft GET_THIS = 2, SET_VALUES = 3, GET_DOMAIN = 4, + SET_THIS = 5, } enum CmdArrayRef { @@ -2410,6 +2411,10 @@ namespace Mono.Debugger.Soft return SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_DOMAIN, new PacketWriter ().WriteId (thread_id).WriteId (id)).ReadId (); } + internal void StackFrame_SetThis (long thread_id, long id, ValueImpl value) { + SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.SET_THIS, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteValue (value)); + } + /* * ARRAYS */ diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs index f160c4a37a7..c92f2240ef8 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs @@ -166,6 +166,15 @@ namespace Mono.Debugger.Soft return vm.DecodeValue (vm.conn.StackFrame_GetThis (thread.Id, Id)); } + // Since protocol version 2.44 + public void SetThis (Value value) { + if (value == null) + throw new ArgumentNullException ("value"); + if (Method.IsStatic || !Method.DeclaringType.IsValueType) + throw new InvalidOperationException ("The frame's method needs to be a valuetype instance method."); + vm.conn.StackFrame_SetThis (thread.Id, Id, vm.EncodeValue (value)); + } + public void SetValue (LocalVariable var, Value value) { if (var == null) throw new ArgumentNullException ("var"); diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 581e90744aa..505ab2abdbe 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -1775,6 +1775,16 @@ public class DebuggerTests AssertValue ("T", s ["s"]); AssertValue (45, s ["k"]); + // Test SetThis () + s ["i"] = vm.CreateValue (55); + frame.SetThis (s); + obj = frame.GetThis (); + Assert.IsTrue (obj is StructMirror); + s = obj as StructMirror; + AssertValue (55, s ["i"]); + AssertValue ("T", s ["s"]); + AssertValue (45, s ["k"]); + // this on static vtype methods e = run_until ("vtypes3"); e = step_until (e.Thread, "static_foo"); diff --git a/mcs/class/Mono.Security.Providers.DotNet/Makefile b/mcs/class/Mono.Security.Providers.DotNet/Makefile deleted file mode 100644 index a42b8c5a7c4..00000000000 --- a/mcs/class/Mono.Security.Providers.DotNet/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -thisdir = class/Mono.Security.Providers.DotNet -SUBDIRS = -include ../../build/rules.make - -LIBRARY = Mono.Security.Providers.DotNet.dll -LIB_REFS = System Mono.Security -LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign - -EXTRA_DISTFILES = README.md - -include ../../build/library.make - -$(the_lib): ../Mono.Security/Makefile - diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj deleted file mode 100644 index 115c3f25a7f..00000000000 --- a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {391EDD2B-85AC-4FCA-B607-AAD6C51E6799} - Library - 1699,1030 - ./../../class/lib/net_4_x - obj-net_4_x - false - True - - True - true - Properties - - - Mono.Security.Providers.DotNet - v4.5 - 512 - - - true - true - - - ../mono.pub - - - true - full - 1699,1030 - false - TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1030 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {42D59DE7-586F-4ACF-BDD5-E7869E39E3EF} - Mono.Security-net_4_x - - - - - - - diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet.dll.sources b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet.dll.sources deleted file mode 100644 index 7afb9f372b8..00000000000 --- a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet.dll.sources +++ /dev/null @@ -1,6 +0,0 @@ -./Properties/AssemblyInfo.cs -../../build/common/Consts.cs -../../build/common/Locale.cs - -./Mono.Security.Providers.DotNet/DotNetTlsProvider.cs -./Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs deleted file mode 100644 index c6be7030cef..00000000000 --- a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs +++ /dev/null @@ -1,317 +0,0 @@ -// -// DotNetSslStreamImpl.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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; -using System.IO; -using System.Net; -using System.Net.Security; -using System.Threading.Tasks; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; -using System.Security.Principal; -using System.Security.Cryptography; -using MSI = Mono.Security.Interface; - -namespace Mono.Security.Providers.DotNet -{ - class DotNetSslStreamImpl : MSI.IMonoSslStream - { - DotNetTlsProvider provider; - SslStream impl; - - internal SslStream Impl { - get { - CheckDisposed (); - return impl; - } - } - - public DotNetSslStreamImpl ( - Stream innerStream, bool leaveInnerStreamOpen, DotNetTlsProvider provider, - RemoteCertificateValidationCallback userCertificateValidationCallback, - LocalCertificateSelectionCallback userCertificateSelectionCallback) - { - this.provider = provider; - impl = new SslStream ( - innerStream, leaveInnerStreamOpen, - userCertificateValidationCallback, - userCertificateSelectionCallback); - } - - public void AuthenticateAsClient (string targetHost) - { - Impl.AuthenticateAsClient (targetHost); - } - - public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation) - { - Impl.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation); - } - - public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState) - { - return Impl.BeginAuthenticateAsClient (targetHost, asyncCallback, asyncState); - } - - public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState) - { - return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState); - } - - public void EndAuthenticateAsClient (IAsyncResult asyncResult) - { - Impl.EndAuthenticateAsClient (asyncResult); - } - - public void AuthenticateAsServer (X509Certificate serverCertificate) - { - Impl.AuthenticateAsServer (serverCertificate); - } - - public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation) - { - Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation); - } - - public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState) - { - return Impl.BeginAuthenticateAsServer (serverCertificate, asyncCallback, asyncState); - } - - public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState) - { - return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState); - } - - public void EndAuthenticateAsServer (IAsyncResult asyncResult) - { - Impl.EndAuthenticateAsServer (asyncResult); - } - - public Task AuthenticateAsClientAsync (string targetHost) - { - return Impl.AuthenticateAsClientAsync (targetHost); - } - - public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation) - { - return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation); - } - - public Task AuthenticateAsServerAsync (X509Certificate serverCertificate) - { - return Impl.AuthenticateAsServerAsync (serverCertificate); - } - - public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation) - { - return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation); - } - - public void Flush () - { - Impl.Flush (); - } - - public int Read (byte[] buffer, int offset, int count) - { - return Impl.Read (buffer, offset, count); - } - - public void Write (byte[] buffer) - { - Impl.Write (buffer); - } - - public void Write (byte[] buffer, int offset, int count) - { - Impl.Write (buffer, offset, count); - } - - public IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) - { - return Impl.BeginRead (buffer, offset, count, asyncCallback, asyncState); - } - - public int EndRead (IAsyncResult asyncResult) - { - return Impl.EndRead (asyncResult); - } - - public IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) - { - return Impl.BeginWrite (buffer, offset, count, asyncCallback, asyncState); - } - - public void EndWrite (IAsyncResult asyncResult) - { - Impl.EndWrite (asyncResult); - } - - public TransportContext TransportContext { - get { throw new NotSupportedException (); } - } - - public bool IsAuthenticated { - get { return Impl.IsAuthenticated; } - } - - public bool IsMutuallyAuthenticated { - get { return Impl.IsMutuallyAuthenticated; } - } - - public bool IsEncrypted { - get { return Impl.IsEncrypted; } - } - - public bool IsSigned { - get { return Impl.IsSigned; } - } - - public bool IsServer { - get { return Impl.IsServer; } - } - - public CipherAlgorithmType CipherAlgorithm { - get { return Impl.CipherAlgorithm; } - } - - public int CipherStrength { - get { return Impl.CipherStrength; } - } - - public HashAlgorithmType HashAlgorithm { - get { return Impl.HashAlgorithm; } - } - - public int HashStrength { - get { return Impl.HashStrength; } - } - - public ExchangeAlgorithmType KeyExchangeAlgorithm { - get { return Impl.KeyExchangeAlgorithm; } - } - - public int KeyExchangeStrength { - get { return KeyExchangeStrength; } - } - - public bool CanRead { - get { return Impl.CanRead; } - } - - public bool CanTimeout { - get { return Impl.CanTimeout; } - } - - public bool CanWrite { - get { return Impl.CanWrite; } - } - - public long Length { - get { return Impl.Length; } - } - - public long Position { - get { return Impl.Position; } - } - - public void SetLength (long value) - { - Impl.SetLength (value); - } - - public AuthenticatedStream AuthenticatedStream { - get { return Impl; } - } - - public int ReadTimeout { - get { return Impl.ReadTimeout; } - set { Impl.ReadTimeout = value; } - } - - public int WriteTimeout { - get { return Impl.WriteTimeout; } - set { Impl.WriteTimeout = value; } - } - - public bool CheckCertRevocationStatus { - get { return Impl.CheckCertRevocationStatus; } - } - - public X509Certificate InternalLocalCertificate { - get { - try { - return LocalCertificate; - } catch { - return null; - } - } - } - - public X509Certificate LocalCertificate { - get { return Impl.LocalCertificate; } - } - - public X509Certificate RemoteCertificate { - get { return Impl.RemoteCertificate; } - } - - public SslProtocols SslProtocol { - get { return Impl.SslProtocol; } - } - - MSI.MonoTlsProvider MSI.IMonoSslStream.Provider { - get { return provider; } - } - - MSI.MonoTlsConnectionInfo MSI.IMonoSslStream.GetConnectionInfo () - { - return null; - } - - void CheckDisposed () - { - if (impl == null) - throw new ObjectDisposedException ("MonoSslStream"); - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected void Dispose (bool disposing) - { - if (impl != null && disposing) { - impl.Dispose (); - impl = null; - } - } - } -} - diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetTlsProvider.cs b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetTlsProvider.cs deleted file mode 100644 index 3be685a46d2..00000000000 --- a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetTlsProvider.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -// MonoDefaultTlsProvider.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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; -using System.IO; -using System.Net; -using System.Net.Security; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; -using Mono.Security.Interface; - -namespace Mono.Security.Providers.DotNet -{ - /* - * This provider only uses the public .NET APIs from System.dll. - * - * It is primarily intended for testing. - */ - public class DotNetTlsProvider : MonoTlsProvider - { - static readonly Guid id = new Guid ("3a7b3a26-0dbd-4572-a5b8-fdce766bf0dd"); - - public override Guid ID { - get { return id; } - } - - public override string Name { - get { return "dotnet"; } - } - - public override bool SupportsSslStream { - get { return true; } - } - - public override bool SupportsConnectionInfo { - get { return false; } - } - - public override bool SupportsMonoExtensions { - get { return false; } - } - - internal override bool SupportsTlsContext { - get { return false; } - } - - public override SslProtocols SupportedProtocols { - get { return (SslProtocols)ServicePointManager.SecurityProtocol; } - } - - public override IMonoSslStream CreateSslStream ( - Stream innerStream, bool leaveInnerStreamOpen, - MonoTlsSettings settings = null) - { - if (settings != null) - throw new NotSupportedException ("Mono-specific API Extensions not available."); - - RemoteCertificateValidationCallback validation_callback = null; - LocalCertificateSelectionCallback selection_callback = null; - - if (settings != null) { - validation_callback = ConvertCallback (settings.RemoteCertificateValidationCallback); - selection_callback = ConvertCallback (settings.ClientCertificateSelectionCallback); - } - - return new DotNetSslStreamImpl (innerStream, leaveInnerStreamOpen, this, validation_callback, selection_callback); - } - - internal override IMonoTlsContext CreateTlsContext ( - string hostname, bool serverMode, TlsProtocols protocolFlags, - X509Certificate serverCertificate, X509CertificateCollection clientCertificates, - bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy, - MonoTlsSettings settings) - { - throw new NotSupportedException (); - } - - internal static RemoteCertificateValidationCallback ConvertCallback (MonoRemoteCertificateValidationCallback callback) - { - if (callback == null) - return null; - - return (s, c, ch, e) => callback (null, c, ch, (MonoSslPolicyErrors)e); - } - - internal static LocalCertificateSelectionCallback ConvertCallback (MonoLocalCertificateSelectionCallback callback) - { - if (callback == null) - return null; - - return (s, t, lc, rc, ai) => callback (t, lc, rc, ai); - } - - } -} - diff --git a/mcs/class/Mono.Security.Providers.DotNet/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.DotNet/Properties/AssemblyInfo.cs deleted file mode 100644 index cbbd0029272..00000000000 --- a/mcs/class/Mono.Security.Providers.DotNet/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// AssemblyInfo.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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; -using System.Reflection; -using System.Resources; -using System.Security; -using System.Security.Permissions; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about the system assembly - -[assembly: AssemblyVersion (Consts.FxVersion)] - -[assembly: AssemblyCompany ("MONO development team")] -[assembly: AssemblyCopyright ("(c) 2015 Xamarin")] -[assembly: AssemblyDescription ("Mono.Security.Providers.DotNet.dll")] -[assembly: AssemblyProduct ("MONO CLI")] -[assembly: AssemblyTitle ("Mono.Security.Providers.DotNet.dll")] -[assembly: CLSCompliant (true)] -[assembly: ComVisible (false)] -[assembly: NeutralResourcesLanguage ("en-US")] - diff --git a/mcs/class/Mono.Security.Providers.DotNet/README.md b/mcs/class/Mono.Security.Providers.DotNet/README.md deleted file mode 100644 index 4c47efd7a1e..00000000000 --- a/mcs/class/Mono.Security.Providers.DotNet/README.md +++ /dev/null @@ -1 +0,0 @@ -See mcs/class/Mono.Security.Providers.NewSystemSource/README.md for a detailed README. diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Makefile b/mcs/class/Mono.Security.Providers.NewSystemSource/Makefile deleted file mode 100644 index 61beeb4e2fc..00000000000 --- a/mcs/class/Mono.Security.Providers.NewSystemSource/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -thisdir = class/Mono.Security.Providers.NewSystemSource -SUBDIRS = -include ../../build/rules.make - -LIB_REFS = System - -LIBRARY = Mono.Security.Providers.NewSystemSource.dll - -LIB_MCS_FLAGS = -d:SECURITY_DEP \ - -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:MONO -d:FEATURE_PAL -d:MONO_FEATURE_NEW_TLS \ - -d:MONO_FEATURE_NEW_SYSTEM_SOURCE -d:DISABLE_CAS_USE - -ifdef MOBILE_PROFILE -LIB_REFS += Mono.Security -else -LIB_REFS += MonoSecurity=Mono.Security -LIB_MCS_FLAGS += -d:MONO_SECURITY_ALIAS -endif - -EXTRA_DISTFILES = README.md - -include ../../build/library.make - -$(the_lib): ../Mono.Security/Makefile diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj b/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj deleted file mode 100644 index 771d99fc965..00000000000 --- a/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E} - Library - 1699,1030 - ./../../class/lib/net_4_x - obj-net_4_x - false - True - - True - true - Properties - - - Mono.Security.Providers.NewSystemSource - v4.5 - 512 - - - true - true - - - ../mono.pub - - - true - full - 1699,1030 - false - TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP;MONO;FEATURE_PAL;MONO_FEATURE_NEW_TLS;MONO_FEATURE_NEW_SYSTEM_SOURCE;DISABLE_CAS_USE;MONO_SECURITY_ALIAS - prompt - 4 - - - pdbonly - 1699,1030 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP;MONO;FEATURE_PAL;MONO_FEATURE_NEW_TLS;MONO_FEATURE_NEW_SYSTEM_SOURCE;DISABLE_CAS_USE;MONO_SECURITY_ALIAS - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {42D59DE7-586F-4ACF-BDD5-E7869E39E3EF} - Mono.Security-net_4_x - MonoSecurity - - - - - - diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource.dll.sources b/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource.dll.sources deleted file mode 100644 index c0765d543b4..00000000000 --- a/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource.dll.sources +++ /dev/null @@ -1,33 +0,0 @@ -./Properties/AssemblyInfo.cs -../../build/common/SR.cs -../../build/common/Consts.cs -../../build/common/Locale.cs - -../referencesource/System/net/System/Net/Logging.cs -../referencesource/System/net/System/Net/_SslSessionsCache.cs -../referencesource/System/net/System/Net/_LazyAsyncResult.cs -../referencesource/System/net/System/Net/_LoggingObject.cs -../referencesource/System/net/System/Net/_NTAuthentication.cs -../referencesource/System/net/System/Net/_SecureChannel.cs -../referencesource/System/net/System/Net/SecureProtocols/SslStream.cs -../referencesource/System/net/System/Net/SecureProtocols/_SslState.cs -../referencesource/System/net/System/Net/SecureProtocols/_SslStream.cs -../referencesource/System/net/System/Net/SecureProtocols/_FixedSizeReader.cs -../referencesource/System/net/System/Net/SecureProtocols/_HelperAsyncResults.cs -../referencesource/mscorlib/InternalApis/NDP_Common/inc/PinnableBufferCache.cs - -../System/ReferenceSources/SR.cs -../System/ReferenceSources/SR2.cs -../System/ReferenceSources/Internal.cs -../System/ReferenceSources/SSPIWrapper.cs -../System/ReferenceSources/SSPISafeHandles.cs -../System/ReferenceSources/SslStream.cs -../System/ReferenceSources/_SslState.cs -../System/ReferenceSources/_SslStream.cs -../System/ReferenceSources/_SecureChannel.cs -../System/ReferenceSources/SSPIConfiguration.cs -../System/Mono.Net.Security/CallbackHelpers.cs -../System/Mono.Net.Security/IMonoTlsProvider.cs -../System/Mono.Net.Security/MonoTlsProviderFactory.cs -../System/Mono.Net.Security/MonoTlsProviderWrapper.cs - diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.NewSystemSource/Properties/AssemblyInfo.cs deleted file mode 100644 index 23ba5bb2537..00000000000 --- a/mcs/class/Mono.Security.Providers.NewSystemSource/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// AssemblyInfo.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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; -using System.Reflection; -using System.Resources; -using System.Security; -using System.Security.Permissions; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about the system assembly - -[assembly: AssemblyVersion (Consts.FxVersion)] - -[assembly: AssemblyCompany ("MONO development team")] -[assembly: AssemblyCopyright ("(c) 2015 Xamarin")] -[assembly: AssemblyDescription ("Mono.Security.Providers.NewSystemSource.dll")] -[assembly: AssemblyProduct ("MONO CLI")] -[assembly: AssemblyTitle ("Mono.Security.Providers.NewSystemSource.dll")] -[assembly: CLSCompliant (true)] -[assembly: ComVisible (false)] -[assembly: NeutralResourcesLanguage ("en-US")] - -[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")] -[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/README.md b/mcs/class/Mono.Security.Providers.NewSystemSource/README.md deleted file mode 100644 index 03447c08ccd..00000000000 --- a/mcs/class/Mono.Security.Providers.NewSystemSource/README.md +++ /dev/null @@ -1,95 +0,0 @@ -Mono.Security.Interface / Mono.Security.Providers -================================================= - -This is not a public API yet, but will eventually become public. - - -Mono.Security.Interface ------------------------ - -`Mono.Security.Interface` provides an abstraction layer for the TLS -APIs that are currently being used by Mono's class libraries. - -The main API entry points are `MonoTlsProviderFactory.GetProvider()` -and `MonoTlsProviderFactory.InstallProvider()`. - -Mono.Net.Security ------------------ - -`Mono.Net.Security` provides the internal implementation and lives -inside `System.dll` as private and internal APIs. `Mono.Security.dll` -uses reflection to access these. - -On Mobile, the `Mono.Security.Interface` APIs are included as public -APIs in `System.dll`. - -Mono.Security.Providers ------------------------ - -Implementations of the `Mono.Security.Interface.MonoTlsProvider` class -to provide TLS functionality. - -The default provider is inside `System.dll` - it will be used automatically -if you don't explicitly install a custom provider, so simply call -`MonoTlsProviderFactory.GetProvider()` to use it. - -* DotNet: - Provides the default `SslStream` implementation from `System.dll`, only using - public .NET types. - -* NewSystemSource: - Compiles several referencesource files which would normally live inside - `System.dll` if we compiled it with their `SslStream` implementation. - - This allows to keep the code in `System.dll` as-is, while still providing the - new `SslStream`, which will be required by the new TLS code. - - `System.dll` needs to make its internals visible and we're using several compiler / - external alias tricks in here to make this work. - - In this configuration, `MONO_SYSTEM_ALIAS`, `MONO_FEATURE_NEW_TLS` and - `MONO_FEATURE_NEW_SYSTEM_SOURCE` (defining conditional for this configuration) - are defined. We do not define `MONO_X509_ALIAS here`. - -The `Mono.Security.Providers.DotNet` and `Mono.Security.Providers.NewSystemSource` directory is currently -enabled in the top-level `Makefile`, but the resulting binaries should only be used to test the new TLS -code and not shipped as stable APIs. - -Pending changes ---------------- - -This code is not actually being used in `System.dll` yet. I have some -local changes which will switch the existing code in `WebClient`, -`SmptClient` and `FtpWebRequest` over, but these need to be carefully -tested. - -At the moment, this work branch only provides new code and build -changes, which shuffle some stuff around. There are also several -new files which are conditional and not actually being built by -default. - -Build Configurations --------------------- - -* Normal build: - Builds everything as before with some new APIs added, but without - modifying any existing functionality. - -* Build with the `newtls` profile: - Builds `System.dll` with the new `SslStream` implementation from the - referencesource. This is currently a "build then throw away" profile - and not enabled from the top-level Makefile. The resulting `System.dll` - won't actually work at runtime since it's missing the new TLS code; - building it helps find problems and ensures that it will actually - be possible to build this once we deploy it. - -* Mono.Security.Providers: - The new TLS code requires the newly built `System` and `Mono.Security.Providers.NewSystemSource` - from this branch installed in the system. It is recommended to install it - into a custom prefix and set that as custom runtime in Xamarin Studio. - - -Last changed March 07th, 2015, -Martin Baulig - - diff --git a/mcs/class/Mono.Security.Providers.NewTls/Makefile b/mcs/class/Mono.Security.Providers.NewTls/Makefile deleted file mode 100644 index 54270bccc55..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -thisdir = class/Mono.Security.Providers.NewTls -SUBDIRS = -include ../../build/rules.make - -LIBRARY = Mono.Security.Providers.NewTls.dll -LIB_REFS = System NewSystemSource=Mono.Security.Providers.NewSystemSource Mono.Security -LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign - -include ../../build/library.make - -$(the_lib): ../Mono.Security/Makefile - diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj deleted file mode 100644 index 158b0957982..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj +++ /dev/null @@ -1,111 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C8B8E524-BB3A-44E2-8C22-E3313E9F477C} - Library - 1699,1030 - ./../../class/lib/net_4_x - obj-net_4_x - false - True - - True - true - Properties - - - Mono.Security.Providers.NewTls - v4.5 - 512 - - - true - true - - - ../mono.pub - - - true - full - 1699,1030 - false - TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1030 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {42D59DE7-586F-4ACF-BDD5-E7869E39E3EF} - Mono.Security-net_4_x - - - {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E} - Mono.Security.Providers.NewSystemSource-net_4_x - NewSystemSource - - - - - - diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls.dll.sources b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls.dll.sources deleted file mode 100644 index 12d8a20f781..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls.dll.sources +++ /dev/null @@ -1,13 +0,0 @@ -./Properties/AssemblyInfo.cs -../../build/common/SR.cs -../../build/common/Consts.cs -../../build/common/Locale.cs - -./Mono.Security.Providers.NewTls/ITlsConfiguration.cs -./Mono.Security.Providers.NewTls/ITlsContext.cs - -./Mono.Security.Providers.NewTls/MonoNewTlsStream.cs -./Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs -./Mono.Security.Providers.NewTls/NewTlsProvider.cs -./Mono.Security.Providers.NewTls/TlsContextWrapper.cs -./Mono.Security.Providers.NewTls/TlsProviderFactory.cs diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsConfiguration.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsConfiguration.cs deleted file mode 100644 index 401afd763eb..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsConfiguration.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// ITlsContext.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015-2016 Xamarin, Inc. -// -// 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; -using System.Security.Cryptography; - -using Mono.Security.Interface; -using MX = Mono.Security.X509; - -namespace Mono.Security.Providers.NewTls -{ - interface ITlsConfiguration - { - bool HasCredentials { - get; - } - - void SetCertificate (MX.X509Certificate certificate, AsymmetricAlgorithm privateKey); - - bool? AskForClientCertificate { - get; set; - } - } -} diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsContext.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsContext.cs deleted file mode 100644 index 0d69805c4d0..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsContext.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// ITlsContext.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015-2016 Xamarin, Inc. -// -// 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. - -extern alias NewSystemSource; - -using System; -using System.Security.Cryptography; - -using Mono.Security.Interface; -using MX = Mono.Security.X509; - -namespace Mono.Security.Providers.NewTls -{ - interface ITlsContext : IDisposable - { - bool IsValid { - get; - } - - TlsException LastError { - get; - } - - bool ReceivedCloseNotify { - get; - } - - MonoTlsConnectionInfo ConnectionInfo { - get; - } - - MX.X509Certificate GetRemoteCertificate (out MX.X509CertificateCollection remoteCertificateStore); - - bool VerifyRemoteCertificate (); - - int GenerateNextToken (TlsBuffer incoming, TlsMultiBuffer outgoing); - - int DecryptMessage (ref TlsBuffer incoming); - - int EncryptMessage (ref TlsBuffer incoming); - - byte[] CreateAlert (Alert alert); - - byte[] CreateHelloRequest (); - } -} - diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStream.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStream.cs deleted file mode 100644 index 6117f0f7740..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStream.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// MonoNewTlsStream.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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. - -extern alias NewSystemSource; - -using EncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy; -using LocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback; -using RemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback; -using SslStream = NewSystemSource::System.Net.Security.SslStream; - -using System; -using System.IO; -using System.Threading.Tasks; - -using MSI = Mono.Security.Interface; - -using XAuthenticatedStream = System.Net.Security.AuthenticatedStream; -using System.Security.Cryptography.X509Certificates; - -namespace Mono.Security.Providers.NewTls -{ - public class MonoNewTlsStream : SslStream, MSI.IMonoSslStream - { - MSI.MonoTlsProvider provider; - - internal MonoNewTlsStream (Stream innerStream, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings) - : this (innerStream, false, provider, settings) - { - } - - internal MonoNewTlsStream (Stream innerStream, bool leaveOpen, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings) - : base (innerStream, leaveOpen, EncryptionPolicy.RequireEncryption, provider, settings) - { - this.provider = provider; - } - - public MSI.MonoTlsProvider Provider { - get { return provider; } - } - - new public bool IsClosed { - get { return base.IsClosed; } - } - - public MSI.MonoTlsConnectionInfo GetConnectionInfo () - { - return GetMonoConnectionInfo (); - } - - public Task Shutdown () - { - return Task.Factory.FromAsync ((state, result) => BeginShutdown (state, result), EndShutdown, null); - } - - public Task RequestRenegotiation () - { - return Task.Factory.FromAsync ((state, result) => BeginRenegotiate (state, result), EndRenegotiate, null); - } - - X509Certificate MSI.IMonoSslStream.InternalLocalCertificate { - get { return InternalLocalCertificate; } - } - - XAuthenticatedStream MSI.IMonoSslStream.AuthenticatedStream { - get { return this; } - } - } -} - - diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs deleted file mode 100644 index d39f1bb2c51..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// MonoNewTlsStreamFactory.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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. - -extern alias NewSystemSource; - -using XEncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy; -using XSslPolicyErrors = NewSystemSource::System.Net.Security.SslPolicyErrors; -using XLocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback; -using XRemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback; - -using System; -using System.IO; -using System.Net.Security; -using System.Security.Authentication; - -using Mono.Security.Interface; - -using PSSCX = System.Security.Cryptography.X509Certificates; -using SSCX = System.Security.Cryptography.X509Certificates; - -namespace Mono.Security.Providers.NewTls -{ - public static class MonoNewTlsStreamFactory - { - internal static IMonoSslStream CreateSslStream ( - Stream innerStream, bool leaveInnerStreamOpen, - MonoTlsProvider provider, MonoTlsSettings settings = null) - { - return new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, provider, settings); - } - - public static MonoNewTlsStream CreateServer ( - Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings, - SSCX.X509Certificate serverCertificate, bool clientCertificateRequired, - SslProtocols enabledSslProtocols, bool checkCertificateRevocation) - { - var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings); - - try { - stream.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation); - } catch (Exception ex) { - var tlsEx = stream.LastError; - if (tlsEx != null) - throw new AggregateException (ex, tlsEx); - throw; - } - - return stream; - } - - public static MonoNewTlsStream CreateClient ( - Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings, - string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation) - { - var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings); - - try { - stream.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation); - } catch (Exception ex) { - var tlsEx = stream.LastError; - if (tlsEx != null) - throw new AggregateException (ex, tlsEx); - throw; - } - return stream; - } - } -} diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/NewTlsProvider.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/NewTlsProvider.cs deleted file mode 100644 index e2b347fbe2b..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/NewTlsProvider.cs +++ /dev/null @@ -1,95 +0,0 @@ -// -// NewTlsProvider.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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. - -extern alias NewSystemSource; - -using System; -using System.IO; -using System.Net; -using System.Net.Security; -using System.Security.Authentication; - -using MSI = Mono.Security.Interface; -using MX = Mono.Security.X509; - -using PSSCX = System.Security.Cryptography.X509Certificates; -using SSCX = System.Security.Cryptography.X509Certificates; - -namespace Mono.Security.Providers.NewTls -{ - public class NewTlsProvider : MSI.MonoTlsProvider - { - static readonly Guid id = new Guid ("e5ff34f1-8b7a-4aa6-aff9-24719d709693"); - - public override Guid ID { - get { return id; } - } - - public override string Name { - get { return "newtls"; } - } - - public override bool SupportsSslStream { - get { return true; } - } - - public override bool SupportsConnectionInfo { - get { return true; } - } - - public override bool SupportsMonoExtensions { - get { return true; } - } - - internal override bool SupportsTlsContext { - get { return true; } - } - - public override SslProtocols SupportedProtocols { - get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; } - } - - public override MSI.IMonoSslStream CreateSslStream ( - Stream innerStream, bool leaveInnerStreamOpen, - MSI.MonoTlsSettings settings = null) - { - return MonoNewTlsStreamFactory.CreateSslStream (innerStream, leaveInnerStreamOpen, this, settings); - } - - internal override MSI.IMonoTlsContext CreateTlsContext ( - string hostname, bool serverMode, MSI.TlsProtocols protocolFlags, - SSCX.X509Certificate serverCertificate, PSSCX.X509CertificateCollection clientCertificates, - bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy, - MSI.MonoTlsSettings settings) - { - var config = TlsProviderFactory.CreateTlsConfiguration ( - hostname, serverMode, protocolFlags, serverCertificate, - remoteCertRequired, settings); - return new TlsContextWrapper (config, serverMode); - } - } -} - diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsContextWrapper.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsContextWrapper.cs deleted file mode 100644 index 389dd1a19f3..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsContextWrapper.cs +++ /dev/null @@ -1,221 +0,0 @@ -// -// TlsContextWrapper.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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. - -extern alias NewSystemSource; - -using System; -using System.Security.Cryptography; - -using SSCX = System.Security.Cryptography.X509Certificates; -using PSSCX = System.Security.Cryptography.X509Certificates; - -using MSI = Mono.Security.Interface; -using MX = Mono.Security.X509; - -namespace Mono.Security.Providers.NewTls -{ - class TlsContextWrapper : IDisposable, MSI.IMonoTlsContext - { - ITlsConfiguration config; - ITlsContext context; - bool serverMode; - - public TlsContextWrapper (ITlsConfiguration config, bool serverMode) - { - this.config = config; - this.serverMode = serverMode; - } - - public bool IsServer { - get { return serverMode; } - } - - public bool IsValid { - get { return context != null && context.IsValid; } - } - - public void Initialize (MSI.IMonoTlsEventSink eventSink) - { - if (context != null) - throw new InvalidOperationException (); - context = TlsProviderFactory.CreateTlsContext (config, serverMode, eventSink); - } - - void Clear () - { - if (context != null) { - context.Dispose (); - context = null; - } - } - - public ITlsConfiguration Configuration { - get { - if (config == null) - throw new ObjectDisposedException ("TlsConfiguration"); - return config; - } - } - - public ITlsContext Context { - get { - if (!IsValid) - throw new ObjectDisposedException ("TlsContext"); - return context; - } - } - - public bool HasCredentials { - get { return Configuration.HasCredentials; } - } - - public void SetCertificate (SSCX.X509Certificate certificate, AsymmetricAlgorithm privateKey) - { - var monoCert = new MX.X509Certificate (certificate.GetRawCertData ()); - Configuration.SetCertificate (monoCert, privateKey); - } - - public int GenerateNextToken (MSI.IBufferOffsetSize incoming, out MSI.IBufferOffsetSize outgoing) - { - var input = incoming != null ? new MSI.TlsBuffer (BOSWrapper.Wrap (incoming)) : null; - var output = new MSI.TlsMultiBuffer (); - var retval = Context.GenerateNextToken (input, output); - if (output.IsEmpty) - outgoing = null; - outgoing = BOSWrapper.Wrap (output.StealBuffer ()); - return (int)retval; - } - - public int EncryptMessage (ref MSI.IBufferOffsetSize incoming) - { - var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming)); - var retval = Context.EncryptMessage (ref buffer); - incoming = BOSWrapper.Wrap (buffer.GetRemaining ()); - return (int)retval; - } - - public int DecryptMessage (ref MSI.IBufferOffsetSize incoming) - { - var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming)); - var retval = Context.DecryptMessage (ref buffer); - incoming = buffer != null ? BOSWrapper.Wrap (buffer.GetRemaining ()) : null; - return (int)retval; - } - - class BOSWrapper : MSI.IBufferOffsetSize - { - public byte[] Buffer { - get; - private set; - } - - public int Offset { - get; - private set; - } - - public int Size { - get; - private set; - } - - BOSWrapper (byte[] buffer, int offset, int size) - { - Buffer = buffer; - Offset = offset; - Size = size; - } - - public static BOSWrapper Wrap (MSI.IBufferOffsetSize bos) - { - return bos != null ? new BOSWrapper (bos.Buffer, bos.Offset, bos.Size) : null; - } - } - - public byte[] CreateCloseNotify () - { - return Context.CreateAlert (new MSI.Alert (MSI.AlertLevel.Warning, MSI.AlertDescription.CloseNotify)); - } - - public byte[] CreateHelloRequest () - { - return Context.CreateHelloRequest (); - } - - public SSCX.X509Certificate GetRemoteCertificate (out PSSCX.X509CertificateCollection remoteCertificateStore) - { - MX.X509CertificateCollection monoCollection; - var remoteCert = Context.GetRemoteCertificate (out monoCollection); - if (remoteCert == null) { - remoteCertificateStore = null; - return null; - } - - remoteCertificateStore = new PSSCX.X509CertificateCollection (); - foreach (var cert in monoCollection) { - remoteCertificateStore.Add (new PSSCX.X509Certificate2 (cert.RawData)); - } - return new PSSCX.X509Certificate2 (remoteCert.RawData); - - } - - public bool VerifyRemoteCertificate () - { - return Context.VerifyRemoteCertificate (); - } - - public Exception LastError { - get { - if (context != null) - return context.LastError; - return null; - } - } - - public bool ReceivedCloseNotify { - get { - return Context.ReceivedCloseNotify; - } - } - - public MSI.MonoTlsConnectionInfo GetConnectionInfo () - { - return Context.ConnectionInfo; - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - void Dispose (bool disposing) - { - Clear (); - } - } -} - diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsProviderFactory.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsProviderFactory.cs deleted file mode 100644 index 92d8ab08f69..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsProviderFactory.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// TlsProviderFactory.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015-2016 Xamarin, Inc. -// -// 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. - -extern alias NewSystemSource; - -using System; -using System.IO; - -using System.Net; -using System.Net.Security; -using System.Security.Authentication; - -using MSI = Mono.Security.Interface; -using MX = Mono.Security.X509; - -using PSSCX = System.Security.Cryptography.X509Certificates; -using SSCX = System.Security.Cryptography.X509Certificates; - -namespace Mono.Security.Providers.NewTls -{ - static class TlsProviderFactory - { - const string assemblyName = "Mono.Security.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=84e3aee7225169c2"; - const string tlsConfigTypeName = "Mono.Security.NewTls.TlsConfiguration"; - const string tlsContextTypeName = "Mono.Security.NewTls.TlsContext"; - - static object CreateInstance (string typeName, object[] args) - { - var type = Type.GetType (typeName + ", " + assemblyName); - return Activator.CreateInstance (type, args); - } - - internal static ITlsConfiguration CreateTlsConfiguration ( - string hostname, bool serverMode, MSI.TlsProtocols protocolFlags, - SSCX.X509Certificate serverCertificate, bool remoteCertRequired, - MSI.MonoTlsSettings settings) - { - object[] args; - ITlsConfiguration config; - if (serverMode) { - var cert = (PSSCX.X509Certificate2)serverCertificate; - var monoCert = new MX.X509Certificate (cert.RawData); - args = new object[] { - (MSI.TlsProtocols)protocolFlags, - (MSI.MonoTlsSettings)settings, - monoCert, - cert.PrivateKey - }; - } else { - args = new object[] { - (MSI.TlsProtocols)protocolFlags, - (MSI.MonoTlsSettings)settings, - hostname - }; - } - - config = (ITlsConfiguration)CreateInstance (tlsConfigTypeName, args); - - if (serverMode && remoteCertRequired) - config.AskForClientCertificate = true; - - return config; - } - - internal static ITlsContext CreateTlsContext ( - ITlsConfiguration config, bool serverMode, - MSI.IMonoTlsEventSink eventSink) - { - return (ITlsContext)CreateInstance ( - tlsContextTypeName, - new object[] { config, serverMode, eventSink }); - } - } -} diff --git a/mcs/class/Mono.Security.Providers.NewTls/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.NewTls/Properties/AssemblyInfo.cs deleted file mode 100644 index e3690939201..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// AssemblyInfo.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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; -using System.Reflection; -using System.Resources; -using System.Security; -using System.Security.Permissions; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about the system assembly - -[assembly: AssemblyVersion (Consts.FxVersion)] - -[assembly: AssemblyCompany ("Xamarin")] -[assembly: AssemblyCopyright ("(c) 2015 Xamarin")] -[assembly: AssemblyDescription ("Mono.Security.Providers.NewTls.dll")] -[assembly: AssemblyProduct ("MONO CLI")] -[assembly: AssemblyTitle ("Mono.Security.Providers.NewTls.dll")] -[assembly: CLSCompliant (false)] -[assembly: ComVisible (false)] -[assembly: NeutralResourcesLanguage ("en-US")] - -[assembly: InternalsVisibleTo ("Mono.Security.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")] diff --git a/mcs/class/Mono.Security.Providers.NewTls/mobile_Mono.Security.Providers.NewTls.dll.sources b/mcs/class/Mono.Security.Providers.NewTls/mobile_Mono.Security.Providers.NewTls.dll.sources deleted file mode 100644 index 7218dabc34a..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/mobile_Mono.Security.Providers.NewTls.dll.sources +++ /dev/null @@ -1,7 +0,0 @@ -Properties/AssemblyInfo.cs - -Mono.Security.Providers.NewTls/ITlsConfiguration.cs -Mono.Security.Providers.NewTls/ITlsContext.cs - -Mono.Security.Providers.NewTls/MonoNewTlsStream.cs -Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs diff --git a/mcs/class/Mono.Security.Providers.NewTls/mobile_static_Mono.Security.Providers.NewTls.dll.sources b/mcs/class/Mono.Security.Providers.NewTls/mobile_static_Mono.Security.Providers.NewTls.dll.sources deleted file mode 100644 index baded514340..00000000000 --- a/mcs/class/Mono.Security.Providers.NewTls/mobile_static_Mono.Security.Providers.NewTls.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_Mono.Security.Providers.NewTls.dll.sources diff --git a/mcs/class/Mono.Security.Providers.OldTls/Makefile b/mcs/class/Mono.Security.Providers.OldTls/Makefile deleted file mode 100644 index 5dc06c07255..00000000000 --- a/mcs/class/Mono.Security.Providers.OldTls/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -thisdir = class/Mono.Security.Providers.OldTls -SUBDIRS = -include ../../build/rules.make - -LIBRARY = Mono.Security.Providers.OldTls.dll -LIB_REFS = System Mono.Security -LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP - -include ../../build/library.make - -$(the_lib): ../Mono.Security/Makefile - diff --git a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj b/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj deleted file mode 100644 index 32ceb300355..00000000000 --- a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj +++ /dev/null @@ -1,167 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E485E885-59B1-4081-BC66-56AAAFD8771A} - Library - 1699,1030 - ./../../class/lib/net_4_x - obj-net_4_x - false - True - - True - true - Properties - - - Mono.Security.Providers.OldTls - v4.5 - 512 - - - true - true - - - ../mono.pub - - - true - full - 1699,1030 - false - TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP - prompt - 4 - - - pdbonly - 1699,1030 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {42D59DE7-586F-4ACF-BDD5-E7869E39E3EF} - Mono.Security-net_4_x - - - - - - - diff --git a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls.dll.sources b/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls.dll.sources deleted file mode 100644 index 13653b8666a..00000000000 --- a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls.dll.sources +++ /dev/null @@ -1,73 +0,0 @@ -./Properties/AssemblyInfo.cs -../../build/common/Consts.cs -../../build/common/Locale.cs -../../build/common/MonoTODOAttribute.cs - -./Mono.Security.Providers.OldTls/OldTlsProvider.cs -../System/Mono.Net.Security/LegacySslStream.cs - -../Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs -../Mono.Security/Mono.Security.Cryptography/TlsHMAC.cs -../Mono.Security/Mono.Security.Protocol.Tls/Alert.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientContext.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientSessionCache.cs -../Mono.Security/Mono.Security.Protocol.Tls/ContentType.cs -../Mono.Security/Mono.Security.Protocol.Tls/Context.cs -../Mono.Security/Mono.Security.Protocol.Tls/DebugHelper.cs -../Mono.Security/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/HandshakeState.cs -../Mono.Security/Mono.Security.Protocol.Tls/HashAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs -../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityCompressionType.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityParameters.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs -../Mono.Security/Mono.Security.Protocol.Tls/ServerContext.cs -../Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslCipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslHandshakeHash.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsClientSettings.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsException.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsServerSettings.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs -../Mono.Security/Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/GeneralNames.cs -../Mono.Security/Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/SubjectAltNameExtension.cs diff --git a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls/OldTlsProvider.cs b/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls/OldTlsProvider.cs deleted file mode 100644 index 4532a17e02f..00000000000 --- a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls/OldTlsProvider.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// OldTlsProvider.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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; -using System.IO; -using System.Net; -using System.Net.Security; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; -using Mono.Security.Interface; -using MNS = Mono.Net.Security; - -namespace Mono.Security.Providers.OldTls -{ - public class OldTlsProvider : MonoTlsProvider - { - static readonly Guid id = new Guid ("cf8baa0d-c6ed-40ae-b512-dec8d097e9af"); - - public override Guid ID { - get { return id; } - } - - public override string Name { - get { return "old"; } - } - - public override bool SupportsSslStream { - get { return true; } - } - - public override bool SupportsMonoExtensions { - get { return false; } - } - - public override bool SupportsConnectionInfo { - get { return false; } - } - - internal override bool SupportsTlsContext { - get { return false; } - } - - public override SslProtocols SupportedProtocols { - get { return SslProtocols.Tls; } - } - - public override IMonoSslStream CreateSslStream ( - Stream innerStream, bool leaveInnerStreamOpen, - MonoTlsSettings settings = null) - { - var impl = new MNS.Private.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings); - return new MNS.Private.MonoSslStreamImpl (impl); - } - - internal override IMonoTlsContext CreateTlsContext ( - string hostname, bool serverMode, TlsProtocols protocolFlags, - X509Certificate serverCertificate, X509CertificateCollection clientCertificates, - bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy, - MonoTlsSettings settings) - { - throw new NotSupportedException (); - } - } -} - diff --git a/mcs/class/Mono.Security.Providers.OldTls/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.OldTls/Properties/AssemblyInfo.cs deleted file mode 100644 index 923beca26cd..00000000000 --- a/mcs/class/Mono.Security.Providers.OldTls/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// AssemblyInfo.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin, Inc. -// -// 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; -using System.Reflection; -using System.Resources; -using System.Security; -using System.Security.Permissions; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about the system assembly - -[assembly: AssemblyVersion (Consts.FxVersion)] - -[assembly: AssemblyCompany ("MONO development team")] -[assembly: AssemblyCopyright ("(c) 2015 Xamarin")] -[assembly: AssemblyDescription ("Mono.Security.Providers.OldTls.dll")] -[assembly: AssemblyProduct ("MONO CLI")] -[assembly: AssemblyTitle ("Mono.Security.Providers.OldTls.dll")] -[assembly: CLSCompliant (true)] -[assembly: ComVisible (false)] -[assembly: NeutralResourcesLanguage ("en-US")] - diff --git a/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs b/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs index 3e79d28a8fe..eeccc251f7d 100644 --- a/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs +++ b/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs @@ -66,8 +66,3 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")] #endif -[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] -[assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] -[assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] -[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] -[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")] diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs b/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs index fd392b409e5..594580b86d7 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs @@ -148,17 +148,23 @@ namespace Mono.Security.Interface /* * Internal API, intended to be used by MonoTlsProvider implementations. */ + internal static ICertificateValidator2 GetInternalValidator (MonoTlsSettings settings, MonoTlsProvider provider) + { + return (ICertificateValidator2)NoReflectionHelper.GetInternalValidator (provider, settings); + } + + [Obsolete ("Use GetInternalValidator")] internal static ICertificateValidator2 GetDefaultValidator (MonoTlsSettings settings, MonoTlsProvider provider) { - return (ICertificateValidator2)NoReflectionHelper.GetDefaultCertificateValidator (provider, settings); + return GetInternalValidator (settings, provider); } /* * Use this overloaded version in user code. */ - public static ICertificateValidator GetValidator (MonoTlsSettings settings, MonoTlsProvider provider = null) + public static ICertificateValidator GetValidator (MonoTlsSettings settings) { - return GetDefaultValidator (settings, provider); + return (ICertificateValidator)NoReflectionHelper.GetDefaultValidator (settings); } } } diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs b/mcs/class/Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs index 66980df81a6..1060677c594 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs @@ -31,6 +31,7 @@ namespace Mono.Security.Interface /// /// RFC 2246 A.5 /// + [CLSCompliant (false)] public enum CipherSuiteCode : ushort { TLS_NULL_WITH_NULL_NULL = 0x0000, diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs index 4bc5f436f45..120d885eaf0 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs @@ -29,6 +29,7 @@ namespace Mono.Security.Interface { public class MonoTlsConnectionInfo { + [CLSCompliant (false)] public CipherSuiteCode CipherSuiteCode { get; set; } @@ -49,6 +50,10 @@ namespace Mono.Security.Interface get; set; } + public string PeerDomainName { + get; set; + } + public override string ToString () { return string.Format ("[MonoTlsConnectionInfo: {0}:{1}]", ProtocolVersion, CipherSuiteCode); diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs index 24b28a790ef..7721bb00a51 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs @@ -82,6 +82,7 @@ namespace Mono.Security.Interface get; set; } + [CLSCompliant (false)] public CipherSuiteCode[] EnabledCiphers { get; set; } diff --git a/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config b/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config deleted file mode 120000 index 6f31b34dcaa..00000000000 --- a/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config +++ /dev/null @@ -1 +0,0 @@ -Test/App.config \ No newline at end of file diff --git a/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config b/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config new file mode 100644 index 00000000000..d07b4f882f8 --- /dev/null +++ b/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config @@ -0,0 +1,8 @@ + + + + + + + diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs index 873ce5782aa..cbf1491612f 100644 --- a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs +++ b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs @@ -30,10 +30,10 @@ using System; namespace Microsoft.Win32.SafeHandles { - public abstract class SafeNCryptHandle : System.Runtime.InteropServices.SafeHandle + public abstract class SafeNCryptHandle : SafeHandleZeroOrMinusOneIsInvalid { protected SafeNCryptHandle () - : base (IntPtr.Zero, true) + : base (true) { } diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs index 18bfca4934c..fbc55fd73b5 100644 --- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs +++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs @@ -111,9 +111,9 @@ namespace System.IO.MemoryMappedFiles public class MemoryMappedFile : IDisposable { - MemoryMappedFileAccess fileAccess; - string name; - long fileCapacity; + // MemoryMappedFileAccess fileAccess; + // string name; + // long fileCapacity; // // We allow the use of either the FileStream/keepOpen combo @@ -144,8 +144,8 @@ namespace System.IO.MemoryMappedFiles return new MemoryMappedFile () { handle = handle, - fileAccess = MemoryMappedFileAccess.ReadWrite, - fileCapacity = capacity + // fileAccess = MemoryMappedFileAccess.ReadWrite, + // fileCapacity = capacity }; } @@ -176,9 +176,9 @@ namespace System.IO.MemoryMappedFiles return new MemoryMappedFile () { handle = handle, - fileAccess = access, - name = mapName, - fileCapacity = capacity + // fileAccess = access, + // name = mapName, + // fileCapacity = capacity }; } @@ -193,15 +193,15 @@ namespace System.IO.MemoryMappedFiles if ((!MonoUtil.IsUnix && capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length)) throw new ArgumentException ("capacity"); - IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.Handle, mapName, out capacity, access, MemoryMappedFileOptions.DelayAllocatePages); + IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.SafeFileHandle.DangerousGetHandle (), mapName, out capacity, access, MemoryMappedFileOptions.DelayAllocatePages); MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability); return new MemoryMappedFile () { handle = handle, - fileAccess = access, - name = mapName, - fileCapacity = capacity, + // fileAccess = access, + // name = mapName, + // fileCapacity = capacity, stream = fileStream, keepOpen = leaveOpen @@ -220,15 +220,15 @@ namespace System.IO.MemoryMappedFiles if ((!MonoUtil.IsUnix && capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length)) throw new ArgumentException ("capacity"); - IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.Handle, mapName, out capacity, access, MemoryMappedFileOptions.DelayAllocatePages); + IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.SafeFileHandle.DangerousGetHandle (), mapName, out capacity, access, MemoryMappedFileOptions.DelayAllocatePages); MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability); return new MemoryMappedFile () { handle = handle, - fileAccess = access, - name = mapName, - fileCapacity = capacity, + // fileAccess = access, + // name = mapName, + // fileCapacity = capacity, stream = fileStream, keepOpen = leaveOpen @@ -249,9 +249,9 @@ namespace System.IO.MemoryMappedFiles return new MemoryMappedFile () { handle = handle, - fileAccess = access, - name = mapName, - fileCapacity = capacity + // fileAccess = access, + // name = mapName, + // fileCapacity = capacity }; } diff --git a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs index 97455f30cda..18c82aeac31 100644 --- a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs +++ b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs @@ -70,13 +70,15 @@ namespace System.IO.Pipes } #endif -#if !MOBILE public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity) : base (direction, bufferSize) { if (direction == PipeDirection.InOut) throw new NotSupportedException ("Anonymous pipe direction can only be either in or out."); +#if MOBILE + throw new NotImplementedException (); +#else if (IsWindows) impl = new Win32AnonymousPipeServer (this, direction, inheritability, bufferSize, pipeSecurity); else @@ -84,8 +86,8 @@ namespace System.IO.Pipes InitializeHandle (impl.Handle, false, false); IsConnected = true; - } #endif + } [MonoTODO] public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle) diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs index a5a9ebd3fbc..a823217957d 100644 --- a/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs @@ -100,21 +100,23 @@ namespace System.IO.Pipes #endif } -#if !MOBILE public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability) : base (ToDirection (desiredAccessRights), DefaultBufferSize) { if (impersonationLevel != TokenImpersonationLevel.None || inheritability != HandleInheritability.None) throw ThrowACLException (); - +#if MOBILE + throw new NotImplementedException (); +#else if (IsWindows) impl = new Win32NamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability); else impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability); - } #endif + } + ~NamedPipeClientStream () { Dispose (false); } @@ -163,6 +165,10 @@ namespace System.IO.Pipes throw new NotImplementedException (); } + protected override internal void CheckPipePropertyOperations () { + base.CheckPipePropertyOperations(); + } + public int NumberOfServerInstances { get { CheckPipePropertyOperations (); diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs index 3ffe8943672..e402a8a2620 100644 --- a/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs @@ -83,7 +83,6 @@ namespace System.IO.Pipes } #endif -#if !MOBILE public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity) : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, HandleInheritability.None) { @@ -100,7 +99,9 @@ namespace System.IO.Pipes { var rights = ToAccessRights (direction) | additionalAccessRights; // FIXME: reject some rights declarations (for ACL). - +#if MOBILE + throw new NotImplementedException (); +#else if (IsWindows) impl = new Win32NamedPipeServer (this, pipeName, maxNumberOfServerInstances, transmissionMode, rights, options, inBufferSize, outBufferSize, @@ -110,8 +111,8 @@ namespace System.IO.Pipes rights, options, inBufferSize, outBufferSize, inheritability); InitializeHandle (impl.Handle, false, (options & PipeOptions.Asynchronous) != PipeOptions.None); - } #endif + } public NamedPipeServerStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle) : base (direction, DefaultBufferSize) @@ -140,14 +141,12 @@ namespace System.IO.Pipes impl.Disconnect (); } -#if !MOBILE [MonoTODO] [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)] public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker) { throw new NotImplementedException (); } -#endif public void WaitForConnection () { @@ -173,7 +172,6 @@ namespace System.IO.Pipes throw new NotImplementedException (); } -#if !MOBILE // async operations Action wait_connect_delegate; @@ -190,7 +188,6 @@ namespace System.IO.Pipes { wait_connect_delegate.EndInvoke (asyncResult); } -#endif } } diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs b/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs index 20b7e7ec09c..8dea76a2cac 100644 --- a/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs +++ b/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs @@ -57,7 +57,6 @@ namespace System.IO.Pipes return new NotImplementedException ("ACL is not supported in Mono"); } -#if !MOBILE internal static PipeAccessRights ToAccessRights (PipeDirection direction) { switch (direction) { @@ -88,7 +87,6 @@ namespace System.IO.Pipes throw new ArgumentOutOfRangeException (); } } -#endif protected PipeStream (PipeDirection direction, int bufferSize) : this (direction, PipeTransmissionMode.Byte, bufferSize) @@ -144,9 +142,7 @@ namespace System.IO.Pipes set { stream = value; } } -#if !MOBILE protected bool IsHandleExposed { get; private set; } -#endif [MonoTODO] public bool IsMessageComplete { get; private set; } @@ -182,19 +178,7 @@ namespace System.IO.Pipes } // initialize/dispose/state check -#if MOBILE - internal static void CheckPipePropertyOperations () - { - } - - static void CheckReadOperations () - { - } - static void CheckWriteOperations () - { - } -#else [MonoTODO] protected internal virtual void CheckPipePropertyOperations () { @@ -224,7 +208,6 @@ namespace System.IO.Pipes this.IsHandleExposed = isExposed; this.IsAsync = isAsync; } -#endif protected override void Dispose (bool disposing) { @@ -253,23 +236,29 @@ namespace System.IO.Pipes throw new NotSupportedException (); } -#if !MOBILE public PipeSecurity GetAccessControl () { +#if MOBILE + throw new PlatformNotSupportedException (); +#else return new PipeSecurity (SafePipeHandle, AccessControlSections.Owner | AccessControlSections.Group | AccessControlSections.Access); +#endif } public void SetAccessControl (PipeSecurity pipeSecurity) { +#if MOBILE + throw new PlatformNotSupportedException (); +#else if (pipeSecurity == null) throw new ArgumentNullException ("pipeSecurity"); pipeSecurity.Persist (SafePipeHandle); - } #endif + } // pipe I/O @@ -319,7 +308,6 @@ namespace System.IO.Pipes // async -#if !MOBILE Func read_delegate; [HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)] @@ -349,7 +337,6 @@ namespace System.IO.Pipes { write_delegate.EndInvoke (asyncResult); } -#endif } } diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs b/mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs index 2f06df8949a..a1c7e22d8c4 100644 --- a/mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs +++ b/mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs @@ -205,7 +205,7 @@ namespace System.IO.Pipes opener = delegate { var fs = new FileStream (name, FileMode.Open, RightsToFileAccess (desiredAccessRights), FileShare.ReadWrite); owner.Stream = fs; - handle = new SafePipeHandle (fs.Handle, false); + handle = new SafePipeHandle (fs.SafeFileHandle.DangerousGetHandle (), false); }; } @@ -271,7 +271,7 @@ namespace System.IO.Pipes // FIXME: maxNumberOfServerInstances, modes, sizes, handle inheritability var fs = new FileStream (name, FileMode.Open, RightsToFileAccess (rights), FileShare.ReadWrite); - handle = new SafePipeHandle (fs.Handle, false); + handle = new SafePipeHandle (fs.SafeFileHandle.DangerousGetHandle (), false); owner.Stream = fs; should_close_handle = true; } diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs index cab5d342086..2ca12fb601a 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs @@ -71,7 +71,12 @@ namespace System.Runtime.Remoting.Channels.Tcp else { IPHostEntry he = Dns.Resolve (Dns.GetHostName()); if (he.AddressList.Length == 0) throw new RemotingException ("IP address could not be determined for this host"); - host = he.AddressList [0].ToString (); + AddressFamily addressFamily = (Socket.OSSupportsIPv4) ? AddressFamily.InterNetwork : AddressFamily.InterNetworkV6; + IPAddress addr = GetMachineAddress (he, addressFamily); + if (addr != null) + host = addr.ToString (); + else + host = he.AddressList [0].ToString (); } } else @@ -259,6 +264,22 @@ namespace System.Runtime.Remoting.Channels.Tcp server_thread.Join (); server_thread = null; } + + private static IPAddress GetMachineAddress (IPHostEntry host, AddressFamily addressFamily) + { + IPAddress result = null; + if (host != null) { + IPAddress[] addressList = host.AddressList; + for (int i = 0; i < addressList.Length; i++) { + if (addressList[i].AddressFamily == addressFamily) { + result = addressList[i]; + break; + } + } + } + + return result; + } } class ClientConnection diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs index 74ed3335acb..19da4ee2235 100644 --- a/mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs +++ b/mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs @@ -55,6 +55,11 @@ namespace System.Runtime.Serialization return false; } + internal static void AddDefaultXmlType(XmlSchemaSet schemas, string localName, string ns) + { + throw new NotImplementedException(); + } + static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot) { xsdType = null; diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/XsdDataContractExporter_mobile.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/XsdDataContractExporter_mobile.cs new file mode 100644 index 00000000000..bc1bf438e2c --- /dev/null +++ b/mcs/class/System.Runtime.Serialization/ReferenceSources/XsdDataContractExporter_mobile.cs @@ -0,0 +1,54 @@ +// +// XsdDataContractExporter_mobile.cs +// +// Authors: +// Alexander Köplinger +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.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; +using System.Collections.Generic; +using System.Reflection; +using System.Xml; +using System.Xml.Schema; + +namespace System.Runtime.Serialization +{ + public class XsdDataContractExporter + { + public XsdDataContractExporter () { throw new NotImplementedException (); } + public XsdDataContractExporter (XmlSchemaSet schemas) { throw new NotImplementedException (); } + public ExportOptions Options { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } + public XmlSchemaSet Schemas { get { throw new NotImplementedException (); } } + public bool CanExport (ICollection assemblies) { throw new NotImplementedException ();} + public bool CanExport (ICollection types) { throw new NotImplementedException (); } + public bool CanExport (Type type) { throw new NotImplementedException (); } + public void Export (ICollection assemblies) { throw new NotImplementedException (); } + public void Export (ICollection types) { throw new NotImplementedException (); } + public void Export (Type type) { throw new NotImplementedException (); } + public XmlQualifiedName GetRootElementName (Type type) { throw new NotImplementedException (); } + public XmlSchemaType GetSchemaType (Type type) { throw new NotImplementedException (); } + public XmlQualifiedName GetSchemaTypeName (Type type) { throw new NotImplementedException (); } + } +} + diff --git a/mcs/class/System.Runtime.Serialization/mobile_System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/mobile_System.Runtime.Serialization.dll.sources index c0c73b07ad0..bc4259a994c 100644 --- a/mcs/class/System.Runtime.Serialization/mobile_System.Runtime.Serialization.dll.sources +++ b/mcs/class/System.Runtime.Serialization/mobile_System.Runtime.Serialization.dll.sources @@ -2,4 +2,5 @@ #include ReferenceSource.common.sources ReferenceSources/SchemaExporter_mobile.cs +ReferenceSources/XsdDataContractExporter_mobile.cs ReferenceSources/SimplifiedCodeTypeReference.cs diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs index 23e29ad314f..70a1c6e2bfe 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs @@ -2222,7 +2222,7 @@ namespace System.Windows.Forms protected virtual bool ShouldSerializeLinkHoverColor () { - return grid_style.LinkHoverColor != grid_style.LinkHoverColor; + return grid_style.LinkHoverColor != default_style.LinkHoverColor; } protected virtual bool ShouldSerializeParentRowsBackColor () diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Hwnd.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Hwnd.cs index 505a41a0449..b926e4ed1a8 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Hwnd.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Hwnd.cs @@ -596,7 +596,7 @@ namespace System.Windows.Forms { if (this.title_style == TitleStyle.Normal) { pt.Y += caption_height; - } else if (this.title_style == TitleStyle.Normal) { + } else if (this.title_style == TitleStyle.Tool) { pt.Y += tool_caption_height; } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ThemeVisualStyles.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ThemeVisualStyles.cs index 3e087ef5ac6..72034979fdb 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ThemeVisualStyles.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ThemeVisualStyles.cs @@ -2138,7 +2138,7 @@ namespace System.Windows.Forms static bool AreEqual (VisualStyleElement value1, VisualStyleElement value2) { return - value1.ClassName == value1.ClassName && + value1.ClassName == value2.ClassName && value1.Part == value2.Part && value1.State == value2.State; } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs index 32593bc4e01..de6710af0a5 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs @@ -729,6 +729,29 @@ namespace System.Xml.Serialization return serializable; } + protected IXmlSerializable ReadSerializable (IXmlSerializable serializable, bool wrappedAny) + { + string name = null; + string ns = null; + + if (wrappedAny) { + name = reader.LocalName; + ns = reader.NamespaceURI; + reader.Read (); + reader.MoveToContent (); + } + serializable.ReadXml (reader); + + if (wrappedAny) { + while (reader.NodeType == XmlNodeType.Whitespace) reader.Skip (); + if (reader.NodeType == XmlNodeType.None) reader.Skip (); + if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == name && reader.NamespaceURI == ns) { + reader.Read (); + } + } + return serializable; + } + protected string ReadString (string value) { readCount++; diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs index 0805d7f61a6..60bbc316699 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs @@ -204,6 +204,11 @@ namespace System.Xml.Serialization { } + public XmlSerializer (Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location) + : this (type, overrides, extraTypes, root, defaultNamespace, location, null) + { + } + public XmlSerializer (Type type, XmlAttributeOverrides overrides) : this (type, overrides, null, null, null) { diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerFactory.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerFactory.cs index 204b67f71c9..02c86fd7e62 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerFactory.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerFactory.cs @@ -61,6 +61,11 @@ namespace System.Xml.Serialization } } + public XmlSerializer CreateSerializer (Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location) + { + return CreateSerializer (type, overrides, extraTypes, root, defaultNamespace, location, null); + } + public XmlSerializer CreateSerializer (Type type, string defaultNamespace) { return CreateSerializer (type, null, null, null, defaultNamespace); diff --git a/mcs/class/System.XML/System.Xml.Xsl/XslCompiledTransform_Mobile.cs b/mcs/class/System.XML/System.Xml.Xsl/XslCompiledTransform_Mobile.cs index 94dcc0285ba..e2b3432b0ae 100644 --- a/mcs/class/System.XML/System.Xml.Xsl/XslCompiledTransform_Mobile.cs +++ b/mcs/class/System.XML/System.Xml.Xsl/XslCompiledTransform_Mobile.cs @@ -32,6 +32,7 @@ using System.CodeDom.Compiler; using System.Collections; using System.IO; using System.Text; +using System.Reflection; using System.Runtime.InteropServices; using System.Security; using System.Security.Policy; @@ -136,6 +137,11 @@ namespace System.Xml.Xsl Transform (input.CreateNavigator (), arguments, results, null); } + public void Transform (IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver) + { + Transform (input.CreateNavigator (), arguments, results, documentResolver); + } + public void Transform (XmlReader input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver) { Transform (new XPathDocument (input, XmlSpace.Preserve).CreateNavigator (), arguments, results, documentResolver); @@ -203,6 +209,15 @@ namespace System.Xml.Xsl Load (new XPathDocument (stylesheetUri, XmlSpace.Preserve).CreateNavigator (), settings, stylesheetResolver); } + public void Load (MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes) + { + throw new NotImplementedException (); + } + + public void Load (Type compiledStylesheet) + { + throw new NotImplementedException (); + } #endregion } diff --git a/mcs/class/System/Assembly/AssemblyInfo.cs b/mcs/class/System/Assembly/AssemblyInfo.cs index 3388150cf10..a80606ef668 100644 --- a/mcs/class/System/Assembly/AssemblyInfo.cs +++ b/mcs/class/System/Assembly/AssemblyInfo.cs @@ -74,10 +74,5 @@ using System.Runtime.InteropServices; [assembly: StringFreezing] [assembly: DefaultDependency (LoadHint.Always)] - [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] - [assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] - [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] - [assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] - [assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")] diff --git a/mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs b/mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs index f3091aa38bc..9bad4ea25dd 100644 --- a/mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs +++ b/mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs @@ -34,25 +34,16 @@ using System.Security; namespace Microsoft.Win32.SafeHandles { - public sealed class SafeX509ChainHandle : SafeHandle + public sealed class SafeX509ChainHandle : SafeHandleZeroOrMinusOneIsInvalid { - [MonoTODO] - public override bool IsInvalid - { - get - { - throw new NotImplementedException (); - } - } - - [MonoTODO] - internal SafeX509ChainHandle() : base ((IntPtr)0, false) + internal SafeX509ChainHandle (IntPtr handle) + : base (true) { throw new NotImplementedException (); } [MonoTODO] - protected override bool ReleaseHandle() + protected override bool ReleaseHandle () { throw new NotImplementedException (); } diff --git a/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs b/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs index 7827d97600b..5f90ffe2b82 100644 --- a/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs +++ b/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs @@ -99,7 +99,8 @@ namespace Mono.Net.Security Complete, WantRead, WantWrite, - ReadDone + ReadDone, + FinishWrite } class AsyncProtocolRequest @@ -160,9 +161,16 @@ namespace Mono.Net.Security Debug ("ResetRead: {0} {1}", oldStatus, Status); } + internal void ResetWrite () + { + var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantWrite); + Debug ("ResetWrite: {0} {1}", oldStatus, Status); + } + internal void RequestWrite () { var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantWrite, (int)AsyncOperationStatus.Running); + Debug ("RequestWrite: {0} {1}", oldStatus, Status); if (oldStatus == AsyncOperationStatus.Running) return; else if (oldStatus != AsyncOperationStatus.WantRead && oldStatus != AsyncOperationStatus.WantWrite) @@ -209,7 +217,19 @@ namespace Mono.Net.Security status = ProcessOperation (status); - var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)status, (int)AsyncOperationStatus.Running); + Debug ("ProcessOperation done: {0}", status); + + AsyncOperationStatus oldStatus; + if (status == AsyncOperationStatus.Complete) { + oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.FinishWrite, (int)AsyncOperationStatus.WantWrite); + if (oldStatus == AsyncOperationStatus.WantWrite) { + // We are done, but still need to flush the write queue. + status = AsyncOperationStatus.FinishWrite; + continue; + } + } + + oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)status, (int)AsyncOperationStatus.Running); Debug ("ProcessOperation done: {0} -> {1}", oldStatus, status); if (oldStatus != AsyncOperationStatus.Running) { @@ -243,7 +263,9 @@ namespace Mono.Net.Security else return AsyncOperationStatus.WantRead; } else if (status == AsyncOperationStatus.WantWrite) { + Debug ("ProcessOperation - want write"); Parent.InnerWrite (); + Debug ("ProcessOperation - want write done"); return AsyncOperationStatus.Continue; } else if (status == AsyncOperationStatus.Initialize || status == AsyncOperationStatus.Continue) { Debug ("ProcessOperation - continue"); @@ -255,6 +277,11 @@ namespace Mono.Net.Security status = Operation (this, status); Debug ("ProcessOperation - read done: {0}", status); return status; + } else if (status == AsyncOperationStatus.FinishWrite) { + Debug ("ProcessOperation - finish write"); + Parent.InnerWrite (); + Debug ("ProcessOperation - finish write done"); + return AsyncOperationStatus.Complete; } throw new InvalidOperationException (); diff --git a/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs b/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs index 5d2812d2738..3f14f95bea6 100644 --- a/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs +++ b/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs @@ -77,7 +77,7 @@ namespace Mono.Net.Security readonly MonoTlsStream tlsStream; readonly HttpWebRequest request; - internal static ICertificateValidator GetDefaultValidator (MonoTlsProvider provider, MonoTlsSettings settings) + internal static ICertificateValidator GetInternalValidator (MonoTlsProvider provider, MonoTlsSettings settings) { if (settings == null) return new ChainValidationHelper (provider, null, false, null, null); @@ -86,6 +86,16 @@ namespace Mono.Net.Security return new ChainValidationHelper (provider, settings, false, null, null); } + internal static ICertificateValidator GetDefaultValidator (MonoTlsSettings settings) + { + var provider = MonoTlsProviderFactory.GetProvider (); + if (settings == null) + return new ChainValidationHelper (provider, null, false, null, null); + if (settings.CertificateValidator != null) + throw new NotSupportedException (); + return new ChainValidationHelper (provider, settings, false, null, null); + } + #region SslStream support /* @@ -138,6 +148,8 @@ namespace Mono.Net.Security settings = MonoTlsSettings.CopyDefaultSettings (); if (cloneSettings) settings = settings.CloneWithValidator (this); + if (provider == null) + provider = MonoTlsProviderFactory.GetProvider (); this.provider = provider; this.settings = settings; diff --git a/mcs/class/System/Mono.Net.Security/LegacySslStream.cs b/mcs/class/System/Mono.Net.Security/LegacySslStream.cs index 1a6672f6c5c..7ec9a868139 100644 --- a/mcs/class/System/Mono.Net.Security/LegacySslStream.cs +++ b/mcs/class/System/Mono.Net.Security/LegacySslStream.cs @@ -91,7 +91,7 @@ namespace Mono.Net.Security.Private : base (innerStream, leaveInnerStreamOpen) { this.provider = provider; - certificateValidator = ChainValidationHelper.GetDefaultValidator (provider, settings); + certificateValidator = ChainValidationHelper.GetInternalValidator (provider, settings); } #endregion // Constructors diff --git a/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs b/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs index 8701ffe92e6..cf1082618e6 100644 --- a/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs +++ b/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs @@ -660,6 +660,7 @@ namespace Mono.Net.Security if (wantMore || writeBuffer.Size > 0) return AsyncOperationStatus.WantWrite; + asyncRequest.ResetWrite (); asyncRequest.UserResult = asyncRequest.CurrentSize; return AsyncOperationStatus.Complete; } diff --git a/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs b/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs index 677a5107697..752f0c49efb 100644 --- a/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs +++ b/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs @@ -54,7 +54,7 @@ namespace Mono.Net.Security this.clientCertificates = clientCertificates; this.askForClientCert = askForClientCert; - certificateValidator = CertificateValidationHelper.GetDefaultValidator ( + certificateValidator = CertificateValidationHelper.GetInternalValidator ( parent.Settings, parent.Provider); } diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs index e53b6eba4c8..3dc005344f3 100644 --- a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs +++ b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs @@ -104,21 +104,7 @@ namespace Mono.Net.Security static IMonoTlsProvider CreateDefaultProvider () { #if SECURITY_DEP - MSI.MonoTlsProvider provider = null; -#if MONO_FEATURE_NEW_SYSTEM_SOURCE - /* - * This is a hack, which is used in the Mono.Security.Providers.NewSystemSource - * assembly, which will provide a "fake" System.dll. Use the public Mono.Security - * API to get the "real" System.dll's provider via reflection, then wrap it with - * the "fake" version's perceived view. - * - * NewSystemSource needs to compile MonoTlsProviderFactory.cs, IMonoTlsProvider.cs, - * MonoTlsProviderWrapper.cs and CallbackHelpers.cs from this directory and only these. - */ - provider = MSI.MonoTlsProviderFactory.GetProvider (); -#else - provider = CreateDefaultProviderImpl (); -#endif + MSI.MonoTlsProvider provider = CreateDefaultProviderImpl (); if (provider != null) return new Private.MonoTlsProviderWrapper (provider); #endif @@ -131,7 +117,7 @@ namespace Mono.Net.Security #endregion -#if SECURITY_DEP && !MONO_FEATURE_NEW_SYSTEM_SOURCE +#if SECURITY_DEP static Dictionary providerRegistration; @@ -172,8 +158,6 @@ namespace Mono.Net.Security return; providerRegistration = new Dictionary (); providerRegistration.Add ("legacy", "Mono.Net.Security.Private.MonoLegacyTlsProvider"); - providerRegistration.Add ("newtls", "Mono.Security.Providers.NewTls.NewTlsProvider, Mono.Security.Providers.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"); - providerRegistration.Add ("oldtls", "Mono.Security.Providers.OldTls.OldTlsProvider, Mono.Security.Providers.OldTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"); #if HAVE_BTLS if (Mono.Btls.MonoBtlsProvider.IsSupported ()) providerRegistration.Add ("btls", "Mono.Btls.MonoBtlsProvider"); diff --git a/mcs/class/System/Mono.Net.Security/NoReflectionHelper.cs b/mcs/class/System/Mono.Net.Security/NoReflectionHelper.cs index 6de1cd25993..38600ac8d88 100644 --- a/mcs/class/System/Mono.Net.Security/NoReflectionHelper.cs +++ b/mcs/class/System/Mono.Net.Security/NoReflectionHelper.cs @@ -47,10 +47,19 @@ namespace Mono.Net.Security // internal static class NoReflectionHelper { - internal static object GetDefaultCertificateValidator (object provider, object settings) + internal static object GetInternalValidator (object provider, object settings) { #if SECURITY_DEP - return ChainValidationHelper.GetDefaultValidator ((MSI.MonoTlsProvider)provider, (MSI.MonoTlsSettings)settings); + return ChainValidationHelper.GetInternalValidator ((MSI.MonoTlsProvider)provider, (MSI.MonoTlsSettings)settings); + #else + throw new NotSupportedException (); + #endif + } + + internal static object GetDefaultValidator (object settings) + { + #if SECURITY_DEP + return ChainValidationHelper.GetDefaultValidator ((MSI.MonoTlsSettings)settings); #else throw new NotSupportedException (); #endif diff --git a/mcs/class/System/ReferenceSources/Internal.cs b/mcs/class/System/ReferenceSources/Internal.cs deleted file mode 100644 index 6c504503995..00000000000 --- a/mcs/class/System/ReferenceSources/Internal.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Internal.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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.Runtime.InteropServices; -using System.Security.Cryptography.X509Certificates; - -namespace System.Net.Security -{ - //From Schannel.h - [Flags] - internal enum SchProtocols - { - Zero = 0, - PctClient = 0x00000002, - PctServer = 0x00000001, - Pct = (PctClient | PctServer), - Ssl2Client = 0x00000008, - Ssl2Server = 0x00000004, - Ssl2 = (Ssl2Client | Ssl2Server), - Ssl3Client = 0x00000020, - Ssl3Server = 0x00000010, - Ssl3 = (Ssl3Client | Ssl3Server), - Tls10Client = 0x00000080, - Tls10Server = 0x00000040, - Tls10 = (Tls10Client | Tls10Server), - Tls11Client = 0x00000200, - Tls11Server = 0x00000100, - Tls11 = (Tls11Client | Tls11Server), - Tls12Client = 0x00000800, - Tls12Server = 0x00000400, - Tls12 = (Tls12Client | Tls12Server), - Ssl3Tls = (Ssl3 | Tls10), - UniClient = unchecked((int)0x80000000), - UniServer = 0x40000000, - Unified = (UniClient | UniServer), - ClientMask = (PctClient | Ssl2Client | Ssl3Client | Tls10Client | Tls11Client | Tls12Client | UniClient), - ServerMask = (PctServer | Ssl2Server | Ssl3Server | Tls10Server | Tls11Server | Tls12Server | UniServer) - } - - //From Schannel.h - [StructLayout (LayoutKind.Sequential)] - internal class SslConnectionInfo - { - public readonly int Protocol; - public readonly int DataCipherAlg; - public readonly int DataKeySize; - public readonly int DataHashAlg; - public readonly int DataHashKeySize; - public readonly int KeyExchangeAlg; - public readonly int KeyExchKeySize; - - internal SslConnectionInfo (int protocol) - { - Protocol = protocol; - } - } -} diff --git a/mcs/class/System/ReferenceSources/Logging.cs b/mcs/class/System/ReferenceSources/Logging.cs index b5b773e28c4..cacf8e90b32 100644 --- a/mcs/class/System/ReferenceSources/Logging.cs +++ b/mcs/class/System/ReferenceSources/Logging.cs @@ -21,6 +21,12 @@ namespace System.Net { } } + internal static TraceSource Sockets { + get { + return null; + } + } + [Conditional ("TRACE")] internal static void Enter(TraceSource traceSource, object obj, string method, object paramObject) { } diff --git a/mcs/class/System/ReferenceSources/SSPIConfiguration.cs b/mcs/class/System/ReferenceSources/SSPIConfiguration.cs deleted file mode 100644 index 3ab41387ef4..00000000000 --- a/mcs/class/System/ReferenceSources/SSPIConfiguration.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// SSPIConfiguration.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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. - -#if MONO_FEATURE_NEW_TLS && SECURITY_DEP -#if MONO_SECURITY_ALIAS -extern alias MonoSecurity; -using MonoSecurity::Mono.Security.Interface; -#else -using Mono.Security.Interface; -#endif -using Mono.Net.Security; - -namespace System.Net.Security -{ - internal interface SSPIConfiguration - { - IMonoTlsProvider Provider { - get; - } - - MonoTlsSettings Settings { - get; - } - - IMonoTlsEventSink EventSink { - get; - } - } -} -#endif diff --git a/mcs/class/System/ReferenceSources/SSPISafeHandles.cs b/mcs/class/System/ReferenceSources/SSPISafeHandles.cs deleted file mode 100644 index a12e395cf6f..00000000000 --- a/mcs/class/System/ReferenceSources/SSPISafeHandles.cs +++ /dev/null @@ -1,209 +0,0 @@ -// -// SafeHandles.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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. -#if MONO_FEATURE_NEW_TLS && SECURITY_DEP -#if MONO_SECURITY_ALIAS -extern alias MonoSecurity; -using IMonoTlsContext = MonoSecurity::Mono.Security.Interface.IMonoTlsContext; -#else -using IMonoTlsContext = Mono.Security.Interface.IMonoTlsContext; -#endif - -using System.Runtime.InteropServices; -using System.Security.Cryptography.X509Certificates; - -namespace System.Net.Security -{ - class DummySafeHandle : SafeHandle - { - protected DummySafeHandle () - : base ((IntPtr)(-1), true) - { - } - - protected override bool ReleaseHandle () - { - return true; - } - - public override bool IsInvalid { - get { return handle == (IntPtr)(-1); } - } - } - - class SafeFreeCertContext : DummySafeHandle - { - } - - class SafeFreeCredentials : DummySafeHandle - { - SecureCredential credential; - - public X509Certificate2 Certificate { - get { - if (IsInvalid) - throw new ObjectDisposedException ("Certificate"); - return credential.certificate; - } - } - - public SafeFreeCredentials (SecureCredential credential) - { - this.credential = credential; - bool success = true; - DangerousAddRef (ref success); - } - - public override bool IsInvalid { - get { - return credential.certificate == null; - } - } - - protected override bool ReleaseHandle () - { - credential.Clear (); - return base.ReleaseHandle (); - } - } - - class SafeDeleteContext : DummySafeHandle - { - IMonoTlsContext context; - - public IMonoTlsContext Context { - get { - if (IsInvalid) - throw new ObjectDisposedException ("TlsContext"); - return context; - } - } - - public SafeDeleteContext (IMonoTlsContext context) - { - this.context = context; - } - - public override bool IsInvalid { - get { - return context == null || !context.IsValid; - } - } - - protected override bool ReleaseHandle () - { - context.Dispose (); - context = null; - return base.ReleaseHandle (); - } - } - - struct SecureCredential - { - public const int CurrentVersion = 0x4; - - [Flags] - public enum Flags - { - Zero = 0, - NoSystemMapper = 0x02, - NoNameCheck = 0x04, - ValidateManual = 0x08, - NoDefaultCred = 0x10, - ValidateAuto = 0x20, - SendAuxRecord = 0x00200000, - UseStrongCrypto = 0x00400000 - } - - int version; - internal X509Certificate2 certificate; - SchProtocols protocols; - EncryptionPolicy policy; - - public SecureCredential (int version, X509Certificate2 certificate, SecureCredential.Flags flags, SchProtocols protocols, EncryptionPolicy policy) - { - this.version = version; - this.certificate = certificate; - this.protocols = protocols; - this.policy = policy; - } - - public void Clear () - { - certificate = null; - } - } - - internal class SafeCredentialReference : DummySafeHandle - { - // - // Static cache will return the target handle if found the reference in the table. - // - internal SafeFreeCredentials _Target; - - // - // - internal static SafeCredentialReference CreateReference (SafeFreeCredentials target) - { - SafeCredentialReference result = new SafeCredentialReference (target); - if (result.IsInvalid) - return null; - - return result; - } - - private SafeCredentialReference (SafeFreeCredentials target) - : base () - { - // Bumps up the refcount on Target to signify that target handle is statically cached so - // its dispose should be postponed - bool b = false; - try { - target.DangerousAddRef (ref b); - } catch { - if (b) { - target.DangerousRelease (); - b = false; - } - } finally { - if (b) { - _Target = target; - SetHandle (new IntPtr (0)); // make this handle valid - } - } - } - - override protected bool ReleaseHandle () - { - SafeFreeCredentials target = _Target; - if (target != null) - target.DangerousRelease (); - _Target = null; - return true; - } - } - -} -#endif diff --git a/mcs/class/System/ReferenceSources/SSPIWrapper.cs b/mcs/class/System/ReferenceSources/SSPIWrapper.cs deleted file mode 100644 index a0cb8d50193..00000000000 --- a/mcs/class/System/ReferenceSources/SSPIWrapper.cs +++ /dev/null @@ -1,303 +0,0 @@ -// -// SSPIWrapper.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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. - -#if MONO_FEATURE_NEW_TLS && SECURITY_DEP -#if MONO_SECURITY_ALIAS -extern alias MonoSecurity; -#endif - -#if MONO_SECURITY_ALIAS -using MX = MonoSecurity::Mono.Security.X509; -using MonoSecurity::Mono.Security.Interface; -#else -using MX = Mono.Security.X509; -using Mono.Security.Interface; -#endif - -using System.Runtime.InteropServices; -using System.Security.Authentication.ExtendedProtection; -using System.Security.Cryptography.X509Certificates; -using MNS = Mono.Net.Security; - -namespace System.Net.Security -{ - internal class SSPIInterface - { - public IMonoTlsContext Context { - get; - private set; - } - - public IMonoTlsEventSink EventSink { - get; - private set; - } - - public SSPIInterface (IMonoTlsContext context, IMonoTlsEventSink eventSink) - { - Context = context; - EventSink = eventSink; - } - } - - internal static class GlobalSSPI - { - internal static SSPIInterface Create (string hostname, bool serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, - bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus, EncryptionPolicy encryptionPolicy, - LocalCertSelectionCallback certSelectionDelegate, RemoteCertValidationCallback remoteValidationCallback, SSPIConfiguration userConfig) - { - if (userConfig.Settings != null && remoteValidationCallback != null) - throw new InvalidOperationException (); - var context = userConfig.Provider.CreateTlsContext ( - hostname, serverMode, (TlsProtocols)protocolFlags, serverCertificate, clientCertificates, - remoteCertRequired, checkCertName, checkCertRevocationStatus, - (MonoEncryptionPolicy)encryptionPolicy, userConfig.Settings); - return new SSPIInterface (context, userConfig.EventSink); - } - } - - /* - * SSPIWrapper _is a _class that provides a managed implementation of the equivalent - * _class _in Microsofts .NET Framework. - * - * The SSPIWrapper class is used by the TLS/SSL stack to implement both the - * protocol handshake as well as the encryption and decryption of messages. - * - * Microsoft's implementation of this class is merely a P/Invoke wrapper - * around the native SSPI APIs on Windows. This implementation instead, - * provides a managed implementation that uses the cross platform Mono.Security - * to provide the equivalent functionality. - * - * Ideally, this should be abstracted with a different name, and decouple - * the naming from the SSPIWrapper name, but this allows Mono to reuse - * the .NET code with minimal changes. - * - * The "internal" methods here are the API that is consumed by the class - * libraries. - */ - internal static class SSPIWrapper - { - static void SetCredentials (SSPIInterface secModule, SafeFreeCredentials credentials) - { - if (credentials != null && !credentials.IsInvalid) { - if (!secModule.Context.HasCredentials && credentials.Certificate != null) { - var cert = new X509Certificate2 (credentials.Certificate.RawData); - secModule.Context.SetCertificate (cert, credentials.Certificate.PrivateKey); - } - bool success = true; - credentials.DangerousAddRef (ref success); - } - } - - /* - * @safecontext is null on the first use, but it will become non-null for invocations - * where the connection is being re-negotiated. - * - */ - internal static int AcceptSecurityContext (SSPIInterface secModule, ref SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, ContextFlags inFlags, Endianness endianness, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, ref ContextFlags outFlags) - { - if (endianness != Endianness.Native) - throw new NotSupportedException (); - - if (safeContext == null) { - if (credentials == null || credentials.IsInvalid) - return (int)SecurityStatus.CredentialsNeeded; - - secModule.Context.Initialize (secModule.EventSink); - safeContext = new SafeDeleteContext (secModule.Context); - } - - SetCredentials (secModule, credentials); - - var incoming = GetInputBuffer (inputBuffer); - IBufferOffsetSize outgoing; - - var retval = (int)safeContext.Context.GenerateNextToken (incoming, out outgoing); - UpdateOutput (outgoing, outputBuffer); - return retval; - } - - internal static int InitializeSecurityContext (SSPIInterface secModule, ref SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, string targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, ref ContextFlags outFlags) - { - if (inputBuffer != null) - throw new InvalidOperationException (); - - if (safeContext == null) { - secModule.Context.Initialize (secModule.EventSink); - safeContext = new SafeDeleteContext (secModule.Context); - } - - return InitializeSecurityContext (secModule, credentials, ref safeContext, targetName, inFlags, endianness, null, outputBuffer, ref outFlags); - } - - internal static int InitializeSecurityContext (SSPIInterface secModule, SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, string targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer, ref ContextFlags outFlags) - { - if (endianness != Endianness.Native) - throw new NotSupportedException (); - - SetCredentials (secModule, credentials); - - SecurityBuffer inputBuffer = null; - if (inputBuffers != null) { - if (inputBuffers.Length != 2 || inputBuffers [1].type != BufferType.Empty) - throw new NotSupportedException (); - inputBuffer = inputBuffers [0]; - } - - var incoming = GetInputBuffer (inputBuffer); - IBufferOffsetSize outgoing = null; - - var retval = (int)safeContext.Context.GenerateNextToken (incoming, out outgoing); - UpdateOutput (outgoing, outputBuffer); - return retval; - } - - internal static int EncryptMessage (SSPIInterface secModule, SafeDeleteContext safeContext, SecurityBuffer securityBuffer, uint sequenceNumber) - { - var incoming = GetInputBuffer (securityBuffer); - var retval = (int)safeContext.Context.EncryptMessage (ref incoming); - UpdateOutput (incoming, securityBuffer); - return retval; - } - - internal static int DecryptMessage (SSPIInterface secModule, SafeDeleteContext safeContext, SecurityBuffer securityBuffer, uint sequenceNumber) - { - var incoming = GetInputBuffer (securityBuffer); - var retval = (int)safeContext.Context.DecryptMessage (ref incoming); - UpdateOutput (incoming, securityBuffer); - return retval; - } - - internal static byte[] CreateShutdownMessage (SSPIInterface secModule, SafeDeleteContext safeContext) - { - return safeContext.Context.CreateCloseNotify (); - } - - internal static byte[] CreateHelloRequestMessage (SSPIInterface secModule, SafeDeleteContext safeContext) - { - return safeContext.Context.CreateHelloRequest (); - } - - internal static bool IsClosed (SSPIInterface secModule, SafeDeleteContext safeContext) - { - return safeContext.Context.ReceivedCloseNotify; - } - - internal static SafeFreeCredentials AcquireCredentialsHandle (SSPIInterface SecModule, string package, CredentialUse intent, SecureCredential scc) - { - return new SafeFreeCredentials (scc); - } - - public static ChannelBinding QueryContextChannelBinding (SSPIInterface SecModule, SafeDeleteContext securityContext, ContextAttribute contextAttribute) - { - return null; - } - - internal static X509Certificate2 GetRemoteCertificate (SafeDeleteContext safeContext, out X509Certificate2Collection remoteCertificateStore) - { - X509CertificateCollection monoCollection; - if (safeContext == null || safeContext.IsInvalid) { - remoteCertificateStore = null; - return null; - } - var monoCert = safeContext.Context.GetRemoteCertificate (out monoCollection); - if (monoCert == null) { - remoteCertificateStore = null; - return null; - } - - remoteCertificateStore = new X509Certificate2Collection (); - foreach (var cert in monoCollection) { - remoteCertificateStore.Add (cert); - } - return (X509Certificate2)monoCert; - } - - internal static bool CheckRemoteCertificate (SafeDeleteContext safeContext) - { - return safeContext.Context.VerifyRemoteCertificate (); - } - - internal static MonoTlsConnectionInfo GetMonoConnectionInfo (SSPIInterface SecModule, SafeDeleteContext securityContext) - { - return securityContext.Context.GetConnectionInfo (); - } - - internal static SslConnectionInfo GetConnectionInfo (SSPIInterface SecModule, SafeDeleteContext securityContext) - { - var info = securityContext.Context.GetConnectionInfo (); - if (info == null) - return null; - - return new SslConnectionInfo ((int)info.ProtocolVersion); - } - - class InputBuffer : IBufferOffsetSize - { - public byte[] Buffer { - get; - private set; - } - - public int Offset { - get; - private set; - } - - public int Size { - get; - private set; - } - - public InputBuffer (byte[] buffer, int offset, int size) - { - Buffer = buffer; - Offset = offset; - Size = size; - } - } - - static IBufferOffsetSize GetInputBuffer (SecurityBuffer incoming) - { - return incoming != null ? new InputBuffer (incoming.token, incoming.offset, incoming.size) : null; - } - - static void UpdateOutput (IBufferOffsetSize buffer, SecurityBuffer outputBuffer) - { - if (buffer != null) { - outputBuffer.token = buffer.Buffer; - outputBuffer.offset = buffer.Offset; - outputBuffer.size = buffer.Size; - outputBuffer.type = BufferType.Token; - } else { - outputBuffer.token = null; - outputBuffer.size = outputBuffer.offset = 0; - outputBuffer.type = BufferType.Empty; - } - } - } -} -#endif diff --git a/mcs/class/System/ReferenceSources/Socket.cs b/mcs/class/System/ReferenceSources/Socket.cs index 8c1d12b8aaa..b5fa6ee09e5 100644 --- a/mcs/class/System/ReferenceSources/Socket.cs +++ b/mcs/class/System/ReferenceSources/Socket.cs @@ -37,10 +37,10 @@ namespace System.Net.Sockets // this version does not throw. internal void InternalShutdown (SocketShutdown how) { - if (!is_connected || is_disposed) + if (!is_connected || CleanedUp) return; int error; - Shutdown_internal (safe_handle, how, out error); + Shutdown_internal (m_Handle, how, out error); } internal IAsyncResult UnsafeBeginConnect (EndPoint remoteEP, AsyncCallback callback, object state) @@ -86,7 +86,7 @@ namespace System.Net.Sockets internal void SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int optionValue, bool silent) { - if (is_disposed && is_closed) { + if (CleanedUp && is_closed) { if (silent) return; throw new ObjectDisposedException (GetType ().ToString ()); @@ -94,7 +94,7 @@ namespace System.Net.Sockets int error; - SetSocketOption_internal (safe_handle, optionLevel, optionName, null, + SetSocketOption_internal (m_Handle, optionLevel, optionName, null, null, optionValue, out error); if (!silent && error != 0) diff --git a/mcs/class/System/ReferenceSources/SslStream.cs b/mcs/class/System/ReferenceSources/SslStream.cs deleted file mode 100644 index fea8922f809..00000000000 --- a/mcs/class/System/ReferenceSources/SslStream.cs +++ /dev/null @@ -1,141 +0,0 @@ -// -// Mono-specific additions to Microsoft's SslStream.cs -// -#if MONO_FEATURE_NEW_TLS && SECURITY_DEP -#if MONO_SECURITY_ALIAS -extern alias MonoSecurity; -using MonoSecurity::Mono.Security.Interface; -#else -using Mono.Security.Interface; -#endif -using System.Threading; -using System.Security.Cryptography.X509Certificates; -using MNS = Mono.Net.Security; - -namespace System.Net.Security -{ - using System.Net.Sockets; - using System.IO; - - partial class SslStream : IMonoTlsEventSink - { - #if SECURITY_DEP - SSPIConfiguration _Configuration; - - internal SslStream (Stream innerStream, bool leaveInnerStreamOpen, EncryptionPolicy encryptionPolicy, MonoTlsProvider provider, MonoTlsSettings settings) - : base (innerStream, leaveInnerStreamOpen) - { - if (encryptionPolicy != EncryptionPolicy.RequireEncryption && encryptionPolicy != EncryptionPolicy.AllowNoEncryption && encryptionPolicy != EncryptionPolicy.NoEncryption) - throw new ArgumentException (SR.GetString (SR.net_invalid_enum, "EncryptionPolicy"), "encryptionPolicy"); - - var validationHelper = MNS.ChainValidationHelper.CloneWithCallbackWrapper (provider, ref settings, myUserCertValidationCallbackWrapper); - - LocalCertSelectionCallback selectionCallback = null; - if (validationHelper.HasCertificateSelectionCallback) - selectionCallback = validationHelper.SelectClientCertificate; - - var internalProvider = new MNS.Private.MonoTlsProviderWrapper (provider); - _Configuration = new MyConfiguration (internalProvider, settings, this); - _SslState = new SslState (innerStream, null, selectionCallback, encryptionPolicy, _Configuration); - } - - /* - * Mono-specific version of 'userCertValidationCallbackWrapper'; we're called from ChainValidationHelper.ValidateChain() here. - * - * Since we're built without the PrebuiltSystem alias, we can't use 'SslPolicyErrors' here. This prevents us from creating a subclass of 'ChainValidationHelper' - * as well as providing a custom 'ServerCertValidationCallback'. - */ - bool myUserCertValidationCallbackWrapper (ServerCertValidationCallback callback, X509Certificate certificate, X509Chain chain, MonoSslPolicyErrors sslPolicyErrors) - { - m_RemoteCertificateOrBytes = certificate == null ? null : certificate.GetRawCertData (); - if (callback == null) { - if (!_SslState.RemoteCertRequired) - sslPolicyErrors &= ~MonoSslPolicyErrors.RemoteCertificateNotAvailable; - - return (sslPolicyErrors == MonoSslPolicyErrors.None); - } - - return MNS.ChainValidationHelper.InvokeCallback (callback, this, certificate, chain, sslPolicyErrors); - } - - class MyConfiguration : SSPIConfiguration - { - MNS.IMonoTlsProvider provider; - MonoTlsSettings settings; - IMonoTlsEventSink eventSink; - - public MyConfiguration (MNS.IMonoTlsProvider provider, MonoTlsSettings settings, IMonoTlsEventSink eventSink) - { - this.provider = provider; - this.settings = settings; - this.eventSink = eventSink; - } - - public MNS.IMonoTlsProvider Provider { - get { return provider; } - } - - public MonoTlsSettings Settings { - get { return settings; } - } - - public IMonoTlsEventSink EventSink { - get { return eventSink; } - } - } - #endif - - internal bool IsClosed { - get { return _SslState.IsClosed; } - } - - internal Exception LastError { - get { return lastError; } - } - - #region IMonoTlsEventSink - - Exception lastError; - - void IMonoTlsEventSink.Error (Exception exception) - { - Interlocked.CompareExchange (ref lastError, exception, null); - } - - void IMonoTlsEventSink.ReceivedCloseNotify () - { - } - - #endregion - - internal IAsyncResult BeginShutdown (AsyncCallback asyncCallback, object asyncState) - { - return _SslState.BeginShutdown (asyncCallback, asyncState); - } - - internal void EndShutdown (IAsyncResult asyncResult) - { - _SslState.EndShutdown (asyncResult); - } - - internal IAsyncResult BeginRenegotiate (AsyncCallback asyncCallback, object asyncState) - { - return _SslState.BeginRenegotiate (asyncCallback, asyncState); - } - - internal void EndRenegotiate (IAsyncResult asyncResult) - { - _SslState.EndRenegotiate (asyncResult); - } - - internal X509Certificate InternalLocalCertificate { - get { return _SslState.InternalLocalCertificate; } - } - - internal MonoTlsConnectionInfo GetMonoConnectionInfo () - { - return _SslState.GetMonoConnectionInfo (); - } - } -} -#endif diff --git a/mcs/class/System/ReferenceSources/_SecureChannel.cs b/mcs/class/System/ReferenceSources/_SecureChannel.cs deleted file mode 100644 index f920353a092..00000000000 --- a/mcs/class/System/ReferenceSources/_SecureChannel.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// Mono-specific additions to Microsoft's _SecureChannel.cs -// -#if MONO_FEATURE_NEW_TLS && SECURITY_DEP -#if MONO_SECURITY_ALIAS -extern alias MonoSecurity; -using MonoSecurity::Mono.Security.Interface; -#else -using Mono.Security.Interface; -#endif -namespace System.Net.Security -{ - partial class SecureChannel - { - internal MonoTlsConnectionInfo GetMonoConnectionInfo () - { - return SSPIWrapper.GetMonoConnectionInfo (m_SecModule, m_SecurityContext); - } - - internal ProtocolToken CreateShutdownMessage () - { - var buffer = SSPIWrapper.CreateShutdownMessage (m_SecModule, m_SecurityContext); - return new ProtocolToken (buffer, SecurityStatus.ContinueNeeded); - } - - internal ProtocolToken CreateHelloRequestMessage () - { - var buffer = SSPIWrapper.CreateHelloRequestMessage (m_SecModule, m_SecurityContext); - return new ProtocolToken (buffer, SecurityStatus.ContinueNeeded); - } - - internal bool IsClosed { - get { - if (m_SecModule == null || m_SecurityContext == null || m_SecurityContext.IsClosed) - return true; - return SSPIWrapper.IsClosed (m_SecModule, m_SecurityContext); - } - } - } -} -#endif diff --git a/mcs/class/System/ReferenceSources/_SslState.cs b/mcs/class/System/ReferenceSources/_SslState.cs deleted file mode 100644 index 8d5ae3f3109..00000000000 --- a/mcs/class/System/ReferenceSources/_SslState.cs +++ /dev/null @@ -1,141 +0,0 @@ -// -// Mono-specific additions to Microsoft's _SslState.cs -// -#if MONO_FEATURE_NEW_TLS && SECURITY_DEP -#if MONO_SECURITY_ALIAS -extern alias MonoSecurity; -using MonoSecurity::Mono.Security.Interface; -#else -using Mono.Security.Interface; -#endif -namespace System.Net.Security -{ - using System.IO; - using System.Threading; - using System.Net.Sockets; - - partial class SslState - { - int _SentShutdown; - - internal MonoTlsConnectionInfo GetMonoConnectionInfo () - { - return Context.GetMonoConnectionInfo (); - } - - internal bool IsClosed { - get { return Context.IsClosed; } - } - - internal ProtocolToken CreateShutdownMessage () - { - return Context.CreateShutdownMessage (); - } - - internal ProtocolToken CreateHelloRequestMessage () - { - return Context.CreateHelloRequestMessage (); - } - - internal IAsyncResult BeginShutdown (AsyncCallback asyncCallback, object asyncState) - { - var shutdownResult = new ShutdownAsyncResult (this, asyncState, asyncCallback); - - if (Interlocked.CompareExchange (ref _SentShutdown, 1, 0) == 1) { - shutdownResult.InvokeCallback (); - return shutdownResult; - } - - try - { - CheckThrow (false); - shutdownResult.SentShutdown = true; - SecureStream.BeginShutdown (shutdownResult); - return shutdownResult; - } catch (Exception e) { - if (e is IOException) - throw; - throw new IOException (SR.GetString (SR.mono_net_io_shutdown), e); - } - } - - internal void EndShutdown (IAsyncResult asyncResult) - { - if (asyncResult == null) - throw new ArgumentNullException ("asyncResult"); - - var shutdownResult = asyncResult as ShutdownAsyncResult; - if (shutdownResult == null) - throw new ArgumentException (SR.GetString (SR.net_io_async_result, asyncResult.GetType ().FullName), "asyncResult"); - - if (shutdownResult.SentShutdown) - SecureStream.EndShutdown (shutdownResult); - } - - internal IAsyncResult BeginRenegotiate (AsyncCallback asyncCallback, object asyncState) - { - var lazyResult = new LazyAsyncResult (this, asyncState, asyncCallback); - - if (Interlocked.Exchange (ref _NestedAuth, 1) == 1) - throw new InvalidOperationException (SR.GetString (SR.net_io_invalidnestedcall, "BeginRenegotiate", "renegotiate")); - if (Interlocked.CompareExchange (ref _PendingReHandshake, 1, 0) == 1) - throw new InvalidOperationException (SR.GetString (SR.net_io_invalidnestedcall, "BeginRenegotiate", "renegotiate")); - - try { - CheckThrow (false); - SecureStream.BeginRenegotiate (lazyResult); - return lazyResult; - } catch (Exception e) { - _NestedAuth = 0; - if (e is IOException) - throw; - throw new IOException (SR.GetString (SR.mono_net_io_renegotiate), e); - } - } - - internal void EndRenegotiate (IAsyncResult result) - { - if (result == null) - throw new ArgumentNullException ("asyncResult"); - - LazyAsyncResult lazyResult = result as LazyAsyncResult; - if (lazyResult == null) - throw new ArgumentException (SR.GetString (SR.net_io_async_result, result.GetType ().FullName), "asyncResult"); - - if (Interlocked.Exchange (ref _NestedAuth, 0) == 0) - throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndRenegotiate")); - - SecureStream.EndRenegotiate (lazyResult); - } - - internal bool CheckEnqueueHandshakeWrite (byte[] buffer, AsyncProtocolRequest asyncRequest) - { - return CheckEnqueueHandshake (buffer, asyncRequest); - } - - internal void StartReHandshake (AsyncProtocolRequest asyncRequest) - { - if (IsServer) { - byte[] buffer = null; - if (CheckEnqueueHandshakeRead (ref buffer, asyncRequest)) - return; - - StartReceiveBlob (buffer, asyncRequest); - return; - } - - ForceAuthentication (false, null, asyncRequest); - } - - class ShutdownAsyncResult : LazyAsyncResult - { - public bool SentShutdown; - - internal ShutdownAsyncResult (SslState instance, object userState, AsyncCallback callback) - : base (instance, userState, callback) - { - } - } - } -} -#endif diff --git a/mcs/class/System/ReferenceSources/_SslStream.cs b/mcs/class/System/ReferenceSources/_SslStream.cs deleted file mode 100644 index 591b74abf61..00000000000 --- a/mcs/class/System/ReferenceSources/_SslStream.cs +++ /dev/null @@ -1,230 +0,0 @@ -// -// Mono-specific additions to Microsoft's _SslStream.cs -// -#if MONO_FEATURE_NEW_TLS && SECURITY_DEP -namespace System.Net.Security -{ - using System.IO; - using System.Threading; - using System.Net.Sockets; - - partial class _SslStream - { - static readonly AsyncCallback _HandshakeWriteCallback = new AsyncCallback (HandshakeWriteCallback); - static readonly HandshakeProtocolCallback _ResumeHandshakeWriteCallback = new HandshakeProtocolCallback (ResumeHandshakeWriteCallback); - - internal void BeginShutdown (LazyAsyncResult lazyResult) - { - HandshakeProtocolRequest asyncRequest = new HandshakeProtocolRequest (lazyResult); - - if (Interlocked.Exchange (ref _NestedWrite, 1) == 1) - throw new NotSupportedException (SR.GetString (SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginShutdown" : "Shutdown"), "shutdown")); - - bool failed = false; - try - { - ProtocolToken message = _SslState.CreateShutdownMessage (); - asyncRequest.SetNextRequest (HandshakeProtocolState.Shutdown, message, _ResumeHandshakeWriteCallback); - - StartHandshakeWrite (asyncRequest); - } catch (Exception e) { - _SslState.FinishWrite (); - failed = true; - throw; - } finally { - if (failed) - _NestedWrite = 0; - } - } - - internal void EndShutdown (LazyAsyncResult lazyResult) - { - if (Interlocked.Exchange (ref _NestedWrite, 0) == 0) - throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndShutdown")); - - // No "artificial" timeouts implemented so far, InnerStream controls timeout. - lazyResult.InternalWaitForCompletion (); - - if (lazyResult.Result is Exception) { - if (lazyResult.Result is IOException) - throw (Exception)lazyResult.Result; - throw new IOException (SR.GetString (SR.mono_net_io_shutdown), (Exception)lazyResult.Result); - } - } - - internal void BeginRenegotiate (LazyAsyncResult lazyResult) - { - HandshakeProtocolRequest asyncRequest = new HandshakeProtocolRequest (lazyResult); - - if (Interlocked.Exchange (ref _NestedWrite, 1) == 1) - throw new NotSupportedException (SR.GetString (SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginRenegotiate" : "Renegotiate"), "renegotiate")); - - bool failed = false; - try - { - if (_SslState.IsServer) { - ProtocolToken message = _SslState.CreateHelloRequestMessage (); - asyncRequest.SetNextRequest (HandshakeProtocolState.SendHelloRequest, message, _ResumeHandshakeWriteCallback); - } else { - asyncRequest.SetNextRequest (HandshakeProtocolState.ClientRenegotiation, null, _ResumeHandshakeWriteCallback); - } - - StartHandshakeWrite (asyncRequest); - } catch (Exception e) { - _SslState.FinishWrite (); - failed = true; - throw; - } finally { - if (failed) - _NestedWrite = 0; - } - } - - internal void EndRenegotiate (LazyAsyncResult lazyResult) - { - if (Interlocked.Exchange (ref _NestedWrite, 0) == 0) - throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndRenegotiate")); - - // No "artificial" timeouts implemented so far, InnerStream controls timeout. - lazyResult.InternalWaitForCompletion(); - - if (lazyResult.Result is Exception) { - if (lazyResult.Result is IOException) - throw (Exception)lazyResult.Result; - throw new IOException (SR.GetString (SR.mono_net_io_renegotiate), (Exception)lazyResult.Result); - } - } - - void StartHandshakeWrite (HandshakeProtocolRequest asyncRequest) - { - byte[] buffer = null; - if (asyncRequest.Message != null) { - buffer = asyncRequest.Message.Payload; - if (buffer.Length != asyncRequest.Message.Size) { - buffer = new byte [asyncRequest.Message.Size]; - Buffer.BlockCopy (asyncRequest.Message.Payload, 0, buffer, 0, buffer.Length); - } - } - - switch (asyncRequest.State) { - case HandshakeProtocolState.ClientRenegotiation: - case HandshakeProtocolState.ServerRenegotiation: - _SslState.StartReHandshake (asyncRequest); - return; - - case HandshakeProtocolState.SendHelloRequest: - if (_SslState.CheckEnqueueHandshakeWrite (buffer, asyncRequest)) { - // operation is async and has been queued, return. - return; - } - break; - - case HandshakeProtocolState.Shutdown: - if (_SslState.CheckEnqueueWrite (asyncRequest)) { - // operation is async and has been queued, return. - return; - } - break; - - default: - throw new InvalidOperationException (); - } - - if (_SslState.LastPayload != null) - throw new InvalidOperationException (); - - // prepare for the next request - IAsyncResult ar = ((NetworkStream)_SslState.InnerStream).BeginWrite (buffer, 0, buffer.Length, _HandshakeWriteCallback, asyncRequest); - if (!ar.CompletedSynchronously) - return; - - HandshakeWriteCallback (asyncRequest, ar); - } - - static void HandshakeWriteCallback (IAsyncResult transportResult) - { - if (transportResult.CompletedSynchronously) - return; - - HandshakeProtocolRequest asyncRequest = (HandshakeProtocolRequest)transportResult.AsyncState; - - SslState sslState = (SslState)asyncRequest.AsyncObject; - sslState.SecureStream.HandshakeWriteCallback (asyncRequest, transportResult); - } - - void HandshakeWriteCallback (HandshakeProtocolRequest asyncRequest, IAsyncResult transportResult) - { - try { - _SslState.InnerStream.EndWrite (transportResult); - } catch (Exception e) { - _SslState.FinishWrite (); - if (!asyncRequest.IsUserCompleted) { - asyncRequest.CompleteWithError (e); - return; - } - throw; - } - - if (asyncRequest.State == HandshakeProtocolState.SendHelloRequest) { - asyncRequest.SetNextRequest (HandshakeProtocolState.ServerRenegotiation, null, _ResumeHandshakeWriteCallback); - StartHandshakeWrite (asyncRequest); - return; - } - - try { - _SslState.FinishWrite (); - asyncRequest.CompleteUser (); - } catch (Exception e) { - if (!asyncRequest.IsUserCompleted) { - asyncRequest.CompleteWithError (e); - return; - } - throw; - } - } - - static void ResumeHandshakeWriteCallback (HandshakeProtocolRequest asyncRequest) - { - try { - ((_SslStream)asyncRequest.AsyncObject).StartHandshakeWrite (asyncRequest); - } catch (Exception e) { - if (asyncRequest.IsUserCompleted) { - // This will throw on a worker thread. - throw; - } - ((_SslStream)asyncRequest.AsyncObject)._SslState.FinishWrite (); - asyncRequest.CompleteWithError (e); - } - } - - delegate void HandshakeProtocolCallback (HandshakeProtocolRequest asyncRequest); - - enum HandshakeProtocolState { - None, - Shutdown, - SendHelloRequest, - ServerRenegotiation, - ClientRenegotiation - } - - class HandshakeProtocolRequest : AsyncProtocolRequest - { - public ProtocolToken Message; - public HandshakeProtocolState State; - - public HandshakeProtocolRequest (LazyAsyncResult userAsyncResult) - : base (userAsyncResult) - { - State = HandshakeProtocolState.None; - } - - public void SetNextRequest (HandshakeProtocolState state, ProtocolToken message, HandshakeProtocolCallback callback) - { - State = state; - Message = message; - SetNextRequest (null, 0, 0, (r) => callback ((HandshakeProtocolRequest)r)); - } - } - } -} -#endif diff --git a/mcs/class/System/System-bare-net_4_x.csproj b/mcs/class/System/System-bare-net_4_x.csproj index e748039ef2b..eae64de07b8 100644 --- a/mcs/class/System/System-bare-net_4_x.csproj +++ b/mcs/class/System/System-bare-net_4_x.csproj @@ -777,9 +777,6 @@ - - - @@ -788,7 +785,6 @@ - @@ -797,10 +793,6 @@ - - - - diff --git a/mcs/class/System/System-net_4_x.csproj b/mcs/class/System/System-net_4_x.csproj index fbd51bbfd99..07dfdfa6fb3 100644 --- a/mcs/class/System/System-net_4_x.csproj +++ b/mcs/class/System/System-net_4_x.csproj @@ -777,9 +777,6 @@ - - - @@ -788,7 +785,6 @@ - @@ -797,10 +793,6 @@ - - - - diff --git a/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs deleted file mode 100644 index c608bfee433..00000000000 --- a/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// System.Diagnostics.ProcessModuleCollection.cs -// -// Authors: -// Dick Porter (dick@ximian.com) -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -// -// (C) 2002 Ximian, Inc. http://www.ximian.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.Collections; - -namespace System.Diagnostics -{ -#if MOBILE - public class ProcessModuleCollectionBase : System.Collections.Generic.List - { - protected ProcessModuleCollectionBase InnerList { - get { return this; } - } - - public System.Collections.IEnumerator GetEnumerator () - { - return ((System.Collections.IEnumerable)InnerList).GetEnumerator (); - } - } -#endif - - public class ProcessModuleCollection : -#if !MOBILE - ReadOnlyCollectionBase -#else - ProcessModuleCollectionBase -#endif - { - protected ProcessModuleCollection() - { - } - - public ProcessModuleCollection(ProcessModule[] processModules) - { - InnerList.AddRange (processModules); - } - - public ProcessModule this[int index] { - get { - return (ProcessModule)InnerList[index]; - } - } - - public bool Contains(ProcessModule module) - { - return InnerList.Contains (module); - } - - public void CopyTo(ProcessModule[] array, int index) - { - InnerList.CopyTo (array, index); - } - - public int IndexOf(ProcessModule module) - { - return InnerList.IndexOf (module); - } - } -} diff --git a/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs deleted file mode 100644 index 141b1821568..00000000000 --- a/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs +++ /dev/null @@ -1,113 +0,0 @@ -// -// System.Diagnostics.ProcessThreadCollection.cs -// -// Authors: -// Dick Porter (dick@ximian.com) -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -// -// (C) 2002 Ximian, Inc. http://www.ximian.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.Collections; - -namespace System.Diagnostics -{ -#if MOBILE - public class ProcessThreadCollectionBase : System.Collections.Generic.List - { - protected ProcessThreadCollectionBase InnerList { - get { return this; } - } - - public new int Add (ProcessThread thread) - { - base.Add (thread); - return Count - 1; - } - - public System.Collections.IEnumerator GetEnumerator () - { - return ((System.Collections.IEnumerable)InnerList).GetEnumerator (); - } - } -#endif - - public class ProcessThreadCollection : -#if !MOBILE - ReadOnlyCollectionBase -#else - ProcessThreadCollectionBase -#endif - { - protected ProcessThreadCollection() - { - } - - internal static ProcessThreadCollection GetEmpty () - { - return new ProcessThreadCollection (); - } - - public ProcessThreadCollection(ProcessThread[] processThreads) - { - InnerList.AddRange (processThreads); - } - - public ProcessThread this[int index] { - get { - return (ProcessThread)InnerList[index]; - } - } - - public int Add(ProcessThread thread) - { - return InnerList.Add (thread); - } - - public bool Contains(ProcessThread thread) - { - return InnerList.Contains (thread); - } - - public void CopyTo(ProcessThread[] array, int index) - { - InnerList.CopyTo (array, index); - } - - public int IndexOf(ProcessThread thread) - { - return InnerList.IndexOf (thread); - } - - public void Insert(int index, ProcessThread thread) - { - InnerList.Insert (index, thread); - } - - public void Remove(ProcessThread thread) - { - InnerList.Remove (thread); - } - } -} diff --git a/mcs/class/System/System.IO/FileSystemWatcher_mobile.cs b/mcs/class/System/System.IO/FileSystemWatcher_mobile.cs index 3b274e0599e..04bd35a142f 100644 --- a/mcs/class/System/System.IO/FileSystemWatcher_mobile.cs +++ b/mcs/class/System/System.IO/FileSystemWatcher_mobile.cs @@ -26,9 +26,11 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +using System.ComponentModel; + namespace System.IO { - public class FileSystemWatcher : IDisposable + public class FileSystemWatcher : Component, IDisposable, ISupportInitialize { public FileSystemWatcher () { throw new NotImplementedException (); } public FileSystemWatcher (string path) { throw new NotImplementedException (); } @@ -39,11 +41,15 @@ namespace System.IO public int InternalBufferSize { get { throw new NotImplementedException (); } set { } } public NotifyFilters NotifyFilter { get { throw new NotImplementedException (); } set { } } public string Path { get { throw new NotImplementedException (); } set { } } + public override ISite Site { get { throw new NotImplementedException (); } set { } } + public ISynchronizeInvoke SynchronizingObject { get { throw new NotImplementedException (); } set { } } public event FileSystemEventHandler Changed; public event FileSystemEventHandler Created; public event FileSystemEventHandler Deleted; public event ErrorEventHandler Error; public event RenamedEventHandler Renamed; + public void BeginInit() { throw new NotImplementedException (); } + public void EndInit() { throw new NotImplementedException (); } protected void OnChanged (FileSystemEventArgs e) { throw new NotImplementedException (); } protected void OnCreated (FileSystemEventArgs e) { throw new NotImplementedException (); } protected void OnDeleted (System.IO.FileSystemEventArgs e) { throw new NotImplementedException (); } @@ -51,13 +57,7 @@ namespace System.IO protected void OnRenamed (RenamedEventArgs e) { throw new NotImplementedException (); } public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType) { throw new NotImplementedException (); } public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType, int timeout) { throw new NotImplementedException (); } - - public virtual void Dispose () - { - } - - protected virtual void Dispose (bool disposing) - { - } + public virtual void Dispose () { throw new NotImplementedException (); } + protected override void Dispose (bool disposing) { throw new NotImplementedException (); } } } \ No newline at end of file diff --git a/mcs/class/System/System.Net.Mail/MailMessage.cs b/mcs/class/System/System.Net.Mail/MailMessage.cs index 40ee139b7a0..b5a58d86b81 100644 --- a/mcs/class/System/System.Net.Mail/MailMessage.cs +++ b/mcs/class/System/System.Net.Mail/MailMessage.cs @@ -153,6 +153,11 @@ namespace System.Net.Mail { set { bodyEncoding = value; } } + public TransferEncoding BodyTransferEncoding { + get { return GuessTransferEncoding (BodyEncoding); } + set { throw new NotImplementedException (); } + } + public MailAddressCollection CC { get { return cc; } } diff --git a/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs b/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs index 2b39ff8311c..e07ff90804e 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs @@ -39,8 +39,6 @@ namespace System.Net.NetworkInformation { { public static readonly Win32IPAddressCollection Empty = new Win32IPAddressCollection (IntPtr.Zero); - bool is_readonly; - // for static methods Win32IPAddressCollection () { @@ -50,7 +48,6 @@ namespace System.Net.NetworkInformation { { foreach (IntPtr head in heads) AddSubsequentlyString (head); - is_readonly = true; } public Win32IPAddressCollection (params Win32_IP_ADDR_STRING [] al) @@ -58,10 +55,9 @@ namespace System.Net.NetworkInformation { foreach (Win32_IP_ADDR_STRING a in al) { if (String.IsNullOrEmpty (a.IpAddress)) continue; - Add (IPAddress.Parse (a.IpAddress)); + InternalAdd (IPAddress.Parse (a.IpAddress)); AddSubsequentlyString (a.Next); } - is_readonly = true; } public static Win32IPAddressCollection FromAnycast (IntPtr ptr) @@ -70,9 +66,8 @@ namespace System.Net.NetworkInformation { Win32_IP_ADAPTER_ANYCAST_ADDRESS a; for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) { a = (Win32_IP_ADAPTER_ANYCAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_ANYCAST_ADDRESS)); - c.Add (a.Address.GetIPAddress ()); + c.InternalAdd (a.Address.GetIPAddress ()); } - c.is_readonly = true; return c; } @@ -84,9 +79,8 @@ namespace System.Net.NetworkInformation { a = (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS)); // FIXME: It somehow fails here. Looks like there is something wrong. //if (a.Address.Sockaddr == IntPtr.Zero) throw new Exception ("pointer " + p + " a.length " + a.Address.SockaddrLength); - c.Add (a.Address.GetIPAddress ()); + c.InternalAdd (a.Address.GetIPAddress ()); } - c.is_readonly = true; return c; } @@ -95,13 +89,9 @@ namespace System.Net.NetworkInformation { Win32_IP_ADDR_STRING a; for (IntPtr p = head; p != IntPtr.Zero; p = a.Next) { a = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p, typeof (Win32_IP_ADDR_STRING)); - Add (IPAddress.Parse (a.IpAddress)); + InternalAdd (IPAddress.Parse (a.IpAddress)); } } - - public override bool IsReadOnly { - get { return is_readonly; } - } } #endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs index ece698af2b4..d1bf2e763b0 100644 --- a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs +++ b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs @@ -438,9 +438,14 @@ namespace System.Net.NetworkInformation { #if !MOBILE class Win32NetworkInterfaceAPI : NetworkInterfaceFactory { - [DllImport ("iphlpapi.dll", SetLastError = true)] + private const string IPHLPAPI = "iphlpapi.dll"; + + [DllImport (IPHLPAPI, SetLastError = true)] static extern int GetAdaptersAddresses (uint family, uint flags, IntPtr reserved, byte [] info, ref int size); + [DllImport (IPHLPAPI)] + static extern uint GetBestInterfaceEx (byte[] ipAddress, out int index); + unsafe static Win32_IP_ADAPTER_ADDRESSES [] GetAdaptersAddresses () { byte [] bytes = null; @@ -473,9 +478,20 @@ namespace System.Net.NetworkInformation { return ret; } + private static int GetBestInterfaceForAddress (IPAddress addr) { + int index; + SocketAddress address = new SocketAddress (addr); + int error = (int) GetBestInterfaceEx (address.m_Buffer, out index); + if (error != 0) { + throw new NetworkInformationException (error); + } + + return index; + } + public override int GetLoopbackInterfaceIndex () { - throw new NotImplementedException (); + return GetBestInterfaceForAddress (IPAddress.Loopback); } public override IPAddress GetNetMask (IPAddress address) diff --git a/mcs/class/System/System.Net.NetworkInformation/Ping.cs b/mcs/class/System/System.Net.NetworkInformation/Ping.cs index 72645bcd3a7..8232a9eaac4 100644 --- a/mcs/class/System/System.Net.NetworkInformation/Ping.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Ping.cs @@ -262,12 +262,12 @@ namespace System.Net.NetworkInformation { bytes = new byte [100]; do { EndPoint endpoint = client; - int error = 0; - int rc = s.ReceiveFrom_nochecks_exc (bytes, 0, 100, SocketFlags.None, - ref endpoint, false, out error); + SocketError error = 0; + int rc = s.ReceiveFrom (bytes, 0, 100, SocketFlags.None, + ref endpoint, out error); - if (error != 0) { - if (error == (int) SocketError.TimedOut) { + if (error != SocketError.Success) { + if (error == SocketError.TimedOut) { return new PingReply (null, new byte [0], options, 0, IPStatus.TimedOut); } throw new NotSupportedException (String.Format ("Unexpected socket error during ping request: {0}", error)); diff --git a/mcs/class/System/System.Net.Security/NegotiateStream.cs b/mcs/class/System/System.Net.Security/NegotiateStream.cs index ad9e3526ff7..0ee2c7b8258 100644 --- a/mcs/class/System/System.Net.Security/NegotiateStream.cs +++ b/mcs/class/System/System.Net.Security/NegotiateStream.cs @@ -148,6 +148,12 @@ namespace System.Net.Security throw new NotImplementedException (); } + [MonoTODO] + public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, AsyncCallback asyncCallback, object asyncState) + { + throw new NotImplementedException (); + } + [MonoTODO] public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, string targetName, AsyncCallback asyncCallback, object asyncState) { @@ -160,6 +166,12 @@ namespace System.Net.Security throw new NotImplementedException (); } + [MonoTODO] + public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, object asyncState) + { + throw new NotImplementedException (); + } + [MonoTODO] public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { @@ -172,12 +184,24 @@ namespace System.Net.Security throw new NotImplementedException (); } + [MonoTODO] + public virtual IAsyncResult BeginAuthenticateAsServer (NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, object asyncState) + { + throw new NotImplementedException (); + } + [MonoTODO] public virtual IAsyncResult BeginAuthenticateAsServer (NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, object asyncState) { throw new NotImplementedException (); } + [MonoTODO] + public virtual IAsyncResult BeginAuthenticateAsServer (ExtendedProtectionPolicy policy, AsyncCallback asyncCallback, object asyncState) + { + throw new NotImplementedException (); + } + [MonoTODO] public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { @@ -196,6 +220,18 @@ namespace System.Net.Security throw new NotImplementedException (); } + [MonoTODO] + public virtual void AuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual void AuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel) + { + throw new NotImplementedException (); + } + [MonoTODO] public virtual void AuthenticateAsClient (NetworkCredential credential, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel) { @@ -208,6 +244,18 @@ namespace System.Net.Security throw new NotImplementedException (); } + [MonoTODO] + public virtual void AuthenticateAsServer (ExtendedProtectionPolicy policy) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual void AuthenticateAsServer (NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel) + { + throw new NotImplementedException (); + } + [MonoTODO] public virtual void AuthenticateAsServer (NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel) { diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs index 396b16f4c54..7ac0ba39f46 100644 --- a/mcs/class/System/System.Net.Sockets/Socket.cs +++ b/mcs/class/System/System.Net.Sockets/Socket.cs @@ -66,16 +66,16 @@ namespace System.Net.Sockets bool is_closed; bool is_listening; - bool use_overlapped_io; + bool useOverlappedIO; int linger_timeout; - AddressFamily address_family; - SocketType socket_type; - ProtocolType protocol_type; + AddressFamily addressFamily; + SocketType socketType; + ProtocolType protocolType; - /* the field "safe_handle" is looked up by name by the runtime */ - internal SafeSocketHandle safe_handle; + /* the field "m_Handle" is looked up by name by the runtime */ + internal SafeSocketHandle m_Handle; /* * This EndPoint is used when creating new endpoints. Because @@ -86,8 +86,8 @@ namespace System.Net.Sockets */ internal EndPoint seed_endpoint = null; - internal Queue> readQ = new Queue> (2); - internal Queue> writeQ = new Queue> (2); + internal SemaphoreSlim ReadSem = new SemaphoreSlim (1, 1); + internal SemaphoreSlim WriteSem = new SemaphoreSlim (1, 1); internal bool is_blocking = true; internal bool is_bound; @@ -95,9 +95,11 @@ namespace System.Net.Sockets /* When true, the socket was connected at the time of the last IO operation */ internal bool is_connected; - internal bool is_disposed; + int m_IntCleanedUp; internal bool connect_in_progress; + private static volatile bool s_LoggingEnabled = Logging.On; + #region Constructors static Socket () @@ -156,26 +158,14 @@ namespace System.Net.Sockets } } - // - // This constructor is used by servers that want to listen for instance on both - // ipv4 and ipv6. Mono has historically done that if you use InterNetworkV6 (at - // least on Unix), because that is the default behavior unless the IPV6_V6ONLY - // option is explicitly set by using setsockopt (sock, IPPROTO_IPV6, IPV6_ONLY) - // - public Socket (SocketType socketType, ProtocolType protocolType) - : this (AddressFamily.InterNetworkV6, socketType, protocolType) - { - DualMode = true; - } - public Socket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) { - this.address_family = addressFamily; - this.socket_type = socketType; - this.protocol_type = protocolType; + this.addressFamily = addressFamily; + this.socketType = socketType; + this.protocolType = protocolType; int error; - this.safe_handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true); + this.m_Handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true); if (error != 0) throw new SocketException (error); @@ -183,55 +173,49 @@ namespace System.Net.Sockets SocketDefaults (); } -#if !MOBILE public Socket (SocketInformation socketInformation) { this.is_listening = (socketInformation.Options & SocketInformationOptions.Listening) != 0; this.is_connected = (socketInformation.Options & SocketInformationOptions.Connected) != 0; this.is_blocking = (socketInformation.Options & SocketInformationOptions.NonBlocking) == 0; - this.use_overlapped_io = (socketInformation.Options & SocketInformationOptions.UseOnlyOverlappedIO) != 0; + this.useOverlappedIO = (socketInformation.Options & SocketInformationOptions.UseOnlyOverlappedIO) != 0; var result = Mono.DataConverter.Unpack ("iiiil", socketInformation.ProtocolInformation, 0); - this.address_family = (AddressFamily) (int) result [0]; - this.socket_type = (SocketType) (int) result [1]; - this.protocol_type = (ProtocolType) (int) result [2]; + this.addressFamily = (AddressFamily) (int) result [0]; + this.socketType = (SocketType) (int) result [1]; + this.protocolType = (ProtocolType) (int) result [2]; this.is_bound = (ProtocolType) (int) result [3] != 0; - this.safe_handle = new SafeSocketHandle ((IntPtr) (long) result [4], true); + this.m_Handle = new SafeSocketHandle ((IntPtr) (long) result [4], true); SocketDefaults (); } -#endif /* private constructor used by Accept, which already has a socket handle to use */ internal Socket(AddressFamily family, SocketType type, ProtocolType proto, SafeSocketHandle safe_handle) { - this.address_family = family; - this.socket_type = type; - this.protocol_type = proto; + this.addressFamily = family; + this.socketType = type; + this.protocolType = proto; - this.safe_handle = safe_handle; + this.m_Handle = safe_handle; this.is_connected = true; } - ~Socket () - { - Dispose (false); - } - void SocketDefaults () { try { /* Need to test IPv6 further */ - if (address_family == AddressFamily.InterNetwork - // || address_family == AddressFamily.InterNetworkV6 + if (addressFamily == AddressFamily.InterNetwork + // || addressFamily == AddressFamily.InterNetworkV6 ) { /* This is the default, but it probably has nasty side * effects on Linux, as the socket option is kludged by * turning on or off PMTU discovery... */ this.DontFragment = false; - this.NoDelay = false; - } else if (address_family == AddressFamily.InterNetworkV6) { + if (protocolType == ProtocolType.Tcp) + this.NoDelay = false; + } else if (addressFamily == AddressFamily.InterNetworkV6) { this.DualMode = true; } @@ -305,7 +289,7 @@ namespace System.Net.Sockets ThrowIfDisposedAndClosed (); int ret, error; - ret = Available_internal (safe_handle, out error); + ret = Available_internal (m_Handle, out error); if (error != 0) throw new SocketException (error); @@ -330,40 +314,12 @@ namespace System.Net.Sockets [MethodImplAttribute(MethodImplOptions.InternalCall)] extern static int Available_internal (IntPtr socket, out int error); - public bool DontFragment { - get { - ThrowIfDisposedAndClosed (); - - switch (address_family) { - case AddressFamily.InterNetwork: - return ((int) GetSocketOption (SocketOptionLevel.IP, SocketOptionName.DontFragment)) != 0; - case AddressFamily.InterNetworkV6: - return ((int) GetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.DontFragment)) != 0; - default: - throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets"); - } - } - set { - ThrowIfDisposedAndClosed (); - - switch (address_family) { - case AddressFamily.InterNetwork: - SetSocketOption (SocketOptionLevel.IP, SocketOptionName.DontFragment, value ? 1 : 0); - break; - case AddressFamily.InterNetworkV6: - SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.DontFragment, value ? 1 : 0); - break; - default: - throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets"); - } - } - } - + // FIXME: import from referencesource public bool EnableBroadcast { get { ThrowIfDisposedAndClosed (); - if (protocol_type != ProtocolType.Udp) + if (protocolType != ProtocolType.Udp) throw new SocketException ((int) SocketError.ProtocolOption); return ((int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast)) != 0; @@ -371,47 +327,20 @@ namespace System.Net.Sockets set { ThrowIfDisposedAndClosed (); - if (protocol_type != ProtocolType.Udp) + if (protocolType != ProtocolType.Udp) throw new SocketException ((int) SocketError.ProtocolOption); SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast, value ? 1 : 0); } } - public bool ExclusiveAddressUse { - get { - ThrowIfDisposedAndClosed (); - - return ((int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse)) != 0; - } - set { - ThrowIfDisposedAndClosed (); - - if (is_bound) - throw new InvalidOperationException ("Bind has already been called for this socket"); - - SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, value ? 1 : 0); - } - } - public bool IsBound { get { return is_bound; } } - public LingerOption LingerState { - get { - ThrowIfDisposedAndClosed (); - - return (LingerOption) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger); - } - set { - ThrowIfDisposedAndClosed (); - SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger, value); - } - } - + // FIXME: import from referencesource public bool MulticastLoopback { get { ThrowIfDisposedAndClosed (); @@ -421,10 +350,10 @@ namespace System.Net.Sockets * "Setting this property on a Transmission Control Protocol (TCP) * socket will have no effect." but the MS runtime throws the * exception...) */ - if (protocol_type == ProtocolType.Tcp) + if (protocolType == ProtocolType.Tcp) throw new SocketException ((int)SocketError.ProtocolOption); - switch (address_family) { + switch (addressFamily) { case AddressFamily.InterNetwork: return ((int) GetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastLoopback)) != 0; case AddressFamily.InterNetworkV6: @@ -441,10 +370,10 @@ namespace System.Net.Sockets * "Setting this property on a Transmission Control Protocol (TCP) * socket will have no effect." but the MS runtime throws the * exception...) */ - if (protocol_type == ProtocolType.Tcp) + if (protocolType == ProtocolType.Tcp) throw new SocketException ((int)SocketError.ProtocolOption); - switch (address_family) { + switch (addressFamily) { case AddressFamily.InterNetwork: SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastLoopback, value ? 1 : 0); break; @@ -457,37 +386,6 @@ namespace System.Net.Sockets } } - public bool DualMode { - get { - if (AddressFamily != AddressFamily.InterNetworkV6) - throw new NotSupportedException("This protocol version is not supported"); - - return ((int)GetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only) == 0); - } - set { - if (AddressFamily != AddressFamily.InterNetworkV6) - throw new NotSupportedException("This protocol version is not supported"); - - SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, value ? 0 : 1); - } - } - - private bool IsDualMode { - get { - return AddressFamily == AddressFamily.InterNetworkV6 && DualMode; - } - } - - [MonoTODO ("This doesn't do anything on Mono yet")] - public bool UseOnlyOverlappedIO { - get { return use_overlapped_io; } - set { use_overlapped_io = value; } - } - - public IntPtr Handle { - get { return safe_handle.DangerousGetHandle (); } - } - // Wish: support non-IP endpoints. public EndPoint LocalEndPoint { get { @@ -499,7 +397,7 @@ namespace System.Net.Sockets return null; int error; - SocketAddress sa = LocalEndPoint_internal (safe_handle, (int) address_family, out error); + SocketAddress sa = LocalEndPoint_internal (m_Handle, (int) addressFamily, out error); if (error != 0) throw new SocketException (error); @@ -524,61 +422,13 @@ namespace System.Net.Sockets [MethodImplAttribute(MethodImplOptions.InternalCall)] extern static SocketAddress LocalEndPoint_internal (IntPtr socket, int family, out int error); - public SocketType SocketType { - get { return socket_type; } - } - - public int SendTimeout { - get { - ThrowIfDisposedAndClosed (); - - return (int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendTimeout); - } - set { - ThrowIfDisposedAndClosed (); - - if (value < -1) - throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than -1"); - - /* According to the MSDN docs we should adjust values between 1 and - * 499 to 500, but the MS runtime doesn't do this. */ - if (value == -1) - value = 0; - - SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, value); - } - } - - public int ReceiveTimeout { - get { - ThrowIfDisposedAndClosed (); - - return (int) GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout); - } - set { - ThrowIfDisposedAndClosed (); - - if (value < -1) - throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than -1"); - - if (value == -1) - value = 0; - - SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, value); - } - } - - public AddressFamily AddressFamily { - get { return address_family; } - } - public bool Blocking { get { return is_blocking; } set { ThrowIfDisposedAndClosed (); int error; - Blocking_internal (safe_handle, value, out error); + Blocking_internal (m_Handle, value, out error); if (error != 0) throw new SocketException (error); @@ -607,10 +457,7 @@ namespace System.Net.Sockets internal set { is_connected = value; } } - public ProtocolType ProtocolType { - get { return protocol_type; } - } - + // FIXME: import from referencesource public bool NoDelay { get { ThrowIfDisposedAndClosed (); @@ -622,75 +469,10 @@ namespace System.Net.Sockets set { ThrowIfDisposedAndClosed (); ThrowIfUdp (); - SetSocketOption (SocketOptionLevel.Tcp, SocketOptionName.NoDelay, value ? 1 : 0); } } - public int ReceiveBufferSize { - get { - ThrowIfDisposedAndClosed (); - - return (int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer); - } - set { - ThrowIfDisposedAndClosed (); - - if (value < 0) - throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than zero"); - - SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, value); - } - } - - public int SendBufferSize { - get { - ThrowIfDisposedAndClosed (); - - return (int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendBuffer); - } - set { - ThrowIfDisposedAndClosed (); - - if (value < 0) - throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than zero"); - - SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendBuffer, value); - } - } - - public short Ttl { - get { - ThrowIfDisposedAndClosed (); - - switch (address_family) { - case AddressFamily.InterNetwork: - return (short) (int) GetSocketOption (SocketOptionLevel.IP, SocketOptionName.IpTimeToLive); - case AddressFamily.InterNetworkV6: - return (short) (int) GetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.HopLimit); - default: - throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets"); - } - } - set { - ThrowIfDisposedAndClosed (); - - if (value < 0 || value > 255) - throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than zero or greater than 255."); - - switch (address_family) { - case AddressFamily.InterNetwork: - SetSocketOption (SocketOptionLevel.IP, SocketOptionName.IpTimeToLive, value); - break; - case AddressFamily.InterNetworkV6: - SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.HopLimit, value); - break; - default: - throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets"); - } - } - } - public EndPoint RemoteEndPoint { get { ThrowIfDisposedAndClosed (); @@ -701,7 +483,7 @@ namespace System.Net.Sockets return null; int error; - SocketAddress sa = RemoteEndPoint_internal (safe_handle, (int) address_family, out error); + SocketAddress sa = RemoteEndPoint_internal (m_Handle, (int) addressFamily, out error); if (error != 0) throw new SocketException (error); @@ -822,7 +604,7 @@ namespace System.Net.Sockets throw new NotSupportedException ("'mode' parameter is not valid."); int error; - bool result = Poll_internal (safe_handle, mode, microSeconds, out error); + bool result = Poll_internal (m_Handle, mode, microSeconds, out error); if (error != 0) throw new SocketException (error); @@ -861,7 +643,7 @@ namespace System.Net.Sockets ThrowIfDisposedAndClosed (); int error = 0; - SafeSocketHandle safe_handle = Accept_internal (this.safe_handle, out error, is_blocking); + SafeSocketHandle safe_handle = Accept_internal (this.m_Handle, out error, is_blocking); if (error != 0) { if (is_closed) @@ -882,7 +664,7 @@ namespace System.Net.Sockets ThrowIfDisposedAndClosed (); int error = 0; - SafeSocketHandle safe_handle = Accept_internal (this.safe_handle, out error, is_blocking); + SafeSocketHandle safe_handle = Accept_internal (this.m_Handle, out error, is_blocking); if (error != 0) { if (is_closed) @@ -890,10 +672,10 @@ namespace System.Net.Sockets throw new SocketException (error); } - acceptSocket.address_family = this.AddressFamily; - acceptSocket.socket_type = this.SocketType; - acceptSocket.protocol_type = this.ProtocolType; - acceptSocket.safe_handle = safe_handle; + acceptSocket.addressFamily = this.AddressFamily; + acceptSocket.socketType = this.SocketType; + acceptSocket.protocolType = this.ProtocolType; + acceptSocket.m_Handle = safe_handle; acceptSocket.is_connected = true; acceptSocket.seed_endpoint = this.seed_endpoint; acceptSocket.Blocking = this.Blocking; @@ -924,7 +706,7 @@ namespace System.Net.Sockets InitSocketAsyncEventArgs (e, AcceptAsyncCallback, e, SocketOperation.Accept); - QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, e.socket_async_result)); + QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, e.socket_async_result)); return true; } @@ -957,7 +739,7 @@ namespace System.Net.Sockets SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Accept); - QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, sockares)); + QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, sockares)); return sockares; } @@ -980,25 +762,6 @@ namespace System.Net.Sockets sockares.Complete (acc_socket); }); - public IAsyncResult BeginAccept (int receiveSize, AsyncCallback callback, object state) - { - ThrowIfDisposedAndClosed (); - - if (receiveSize < 0) - throw new ArgumentOutOfRangeException ("receiveSize", "receiveSize is less than zero"); - - SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.AcceptReceive) { - Buffer = new byte [receiveSize], - Offset = 0, - Size = receiveSize, - SockFlags = SocketFlags.None, - }; - - QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptReceiveCallback, sockares)); - - return sockares; - } - public IAsyncResult BeginAccept (Socket acceptSocket, int receiveSize, AsyncCallback callback, object state) { ThrowIfDisposedAndClosed (); @@ -1029,7 +792,7 @@ namespace System.Net.Sockets AcceptSocket = acceptSocket, }; - QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptReceiveCallback, sockares)); + QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptReceiveCallback, sockares)); return sockares; } @@ -1055,7 +818,7 @@ namespace System.Net.Sockets if (sockares.Size > 0) { try { SocketError error; - total = acc_socket.Receive_nochecks (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out error); + total = acc_socket.Receive (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out error); if (error != 0) { sockares.Complete (new SocketException ((int) error)); return; @@ -1076,12 +839,6 @@ namespace System.Net.Sockets return EndAccept (out buffer, out bytes, result); } - public Socket EndAccept (out byte[] buffer, IAsyncResult asyncResult) - { - int bytes; - return EndAccept (out buffer, out bytes, asyncResult); - } - public Socket EndAccept (out byte[] buffer, out int bytesTransferred, IAsyncResult asyncResult) { ThrowIfDisposedAndClosed (); @@ -1131,7 +888,7 @@ namespace System.Net.Sockets } int error; - Bind_internal (safe_handle, localEP.Serialize(), out error); + Bind_internal (m_Handle, localEP.Serialize(), out error); if (error != 0) throw new SocketException (error); @@ -1169,7 +926,7 @@ namespace System.Net.Sockets throw new SocketException ((int) SocketError.InvalidArgument); int error; - Listen_internal(safe_handle, backlog, out error); + Listen_internal(m_Handle, backlog, out error); if (error != 0) throw new SocketException (error); @@ -1224,7 +981,7 @@ namespace System.Net.Sockets iep = RemapIPEndPoint (iep); - Connect_internal (safe_handle, iep.Serialize (), out error); + Connect_internal (m_Handle, iep.Serialize (), out error); if (error == 0) { is_connected = true; is_bound = true; @@ -1260,7 +1017,7 @@ namespace System.Net.Sockets IPEndPoint ep = remoteEP as IPEndPoint; /* Dgram uses Any to 'disconnect' */ - if (ep != null && socket_type != SocketType.Dgram) { + if (ep != null && socketType != SocketType.Dgram) { if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)) throw new SocketException ((int) SocketError.AddressNotAvailable); } @@ -1275,7 +1032,7 @@ namespace System.Net.Sockets SocketAddress serial = remoteEP.Serialize (); int error = 0; - Connect_internal (safe_handle, serial, out error); + Connect_internal (m_Handle, serial, out error); if (error == 0 || error == 10035) seed_endpoint = remoteEP; // Keep the ep around for non-blocking sockets @@ -1286,7 +1043,7 @@ namespace System.Net.Sockets throw new SocketException (error); } - is_connected = !(socket_type == SocketType.Dgram && ep != null && (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any))); + is_connected = !(socketType == SocketType.Dgram && ep != null && (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any))); is_bound = true; } @@ -1361,29 +1118,13 @@ namespace System.Net.Sockets } }); - public IAsyncResult BeginConnect (IPAddress address, int port, AsyncCallback callback, object state) - { - ThrowIfDisposedAndClosed (); - - if (address == null) - throw new ArgumentNullException ("address"); - if (address.ToString ().Length == 0) - throw new ArgumentException ("The length of the IP address is zero"); - if (port <= 0 || port > 65535) - throw new ArgumentOutOfRangeException ("port", "Must be > 0 and < 65536"); - if (is_listening) - throw new InvalidOperationException (); - - return BeginConnect (new IPEndPoint (address, port), callback, state); - } - public IAsyncResult BeginConnect (string host, int port, AsyncCallback callback, object state) { ThrowIfDisposedAndClosed (); if (host == null) throw new ArgumentNullException ("host"); - if (address_family != AddressFamily.InterNetwork && address_family != AddressFamily.InterNetworkV6) + if (addressFamily != AddressFamily.InterNetwork && addressFamily != AddressFamily.InterNetworkV6) throw new NotSupportedException ("This method is valid only for sockets in the InterNetwork and InterNetworkV6 families"); if (port <= 0 || port > 65535) throw new ArgumentOutOfRangeException ("port", "Must be > 0 and < 65536"); @@ -1399,6 +1140,8 @@ namespace System.Net.Sockets if (end_point == null) throw new ArgumentNullException ("end_point"); + if (is_listening) + throw new InvalidOperationException (); SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Connect) { EndPoint = end_point, @@ -1422,8 +1165,8 @@ namespace System.Net.Sockets // Calling connect() again will reset the connection attempt and cause // an error. Better to just close the socket and move on. connect_in_progress = false; - safe_handle.Dispose (); - safe_handle = new SafeSocketHandle (Socket_internal (address_family, socket_type, protocol_type, out error), true); + m_Handle.Dispose (); + m_Handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true); if (error != 0) throw new SocketException (error); } @@ -1431,7 +1174,7 @@ namespace System.Net.Sockets bool blk = is_blocking; if (blk) Blocking = false; - Connect_internal (safe_handle, end_point.Serialize (), out error); + Connect_internal (m_Handle, end_point.Serialize (), out error); if (blk) Blocking = true; @@ -1626,7 +1369,7 @@ namespace System.Net.Sockets ThrowIfDisposedAndClosed (); int error = 0; - Disconnect_internal (safe_handle, reuseSocket, out error); + Disconnect_internal (m_Handle, reuseSocket, out error); if (error != 0) { if (error == 50) { @@ -1730,97 +1473,26 @@ namespace System.Net.Sockets #region Receive - public int Receive (byte [] buffer) - { - return Receive (buffer, SocketFlags.None); - } - - public int Receive (byte [] buffer, SocketFlags socketFlags) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, 0, buffer.Length); - - SocketError error; - int ret = Receive_nochecks (buffer, 0, buffer.Length, socketFlags, out error); - - if (error != SocketError.Success) { - if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set - throw new SocketException ((int) error, TIMEOUT_EXCEPTION_MSG); - throw new SocketException ((int) error); - } - - return ret; - } - - public int Receive (byte [] buffer, int size, SocketFlags socketFlags) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, 0, size); - - SocketError error; - int ret = Receive_nochecks (buffer, 0, size, socketFlags, out error); - - if (error != SocketError.Success) { - if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set - throw new SocketException ((int) error, TIMEOUT_EXCEPTION_MSG); - throw new SocketException ((int) error); - } - - return ret; - } - - public int Receive (byte [] buffer, int offset, int size, SocketFlags socketFlags) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, offset, size); - - SocketError error; - int ret = Receive_nochecks (buffer, offset, size, socketFlags, out error); - - if (error != SocketError.Success) { - if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set - throw new SocketException ((int) error, TIMEOUT_EXCEPTION_MSG); - throw new SocketException ((int) error); - } - - return ret; - } - public int Receive (byte [] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode) { ThrowIfDisposedAndClosed (); ThrowIfBufferNull (buffer); ThrowIfBufferOutOfRange (buffer, offset, size); - return Receive_nochecks (buffer, offset, size, socketFlags, out errorCode); - } - - public int Receive (IList> buffers) - { - SocketError error; - int ret = Receive (buffers, SocketFlags.None, out error); + int nativeError; + int ret = Receive_internal (m_Handle, buffer, offset, size, socketFlags, out nativeError); - if (error != SocketError.Success) - throw new SocketException ((int) error); + errorCode = (SocketError) nativeError; + if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) { + is_connected = false; + is_bound = false; + } else { + is_connected = true; + } return ret; } - [CLSCompliant (false)] - public int Receive (IList> buffers, SocketFlags socketFlags) - { - SocketError error; - int ret = Receive (buffers, socketFlags, out error); - - if (error != SocketError.Success) - throw new SocketException ((int) error); - - return(ret); - } - [CLSCompliant (false)] public int Receive (IList> buffers, SocketFlags socketFlags, out SocketError errorCode) { @@ -1851,7 +1523,7 @@ namespace System.Net.Sockets } try { - ret = Receive_internal (safe_handle, bufarray, socketFlags, out nativeError); + ret = Receive_internal (m_Handle, bufarray, socketFlags, out nativeError); } finally { for (int i = 0; i < numsegments; i++) { if (gch[i].IsAllocated) @@ -1881,7 +1553,7 @@ namespace System.Net.Sockets e.socket_async_result.Buffers = e.BufferList; - QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, e.socket_async_result)); + QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, e.socket_async_result)); } else { InitSocketAsyncEventArgs (e, ReceiveAsyncCallback, e, SocketOperation.Receive); @@ -1889,7 +1561,7 @@ namespace System.Net.Sockets e.socket_async_result.Offset = e.Offset; e.socket_async_result.Size = e.Count; - QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, e.socket_async_result)); + QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, e.socket_async_result)); } return true; @@ -1912,39 +1584,35 @@ namespace System.Net.Sockets } }); - public IAsyncResult BeginReceive (byte[] buffer, int offset, int size, SocketFlags socket_flags, AsyncCallback callback, object state) + public IAsyncResult BeginReceive (byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { ThrowIfDisposedAndClosed (); ThrowIfBufferNull (buffer); ThrowIfBufferOutOfRange (buffer, offset, size); + /* As far as I can tell from the docs and from experimentation, a pointer to the + * SocketError parameter is not supposed to be saved for the async parts. And as we don't + * set any socket errors in the setup code, we just have to set it to Success. */ + errorCode = SocketError.Success; + SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Receive) { Buffer = buffer, Offset = offset, Size = size, - SockFlags = socket_flags, + SockFlags = socketFlags, }; - QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, sockares)); + QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, sockares)); return sockares; } - public IAsyncResult BeginReceive (byte[] buffer, int offset, int size, SocketFlags flags, out SocketError error, AsyncCallback callback, object state) - { - /* As far as I can tell from the docs and from experimentation, a pointer to the - * SocketError parameter is not supposed to be saved for the async parts. And as we don't - * set any socket errors in the setup code, we just have to set it to Success. */ - error = SocketError.Success; - return BeginReceive (buffer, offset, size, flags, callback, state); - } - static IOAsyncCallback BeginReceiveCallback = new IOAsyncCallback (ares => { SocketAsyncResult sockares = (SocketAsyncResult) ares; int total = 0; try { - total = Receive_internal (sockares.socket.safe_handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error); + total = Receive_internal (sockares.socket.m_Handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error); } catch (Exception e) { sockares.Complete (e); return; @@ -1954,31 +1622,26 @@ namespace System.Net.Sockets }); [CLSCompliant (false)] - public IAsyncResult BeginReceive (IList> buffers, SocketFlags socketFlags, AsyncCallback callback, object state) + public IAsyncResult BeginReceive (IList> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { ThrowIfDisposedAndClosed (); if (buffers == null) throw new ArgumentNullException ("buffers"); + /* I assume the same SocketError semantics as above */ + errorCode = SocketError.Success; + SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.ReceiveGeneric) { Buffers = buffers, SockFlags = socketFlags, }; - QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, sockares)); + QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, sockares)); return sockares; } - [CLSCompliant (false)] - public IAsyncResult BeginReceive (IList> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) - { - /* I assume the same SocketError semantics as above */ - errorCode = SocketError.Success; - return BeginReceive (buffers, socketFlags, callback, state); - } - static IOAsyncCallback BeginReceiveGenericCallback = new IOAsyncCallback (ares => { SocketAsyncResult sockares = (SocketAsyncResult) ares; int total = 0; @@ -1993,53 +1656,28 @@ namespace System.Net.Sockets sockares.Complete (total); }); - public int EndReceive (IAsyncResult result) + public int EndReceive (IAsyncResult asyncResult, out SocketError errorCode) { - SocketError error; - int bytesReceived = EndReceive (result, out error); + ThrowIfDisposedAndClosed (); - if (error != SocketError.Success) { - if (error != SocketError.WouldBlock && error != SocketError.InProgress) - is_connected = false; - throw new SocketException ((int)error); - } - - return bytesReceived; - } - - public int EndReceive (IAsyncResult asyncResult, out SocketError errorCode) - { - ThrowIfDisposedAndClosed (); - - SocketAsyncResult sockares = ValidateEndIAsyncResult (asyncResult, "EndReceive", "asyncResult"); + SocketAsyncResult sockares = ValidateEndIAsyncResult (asyncResult, "EndReceive", "asyncResult"); if (!sockares.IsCompleted) sockares.AsyncWaitHandle.WaitOne (); + errorCode = sockares.ErrorCode; + + if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) + is_connected = false; + // If no socket error occurred, call CheckIfThrowDelayedException in case there are other // kinds of exceptions that should be thrown. - if ((errorCode = sockares.ErrorCode) == SocketError.Success) + if (errorCode == SocketError.Success) sockares.CheckIfThrowDelayedException(); return sockares.Total; } - int Receive_nochecks (byte [] buf, int offset, int size, SocketFlags flags, out SocketError error) - { - int nativeError; - int ret = Receive_internal (safe_handle, buf, offset, size, flags, out nativeError); - - error = (SocketError) nativeError; - if (error != SocketError.Success && error != SocketError.WouldBlock && error != SocketError.InProgress) { - is_connected = false; - is_bound = false; - } else { - is_connected = true; - } - - return ret; - } - static int Receive_internal (SafeSocketHandle safeHandle, WSABUF[] bufarray, SocketFlags flags, out int error) { try { @@ -2070,42 +1708,55 @@ namespace System.Net.Sockets #region ReceiveFrom - public int ReceiveFrom (byte [] buffer, ref EndPoint remoteEP) + public int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags socketFlags, ref EndPoint remoteEP) { ThrowIfDisposedAndClosed (); ThrowIfBufferNull (buffer); + ThrowIfBufferOutOfRange (buffer, offset, size); - return ReceiveFrom (buffer, 0, buffer.Length, SocketFlags.None, ref remoteEP); - } + if (remoteEP == null) + throw new ArgumentNullException ("remoteEP"); - public int ReceiveFrom (byte [] buffer, SocketFlags socketFlags, ref EndPoint remoteEP) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); + SocketError errorCode; + int ret = ReceiveFrom (buffer, offset, size, socketFlags, ref remoteEP, out errorCode); + + if (errorCode != SocketError.Success) + throw new SocketException (errorCode); - return ReceiveFrom (buffer, 0, buffer.Length, socketFlags, ref remoteEP); + return ret; } - public int ReceiveFrom (byte [] buffer, int size, SocketFlags socketFlags, ref EndPoint remoteEP) + internal int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags socketFlags, ref EndPoint remoteEP, out SocketError errorCode) { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, 0, size); + SocketAddress sockaddr = remoteEP.Serialize(); - return ReceiveFrom (buffer, 0, size, socketFlags, ref remoteEP); - } + int nativeError; + int cnt = ReceiveFrom_internal (m_Handle, buffer, offset, size, socketFlags, ref sockaddr, out nativeError); - public int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags socketFlags, ref EndPoint remoteEP) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, offset, size); + errorCode = (SocketError) nativeError; + if (errorCode != SocketError.Success) { + if (errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) { + is_connected = false; + } else if (errorCode == SocketError.WouldBlock && is_blocking) { // This might happen when ReceiveTimeout is set + errorCode = SocketError.TimedOut; + } - if (remoteEP == null) - throw new ArgumentNullException ("remoteEP"); + return 0; + } - int error; - return ReceiveFrom_nochecks_exc (buffer, offset, size, socketFlags, ref remoteEP, true, out error); + is_connected = true; + is_bound = true; + + /* If sockaddr is null then we're a connection oriented protocol and should ignore the + * remoteEP parameter (see MSDN documentation for Socket.ReceiveFrom(...) ) */ + if (sockaddr != null) { + /* Stupidly, EndPoint.Create() is an instance method */ + remoteEP = remoteEP.Create (sockaddr); + } + + seed_endpoint = remoteEP; + + return cnt; } public bool ReceiveFromAsync (SocketAsyncEventArgs e) @@ -2126,7 +1777,7 @@ namespace System.Net.Sockets e.socket_async_result.EndPoint = e.RemoteEndPoint; e.socket_async_result.SockFlags = e.SocketFlags; - QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, e.socket_async_result)); + QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, e.socket_async_result)); return true; } @@ -2165,7 +1816,7 @@ namespace System.Net.Sockets EndPoint = remote_end, }; - QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, sockares)); + QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, sockares)); return sockares; } @@ -2175,8 +1826,13 @@ namespace System.Net.Sockets int total = 0; try { - int error; - total = sockares.socket.ReceiveFrom_nochecks_exc (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, ref sockares.EndPoint, true, out error); + SocketError errorCode; + total = sockares.socket.ReceiveFrom (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, ref sockares.EndPoint, out errorCode); + + if (errorCode != SocketError.Success) { + sockares.Complete (new SocketException (errorCode)); + return; + } } catch (Exception e) { sockares.Complete (e); return; @@ -2204,43 +1860,7 @@ namespace System.Net.Sockets return sockares.Total; } - internal int ReceiveFrom_nochecks_exc (byte [] buf, int offset, int size, SocketFlags flags, ref EndPoint remote_end, bool throwOnError, out int error) - { - SocketAddress sockaddr = remote_end.Serialize(); - - int cnt = ReceiveFrom_internal (safe_handle, buf, offset, size, flags, ref sockaddr, out error); - SocketError err = (SocketError) error; - if (err != 0) { - if (err != SocketError.WouldBlock && err != SocketError.InProgress) { - is_connected = false; - } else if (err == SocketError.WouldBlock && is_blocking) { // This might happen when ReceiveTimeout is set - if (throwOnError) - throw new SocketException ((int) SocketError.TimedOut, TIMEOUT_EXCEPTION_MSG); - error = (int) SocketError.TimedOut; - return 0; - } - - if (throwOnError) - throw new SocketException (error); - - return 0; - } - - is_connected = true; - is_bound = true; - - /* If sockaddr is null then we're a connection oriented protocol and should ignore the - * remote_end parameter (see MSDN documentation for Socket.ReceiveFrom(...) ) */ - if (sockaddr != null) { - /* Stupidly, EndPoint.Create() is an instance method */ - remote_end = remote_end.Create (sockaddr); - } - - seed_endpoint = remote_end; - - return cnt; - } static int ReceiveFrom_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, ref SocketAddress sockaddr, out int error) { @@ -2313,97 +1933,33 @@ namespace System.Net.Sockets #region Send - public int Send (byte [] buffer) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, 0, buffer.Length); - - SocketError error; - int ret = Send_nochecks (buffer, 0, buffer.Length, SocketFlags.None, out error); - - if (error != SocketError.Success) - throw new SocketException ((int) error); - - return ret; - } - - public int Send (byte [] buffer, SocketFlags socketFlags) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, 0, buffer.Length); - - SocketError error; - int ret = Send_nochecks (buffer, 0, buffer.Length, socketFlags, out error); - - if (error != SocketError.Success) - throw new SocketException ((int) error); - - return ret; - } - - public int Send (byte [] buffer, int size, SocketFlags socketFlags) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, 0, size); - - SocketError error; - int ret = Send_nochecks (buffer, 0, size, socketFlags, out error); - - if (error != SocketError.Success) - throw new SocketException ((int) error); - - return ret; - } - - public int Send (byte [] buffer, int offset, int size, SocketFlags socketFlags) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, offset, size); - - SocketError error; - int ret = Send_nochecks (buffer, offset, size, socketFlags, out error); - - if (error != SocketError.Success) - throw new SocketException ((int) error); - - return ret; - } - public int Send (byte [] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode) { ThrowIfDisposedAndClosed (); ThrowIfBufferNull (buffer); ThrowIfBufferOutOfRange (buffer, offset, size); - return Send_nochecks (buffer, offset, size, socketFlags, out errorCode); - } - - public - int Send (IList> buffers) - { - SocketError error; - int ret = Send (buffers, SocketFlags.None, out error); - - if (error != SocketError.Success) - throw new SocketException ((int) error); - - return ret; - } - - public - int Send (IList> buffers, SocketFlags socketFlags) - { - SocketError error; - int ret = Send (buffers, socketFlags, out error); + if (size == 0) { + errorCode = SocketError.Success; + return 0; + } - if (error != SocketError.Success) - throw new SocketException ((int) error); + int nativeError; + int sent = 0; + do { + sent += Send_internal ( +m_Handle, buffer, offset + sent, size - sent, socketFlags, out nativeError); + errorCode = (SocketError)nativeError; + if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) { + is_connected = false; + is_bound = false; + break; + } else { + is_connected = true; + } + } while (sent < size); - return ret; + return sent; } [CLSCompliant (false)] @@ -2435,7 +1991,7 @@ namespace System.Net.Sockets } try { - ret = Send_internal (safe_handle, bufarray, socketFlags, out nativeError); + ret = Send_internal (m_Handle, bufarray, socketFlags, out nativeError); } finally { for(int i = 0; i < numsegments; i++) { if (gch[i].IsAllocated) { @@ -2449,28 +2005,6 @@ namespace System.Net.Sockets return ret; } - int Send_nochecks (byte [] buf, int offset, int size, SocketFlags flags, out SocketError error) - { - if (size == 0) { - error = SocketError.Success; - return 0; - } - - int nativeError; - int ret = Send_internal (safe_handle, buf, offset, size, flags, out nativeError); - - error = (SocketError)nativeError; - - if (error != SocketError.Success && error != SocketError.WouldBlock && error != SocketError.InProgress) { - is_connected = false; - is_bound = false; - } else { - is_connected = true; - } - - return ret; - } - public bool SendAsync (SocketAsyncEventArgs e) { // NO check is made whether e != null in MS.NET (NRE is thrown in such case) @@ -2485,7 +2019,7 @@ namespace System.Net.Sockets e.socket_async_result.Buffers = e.BufferList; - QueueIOSelectorJob (writeQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, e.socket_async_result)); + QueueIOSelectorJob (WriteSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, e.socket_async_result)); } else { InitSocketAsyncEventArgs (e, SendAsyncCallback, e, SocketOperation.Send); @@ -2493,7 +2027,7 @@ namespace System.Net.Sockets e.socket_async_result.Offset = e.Offset; e.socket_async_result.Size = e.Count; - QueueIOSelectorJob (writeQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), e.socket_async_result)); + QueueIOSelectorJob (WriteSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), e.socket_async_result)); } return true; @@ -2518,32 +2052,25 @@ namespace System.Net.Sockets public IAsyncResult BeginSend (byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { + ThrowIfDisposedAndClosed (); + ThrowIfBufferNull (buffer); + ThrowIfBufferOutOfRange (buffer, offset, size); + if (!is_connected) { errorCode = SocketError.NotConnected; - throw new SocketException ((int) errorCode); + return null; } errorCode = SocketError.Success; - return BeginSend (buffer, offset, size, socketFlags, callback, state); - } - - public IAsyncResult BeginSend (byte[] buffer, int offset, int size, SocketFlags socket_flags, AsyncCallback callback, object state) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - ThrowIfBufferOutOfRange (buffer, offset, size); - - if (!is_connected) - throw new SocketException ((int)SocketError.NotConnected); SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Send) { Buffer = buffer, Offset = offset, Size = size, - SockFlags = socket_flags, + SockFlags = socketFlags, }; - QueueIOSelectorJob (writeQ, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), sockares)); + QueueIOSelectorJob (WriteSem, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), sockares)); return sockares; } @@ -2553,7 +2080,7 @@ namespace System.Net.Sockets int total = 0; try { - total = Socket.Send_internal (sockares.socket.safe_handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error); + total = Socket.Send_internal (sockares.socket.m_Handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error); } catch (Exception e) { sockares.Complete (e); return; @@ -2564,7 +2091,7 @@ namespace System.Net.Sockets sockares.Offset += total; sockares.Size -= total; - if (sockares.socket.is_disposed) { + if (sockares.socket.CleanedUp) { sockares.Complete (total); return; } @@ -2580,37 +2107,31 @@ namespace System.Net.Sockets sockares.Complete (total); } - public IAsyncResult BeginSend (IList> buffers, SocketFlags socketFlags, AsyncCallback callback, object state) + [CLSCompliant (false)] + public IAsyncResult BeginSend (IList> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { ThrowIfDisposedAndClosed (); if (buffers == null) throw new ArgumentNullException ("buffers"); - if (!is_connected) - throw new SocketException ((int)SocketError.NotConnected); + + if (!is_connected) { + errorCode = SocketError.NotConnected; + return null; + } + + errorCode = SocketError.Success; SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.SendGeneric) { Buffers = buffers, SockFlags = socketFlags, }; - QueueIOSelectorJob (writeQ, sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, sockares)); + QueueIOSelectorJob (WriteSem, sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, sockares)); return sockares; } - [CLSCompliant (false)] - public IAsyncResult BeginSend (IList> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) - { - if (!is_connected) { - errorCode = SocketError.NotConnected; - throw new SocketException ((int)errorCode); - } - - errorCode = SocketError.Success; - return BeginSend (buffers, socketFlags, callback, state); - } - static IOAsyncCallback BeginSendGenericCallback = new IOAsyncCallback (ares => { SocketAsyncResult sockares = (SocketAsyncResult) ares; int total = 0; @@ -2625,20 +2146,6 @@ namespace System.Net.Sockets sockares.Complete (total); }); - public int EndSend (IAsyncResult result) - { - SocketError error; - int bytesSent = EndSend (result, out error); - - if (error != SocketError.Success) { - if (error != SocketError.WouldBlock && error != SocketError.InProgress) - is_connected = false; - throw new SocketException ((int)error); - } - - return bytesSent; - } - public int EndSend (IAsyncResult asyncResult, out SocketError errorCode) { ThrowIfDisposedAndClosed (); @@ -2648,9 +2155,14 @@ namespace System.Net.Sockets if (!sockares.IsCompleted) sockares.AsyncWaitHandle.WaitOne (); + errorCode = sockares.ErrorCode; + + if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) + is_connected = false; + /* If no socket error occurred, call CheckIfThrowDelayedException in * case there are other kinds of exceptions that should be thrown.*/ - if ((errorCode = sockares.ErrorCode) == SocketError.Success) + if (errorCode == SocketError.Success) sockares.CheckIfThrowDelayedException (); return sockares.Total; @@ -2688,27 +2200,6 @@ namespace System.Net.Sockets #region SendTo - public int SendTo (byte [] buffer, EndPoint remoteEP) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - - return SendTo (buffer, 0, buffer.Length, SocketFlags.None, remoteEP); - } - - public int SendTo (byte [] buffer, SocketFlags socketFlags, EndPoint remoteEP) - { - ThrowIfDisposedAndClosed (); - ThrowIfBufferNull (buffer); - - return SendTo (buffer, 0, buffer.Length, socketFlags, remoteEP); - } - - public int SendTo (byte [] buffer, int size, SocketFlags socketFlags, EndPoint remoteEP) - { - return SendTo (buffer, 0, size, socketFlags, remoteEP); - } - public int SendTo (byte [] buffer, int offset, int size, SocketFlags socketFlags, EndPoint remoteEP) { ThrowIfDisposedAndClosed (); @@ -2718,7 +2209,21 @@ namespace System.Net.Sockets if (remoteEP == null) throw new ArgumentNullException("remoteEP"); - return SendTo_nochecks (buffer, offset, size, socketFlags, remoteEP); + int error; + int ret = SendTo_internal (m_Handle, buffer, offset, size, socketFlags, remoteEP.Serialize (), out error); + + SocketError err = (SocketError) error; + if (err != 0) { + if (err != SocketError.WouldBlock && err != SocketError.InProgress) + is_connected = false; + throw new SocketException (error); + } + + is_connected = true; + is_bound = true; + seed_endpoint = remoteEP; + + return ret; } public bool SendToAsync (SocketAsyncEventArgs e) @@ -2740,7 +2245,7 @@ namespace System.Net.Sockets e.socket_async_result.SockFlags = e.SocketFlags; e.socket_async_result.EndPoint = e.RemoteEndPoint; - QueueIOSelectorJob (writeQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), e.socket_async_result)); + QueueIOSelectorJob (WriteSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), e.socket_async_result)); return true; } @@ -2776,7 +2281,7 @@ namespace System.Net.Sockets EndPoint = remote_end, }; - QueueIOSelectorJob (writeQ, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), sockares)); + QueueIOSelectorJob (WriteSem, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), sockares)); return sockares; } @@ -2785,7 +2290,7 @@ namespace System.Net.Sockets { int total = 0; try { - total = sockares.socket.SendTo_nochecks (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, sockares.EndPoint); + total = sockares.socket.SendTo (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, sockares.EndPoint); if (sockares.error == 0) { sent_so_far += total; @@ -2821,25 +2326,6 @@ namespace System.Net.Sockets return sockares.Total; } - int SendTo_nochecks (byte [] buffer, int offset, int size, SocketFlags flags, EndPoint remote_end) - { - int error; - int ret = SendTo_internal (safe_handle, buffer, offset, size, flags, remote_end.Serialize (), out error); - - SocketError err = (SocketError) error; - if (err != 0) { - if (err != SocketError.WouldBlock && err != SocketError.InProgress) - is_connected = false; - throw new SocketException (error); - } - - is_connected = true; - is_bound = true; - seed_endpoint = remote_end; - - return ret; - } - static int SendTo_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, SocketAddress sa, out int error) { try { @@ -2857,18 +2343,6 @@ namespace System.Net.Sockets #region SendFile - public void SendFile (string fileName) - { - ThrowIfDisposedAndClosed (); - - if (!is_connected) - throw new NotSupportedException (); - if (!is_blocking) - throw new InvalidOperationException (); - - SendFile (fileName, null, null, 0); - } - public void SendFile (string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags) { ThrowIfDisposedAndClosed (); @@ -2878,7 +2352,7 @@ namespace System.Net.Sockets if (!is_blocking) throw new InvalidOperationException (); - if (!SendFile_internal (safe_handle, fileName, preBuffer, postBuffer, flags)) { + if (!SendFile_internal (m_Handle, fileName, preBuffer, postBuffer, flags)) { SocketException exc = new SocketException (); if (exc.ErrorCode == 2 || exc.ErrorCode == 3) throw new FileNotFoundException (); @@ -2886,18 +2360,6 @@ namespace System.Net.Sockets } } - public IAsyncResult BeginSendFile (string fileName, AsyncCallback callback, object state) - { - ThrowIfDisposedAndClosed (); - - if (!is_connected) - throw new NotSupportedException (); - if (!File.Exists (fileName)) - throw new FileNotFoundException (); - - return BeginSendFile (fileName, null, null, 0, callback, state); - } - public IAsyncResult BeginSendFile (string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags, AsyncCallback callback, object state) { ThrowIfDisposedAndClosed (); @@ -2994,7 +2456,6 @@ namespace System.Net.Sockets #region DuplicateAndClose -#if !MOBILE [MonoLimitation ("We do not support passing sockets across processes, we merely allow this API to pass the socket across AppDomains")] public SocketInformation DuplicateAndClose (int targetProcessId) { @@ -3003,14 +2464,13 @@ namespace System.Net.Sockets (is_listening ? SocketInformationOptions.Listening : 0) | (is_connected ? SocketInformationOptions.Connected : 0) | (is_blocking ? 0 : SocketInformationOptions.NonBlocking) | - (use_overlapped_io ? SocketInformationOptions.UseOnlyOverlappedIO : 0); + (useOverlappedIO ? SocketInformationOptions.UseOnlyOverlappedIO : 0); - si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)address_family, (int)socket_type, (int)protocol_type, is_bound ? 1 : 0, (long)Handle); - safe_handle = null; + si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)addressFamily, (int)socketType, (int)protocolType, is_bound ? 1 : 0, (long)Handle); + m_Handle = null; return si; } -#endif #endregion @@ -3024,7 +2484,7 @@ namespace System.Net.Sockets throw new SocketException ((int) SocketError.Fault, "Error trying to dereference an invalid pointer"); int error; - GetSocketOption_arr_internal (safe_handle, optionLevel, optionName, ref optionValue, out error); + GetSocketOption_arr_internal (m_Handle, optionLevel, optionName, ref optionValue, out error); if (error != 0) throw new SocketException (error); @@ -3036,7 +2496,7 @@ namespace System.Net.Sockets int error; byte[] byte_val = new byte [optionLength]; - GetSocketOption_arr_internal (safe_handle, optionLevel, optionName, ref byte_val, out error); + GetSocketOption_arr_internal (m_Handle, optionLevel, optionName, ref byte_val, out error); if (error != 0) throw new SocketException (error); @@ -3050,7 +2510,7 @@ namespace System.Net.Sockets int error; object obj_val; - GetSocketOption_obj_internal (safe_handle, optionLevel, optionName, out obj_val, out error); + GetSocketOption_obj_internal (m_Handle, optionLevel, optionName, out obj_val, out error); if (error != 0) throw new SocketException (error); @@ -3108,7 +2568,7 @@ namespace System.Net.Sockets throw new SocketException ((int) SocketError.Fault, "Error trying to dereference an invalid pointer"); int error; - SetSocketOption_internal (safe_handle, optionLevel, optionName, null, optionValue, 0, out error); + SetSocketOption_internal (m_Handle, optionLevel, optionName, null, optionValue, 0, out error); if (error != 0) { if (error == (int) SocketError.InvalidArgument) @@ -3131,17 +2591,17 @@ namespace System.Net.Sockets LingerOption linger = optionValue as LingerOption; if (linger == null) throw new ArgumentException ("A 'LingerOption' value must be specified.", "optionValue"); - SetSocketOption_internal (safe_handle, optionLevel, optionName, linger, null, 0, out error); + SetSocketOption_internal (m_Handle, optionLevel, optionName, linger, null, 0, out error); } else if (optionLevel == SocketOptionLevel.IP && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership)) { MulticastOption multicast = optionValue as MulticastOption; if (multicast == null) throw new ArgumentException ("A 'MulticastOption' value must be specified.", "optionValue"); - SetSocketOption_internal (safe_handle, optionLevel, optionName, multicast, null, 0, out error); + SetSocketOption_internal (m_Handle, optionLevel, optionName, multicast, null, 0, out error); } else if (optionLevel == SocketOptionLevel.IPv6 && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership)) { IPv6MulticastOption multicast = optionValue as IPv6MulticastOption; if (multicast == null) throw new ArgumentException ("A 'IPv6MulticastOption' value must be specified.", "optionValue"); - SetSocketOption_internal (safe_handle, optionLevel, optionName, multicast, null, 0, out error); + SetSocketOption_internal (m_Handle, optionLevel, optionName, multicast, null, 0, out error); } else { throw new ArgumentException ("Invalid value specified.", "optionValue"); } @@ -3164,11 +2624,11 @@ namespace System.Net.Sockets { ThrowIfDisposedAndClosed (); - if (optionLevel == SocketOptionLevel.Socket && optionName == SocketOptionName.ReuseAddress && optionValue != 0 && !SupportsPortReuse (protocol_type)) + if (optionLevel == SocketOptionLevel.Socket && optionName == SocketOptionName.ReuseAddress && optionValue != 0 && !SupportsPortReuse (protocolType)) throw new SocketException ((int) SocketError.OperationNotSupported, "Operating system sockets do not support ReuseAddress.\nIf your socket is not intended to bind to the same address and port multiple times remove this option, otherwise you should ignore this exception inside a try catch and check that ReuseAddress is true before binding to the same address and port multiple times."); int error; - SetSocketOption_internal (safe_handle, optionLevel, optionName, null, null, optionValue, out error); + SetSocketOption_internal (m_Handle, optionLevel, optionName, null, null, optionValue, out error); if (error != 0) { if (error == (int) SocketError.InvalidArgument) @@ -3198,11 +2658,11 @@ namespace System.Net.Sockets public int IOControl (int ioControlCode, byte [] optionInValue, byte [] optionOutValue) { - if (is_disposed) + if (CleanedUp) throw new ObjectDisposedException (GetType ().ToString ()); int error; - int result = IOControl_internal (safe_handle, ioControlCode, optionInValue, optionOutValue, out error); + int result = IOControl_internal (m_Handle, ioControlCode, optionInValue, optionOutValue, out error); if (error != 0) throw new SocketException (error); @@ -3212,11 +2672,6 @@ namespace System.Net.Sockets return result; } - public int IOControl (IOControlCode ioControlCode, byte[] optionInValue, byte[] optionOutValue) - { - return IOControl ((int) ioControlCode, optionInValue, optionOutValue); - } - static int IOControl_internal (SafeSocketHandle safeHandle, int ioctl_code, byte [] input, byte [] output, out int error) { bool release = false; @@ -3266,7 +2721,7 @@ namespace System.Net.Sockets throw new SocketException (10057); // Not connected int error; - Shutdown_internal (safe_handle, how, out error); + Shutdown_internal (m_Handle, how, out error); if (error != 0) throw new SocketException (error); @@ -3293,30 +2748,24 @@ namespace System.Net.Sockets protected virtual void Dispose (bool disposing) { - if (is_disposed) + if (CleanedUp) return; - is_disposed = true; + m_IntCleanedUp = 1; bool was_connected = is_connected; is_connected = false; - if (safe_handle != null) { + if (m_Handle != null) { is_closed = true; IntPtr x = Handle; if (was_connected) Linger (x); - safe_handle.Dispose (); + m_Handle.Dispose (); } } - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - void Linger (IntPtr handle) { if (!is_connected || linger_timeout <= 0) @@ -3351,13 +2800,13 @@ namespace System.Net.Sockets void ThrowIfDisposedAndClosed (Socket socket) { - if (socket.is_disposed && socket.is_closed) + if (socket.CleanedUp && socket.is_closed) throw new ObjectDisposedException (socket.GetType ().ToString ()); } void ThrowIfDisposedAndClosed () { - if (is_disposed && is_closed) + if (CleanedUp && is_closed) throw new ObjectDisposedException (GetType ().ToString ()); } @@ -3381,7 +2830,7 @@ namespace System.Net.Sockets void ThrowIfUdp () { - if (protocol_type == ProtocolType.Udp) + if (protocolType == ProtocolType.Udp) throw new SocketException ((int)SocketError.ProtocolOption); } @@ -3399,16 +2848,16 @@ namespace System.Net.Sockets return sockares; } - void QueueIOSelectorJob (Queue> queue, IntPtr handle, IOSelectorJob job) + void QueueIOSelectorJob (SemaphoreSlim sem, IntPtr handle, IOSelectorJob job) { - int count; - lock (queue) { - queue.Enqueue (new KeyValuePair (handle, job)); - count = queue.Count; - } + sem.WaitAsync ().ContinueWith (t => { + if (CleanedUp) { + job.MarkDisposed (); + return; + } - if (count == 1) IOSelector.Add (handle, job); + }); } void InitSocketAsyncEventArgs (SocketAsyncEventArgs e, AsyncCallback callback, object state, SocketOperation operation) diff --git a/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs b/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs index 361f55ec929..438d4bc31e9 100644 --- a/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs +++ b/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs @@ -111,12 +111,10 @@ namespace System.Net.Sockets set; } -#if !MOBILE public TransmitFileOptions SendPacketsFlags { get; set; } -#endif [MonoTODO ("unused property")] public int SendPacketsSendSize { diff --git a/mcs/class/System/System.Net.Sockets/SocketAsyncResult.cs b/mcs/class/System/System.Net.Sockets/SocketAsyncResult.cs index 980ad06e5b2..c63b1781660 100644 --- a/mcs/class/System/System.Net.Sockets/SocketAsyncResult.cs +++ b/mcs/class/System/System.Net.Sockets/SocketAsyncResult.cs @@ -140,7 +140,7 @@ namespace System.Net.Sockets public void Complete () { - if (operation != SocketOperation.Receive && socket.is_disposed) + if (operation != SocketOperation.Receive && socket.CleanedUp) DelayedException = new ObjectDisposedException (socket.GetType ().ToString ()); IsCompleted = true; @@ -150,42 +150,20 @@ namespace System.Net.Sockets ThreadPool.UnsafeQueueUserWorkItem (_ => callback (this), null); } - Queue> queue = null; switch (operation) { case SocketOperation.Receive: case SocketOperation.ReceiveFrom: case SocketOperation.ReceiveGeneric: case SocketOperation.Accept: - queue = socket.readQ; + socket.ReadSem.Release (); break; case SocketOperation.Send: case SocketOperation.SendTo: case SocketOperation.SendGeneric: - queue = socket.writeQ; + socket.WriteSem.Release (); break; } - if (queue != null) { - lock (queue) { - /* queue.Count will only be 0 if the socket is closed while receive/send/accept - * operation(s) are pending and at least one call to this method is waiting - * on the lock while another one calls CompleteAllOnDispose() */ - if (queue.Count > 0) - queue.Dequeue (); /* remove ourselves */ - if (queue.Count > 0) { - if (!socket.is_disposed) { - IOSelector.Add (queue.Peek ().Key, queue.Peek ().Value); - } else { - /* CompleteAllOnDispose */ - KeyValuePair [] jobs = queue.ToArray (); - for (int i = 0; i < jobs.Length; i++) - ThreadPool.QueueUserWorkItem (j => ((IOSelectorJob) j).MarkDisposed (), jobs [i].Value); - queue.Clear (); - } - } - } - } - // IMPORTANT: 'callback', if any is scheduled from unmanaged code } diff --git a/mcs/class/System/System.Net.Sockets/TcpListener.cs b/mcs/class/System/System.Net.Sockets/TcpListener.cs index 8ab582e5541..e8b8ec40e0e 100644 --- a/mcs/class/System/System.Net.Sockets/TcpListener.cs +++ b/mcs/class/System/System.Net.Sockets/TcpListener.cs @@ -200,7 +200,29 @@ namespace System.Net.Sockets return client; } - + + public void AllowNatTraversal (bool allowed) + { + if (active) + throw new InvalidOperationException (SR.GetString (SR.net_tcplistener_mustbestopped)); + + if (allowed) + server.SetIPProtectionLevel (IPProtectionLevel.Unrestricted); + else + server.SetIPProtectionLevel (IPProtectionLevel.EdgeRestricted); + } + + public static TcpListener Create (int port) + { + if (port < 0 || port > 65535) + throw new ArgumentOutOfRangeException ("port"); + + TcpListener listener = new TcpListener (IPAddress.IPv6Any, port); + listener.Server.DualMode = true; + + return listener; + } + /// /// Destructor - stops the listener listening /// diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.cs b/mcs/class/System/System.Net.Sockets/UdpClient.cs index ad3c4117f58..c82529b32b9 100644 --- a/mcs/class/System/System.Net.Sockets/UdpClient.cs +++ b/mcs/class/System/System.Net.Sockets/UdpClient.cs @@ -125,6 +125,14 @@ namespace System.Net.Sockets socket.Bind (localEP); } + public void AllowNatTraversal (bool allowed) + { + if (allowed) + socket.SetIPProtectionLevel (IPProtectionLevel.Unrestricted); + else + socket.SetIPProtectionLevel (IPProtectionLevel.EdgeRestricted); + } + public void Close () { Dispose (); diff --git a/mcs/class/System/System.Net/AuthenticationManager.cs b/mcs/class/System/System.Net/AuthenticationManager.cs index 1ed7dfe075f..98200b45b4a 100644 --- a/mcs/class/System/System.Net/AuthenticationManager.cs +++ b/mcs/class/System/System.Net/AuthenticationManager.cs @@ -106,6 +106,13 @@ namespace System.Net } } + [MonoTODO] + internal static bool OSSupportsExtendedProtection { + get { + return false; + } + } + internal static void Clear () { EnsureModules (); diff --git a/mcs/class/System/System.Net/HttpListener.cs b/mcs/class/System/System.Net/HttpListener.cs index 29afc0fd84b..716229d8b56 100644 --- a/mcs/class/System/System.Net/HttpListener.cs +++ b/mcs/class/System/System.Net/HttpListener.cs @@ -42,6 +42,7 @@ using System.IO; using System.Collections; using System.Threading; using System.Threading.Tasks; +using System.Security.Authentication.ExtendedProtection; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; @@ -69,6 +70,12 @@ namespace System.Net { ArrayList wait_queue; // List wait_queue; Hashtable connections; + ServiceNameStore defaultServiceNames; + ExtendedProtectionPolicy extendedProtectionPolicy; + ExtendedProtectionSelector extendedProtectionSelectorDelegate; + + public delegate ExtendedProtectionPolicy ExtendedProtectionSelector (HttpListenerRequest request); + public HttpListener () { prefixes = new HttpListenerPrefixCollection (this); @@ -77,6 +84,8 @@ namespace System.Net { ctx_queue = new ArrayList (); wait_queue = new ArrayList (); auth_schemes = AuthenticationSchemes.Anonymous; + defaultServiceNames = new ServiceNameStore (); + extendedProtectionPolicy = new ExtendedProtectionPolicy (PolicyEnforcement.Never); } internal HttpListener (X509Certificate certificate, IMonoTlsProvider tlsProvider, MSI.MonoTlsSettings tlsSettings) @@ -146,6 +155,21 @@ namespace System.Net { } } + public ExtendedProtectionSelector ExtendedProtectionSelectorDelegate + { + get { return extendedProtectionSelectorDelegate; } + set { + CheckDisposed(); + if (value == null) + throw new ArgumentNullException (); + + if (!AuthenticationManager.OSSupportsExtendedProtection) + throw new PlatformNotSupportedException (SR.GetString (SR.security_ExtendedProtection_NoOSSupport)); + + extendedProtectionSelectorDelegate = value; + } + } + public bool IgnoreWriteExceptions { get { return ignore_write_exceptions; } set { @@ -169,6 +193,42 @@ namespace System.Net { } } + [MonoTODO] + public HttpListenerTimeoutManager TimeoutManager { + get { + throw new NotImplementedException (); + } + } + + [MonoTODO ("not used anywhere in the implementation")] + public ExtendedProtectionPolicy ExtendedProtectionPolicy + { + get { + return extendedProtectionPolicy; + } + set { + CheckDisposed (); + + if (value == null) + throw new ArgumentNullException ("value"); + + if (!AuthenticationManager.OSSupportsExtendedProtection && value.PolicyEnforcement == PolicyEnforcement.Always) + throw new PlatformNotSupportedException (SR.GetString(SR.security_ExtendedProtection_NoOSSupport)); + + if (value.CustomChannelBinding != null) + throw new ArgumentException (SR.GetString (SR.net_listener_cannot_set_custom_cbt), "CustomChannelBinding"); + + extendedProtectionPolicy = value; + } + } + + public ServiceNameCollection DefaultServiceNames + { + get { + return defaultServiceNames.ServiceNames; + } + } + // TODO: use this public string Realm { get { return realm; } diff --git a/mcs/class/System/System.Net/HttpListenerContext.cs b/mcs/class/System/System.Net/HttpListenerContext.cs index d495e4af581..5a3a2f0f445 100644 --- a/mcs/class/System/System.Net/HttpListenerContext.cs +++ b/mcs/class/System/System.Net/HttpListenerContext.cs @@ -137,16 +137,25 @@ namespace System.Net { } } + [MonoTODO] public Task AcceptWebSocketAsync (string subProtocol) { throw new NotImplementedException (); } + [MonoTODO] + public Task AcceptWebSocketAsync (string subProtocol, TimeSpan keepAliveInterval) + { + throw new NotImplementedException (); + } + + [MonoTODO] public Task AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval) { throw new NotImplementedException (); } + [MonoTODO] public Task AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval, ArraySegment internalBuffer) { throw new NotImplementedException (); diff --git a/mcs/class/System/System.Net/HttpListenerTimeoutManager.cs b/mcs/class/System/System.Net/HttpListenerTimeoutManager.cs index d7e008baa03..34673579632 100644 --- a/mcs/class/System/System.Net/HttpListenerTimeoutManager.cs +++ b/mcs/class/System/System.Net/HttpListenerTimeoutManager.cs @@ -30,6 +30,46 @@ namespace System.Net { public class HttpListenerTimeoutManager { + [MonoTODO] + public TimeSpan EntityBody + { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + [MonoTODO] + public TimeSpan DrainEntityBody + { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public TimeSpan RequestQueue + { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public TimeSpan IdleConnection + { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public TimeSpan HeaderWait + { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public long MinSendBytesPerSecond + { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } } } \ No newline at end of file diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs index 9f94783258d..1d48dfe0b87 100644 --- a/mcs/class/System/System.Net/HttpWebRequest.cs +++ b/mcs/class/System/System.Net/HttpWebRequest.cs @@ -226,12 +226,12 @@ namespace System.Net internal set { actualUri = value; } // Used by Ftp+proxy } - public bool AllowAutoRedirect { + public virtual bool AllowAutoRedirect { get { return allowAutoRedirect; } set { this.allowAutoRedirect = value; } } - public bool AllowWriteStreamBuffering { + public virtual bool AllowWriteStreamBuffering { get { return allowBuffering; } set { allowBuffering = value; } } @@ -918,6 +918,12 @@ namespace System.Net return EndGetRequestStream (asyncResult); } + [MonoTODO] + public Stream GetRequestStream (out TransportContext context) + { + throw new NotImplementedException (); + } + bool CheckIfForceWrite (SimpleAsyncResult result) { if (writeStream == null || writeStream.RequestWritten || !InternalAllowBuffering) diff --git a/mcs/class/System/System.Net/HttpWebResponse.cs b/mcs/class/System/System.Net/HttpWebResponse.cs index 6a73ae0f167..9f7daa6c452 100644 --- a/mcs/class/System/System.Net/HttpWebResponse.cs +++ b/mcs/class/System/System.Net/HttpWebResponse.cs @@ -106,7 +106,7 @@ namespace System.Net version = (Version) info.GetValue ("version", typeof (Version)); statusCode = (HttpStatusCode) info.GetValue ("statusCode", typeof (HttpStatusCode)); } - + // Properties public string CharacterSet { diff --git a/mcs/class/System/System.Net/ServicePointManager.cs b/mcs/class/System/System.Net/ServicePointManager.cs index 17308253af5..d379526e80b 100644 --- a/mcs/class/System/System.Net/ServicePointManager.cs +++ b/mcs/class/System/System.Net/ServicePointManager.cs @@ -256,6 +256,12 @@ namespace System.Net } } + [MonoTODO] + public static bool ReusePort { + get { return false; } + set { throw new NotImplementedException (); } + } + public static SecurityProtocolType SecurityProtocol { get { return _securityProtocol; } set { _securityProtocol = value; } @@ -280,6 +286,13 @@ namespace System.Net } } + [MonoTODO ("Always returns EncryptionPolicy.RequireEncryption.")] + public static EncryptionPolicy EncryptionPolicy { + get { + return EncryptionPolicy.RequireEncryption; + } + } + public static bool Expect100Continue { get { return expectContinue; } set { expectContinue = value; } diff --git a/mcs/class/System/System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs b/mcs/class/System/System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs deleted file mode 100644 index 3fa9b3f4a9d..00000000000 --- a/mcs/class/System/System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// ServiceNameCollection.cs -// -// Authors: -// Atsushi Enomoto -// - -// -// Copyright (C) 2010 Novell, Inc (http://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; -using System.Collections; - -namespace System.Security.Authentication.ExtendedProtection -{ - [MonoTODO] - [Serializable] - public class ServiceNameCollection : ReadOnlyCollectionBase - { - public ServiceNameCollection (ICollection items) - { - throw new NotImplementedException (); - } - - public ServiceNameCollection Merge (IEnumerable serviceNames) - { - throw new NotImplementedException (); - } - - public ServiceNameCollection Merge (string serviceName) - { - throw new NotImplementedException (); - } - - public bool Contains (string searchServiceName) - { - throw new NotImplementedException (); - } - } -} - diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs index 29decab439f..bd69c786b89 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs @@ -45,6 +45,7 @@ using MX = Mono.Security.X509; using System.IO; using System.Text; using System.Collections; +using System.Runtime.Serialization; namespace System.Security.Cryptography.X509Certificates { @@ -134,6 +135,10 @@ namespace System.Security.Cryptography.X509Certificates { { } + protected X509Certificate2 (SerializationInfo info, StreamingContext context) : base (info, context) + { + } + internal X509Certificate2 (X509Certificate2Impl impl) : base (impl) { diff --git a/mcs/class/System/System.dll.sources b/mcs/class/System/System.dll.sources index 3a204f1cfd7..4b4e6e3ef15 100644 --- a/mcs/class/System/System.dll.sources +++ b/mcs/class/System/System.dll.sources @@ -148,11 +148,9 @@ System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs System.Diagnostics/PerformanceCounterPermissionEntry.cs System.Diagnostics/PerformanceCounterType.cs System.Diagnostics/Process.cs -System.Diagnostics/ProcessModuleCollection.cs System.Diagnostics/ProcessModule.cs System.Diagnostics/ProcessPriorityClass.cs System.Diagnostics/ProcessStartInfo.cs -System.Diagnostics/ProcessThreadCollection.cs System.Diagnostics/ProcessThread.cs System.Diagnostics/ProcessWindowStyle.cs System.Diagnostics/Stopwatch.cs @@ -387,6 +385,7 @@ System.Net.Sockets/SafeSocketHandle.cs ../referencesource/System/net/System/Net/Sockets/SelectMode.cs System.Net.Sockets/SendPacketsElement.cs System.Net.Sockets/Socket.cs +../referencesource/System/net/System/Net/Sockets/Socket.cs System.Net.Sockets/SocketAsyncEventArgs.cs System.Net.Sockets/SocketAsyncOperation.cs System.Net.Sockets/SocketAsyncResult.cs @@ -437,7 +436,6 @@ System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs -System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs @@ -563,7 +561,6 @@ ReferenceSources/BinaryCompatibility.cs ReferenceSources/ConfigurationManagerInternalFactory.cs ReferenceSources/CAPI.cs ReferenceSources/EnvironmentHelpers.cs -ReferenceSources/Internal.cs ReferenceSources/HttpApi.cs ReferenceSources/HttpSysSettings.cs ReferenceSources/LocalAppContextSwitches.cs @@ -577,14 +574,6 @@ ReferenceSources/SR2.cs ReferenceSources/SRCategoryAttribute.cs ReferenceSources/Win32Exception.cs -ReferenceSources/SSPIConfiguration.cs -ReferenceSources/SSPISafeHandles.cs -ReferenceSources/SSPIWrapper.cs -ReferenceSources/SslStream.cs -ReferenceSources/_SecureChannel.cs -ReferenceSources/_SslState.cs -ReferenceSources/_SslStream.cs - ../referencesource/System/misc/PrivilegedConfigurationManager.cs ../referencesource/System/regex/system/text/regularexpressions/Regex.cs ../referencesource/System/regex/system/text/regularexpressions/RegexBoyerMoore.cs @@ -982,6 +971,7 @@ ReferenceSources/_SslStream.cs ../referencesource/System/net/System/Net/_ProxyChain.cs ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs ../referencesource/System/net/System/Net/_Semaphore.cs +../referencesource/System/net/System/Net/_ServiceNameStore.cs ../referencesource/System/net/System/Net/_TimerThread.cs ../referencesource/System/net/System/Net/_WebProxyDataBuilder.cs ../referencesource/System/net/System/Net/AuthenticationScheme.cs @@ -1105,6 +1095,7 @@ ReferenceSources/_SslStream.cs ../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs ../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs +../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs ../referencesource/System/security/system/security/cryptography/oid.cs @@ -1112,6 +1103,9 @@ ReferenceSources/_SslStream.cs ../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs +../referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs +../referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs + ../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs ../referencesource/System/services/timers/system/timers/Timer.cs ../referencesource/System/services/timers/system/timers/TimersDescriptionAttribute.cs diff --git a/mcs/class/System/Test/System.Net.NetworkInformation/IPInterfacePropertiesTest.cs b/mcs/class/System/Test/System.Net.NetworkInformation/IPInterfacePropertiesTest.cs index 7fe74638571..51752302b20 100644 --- a/mcs/class/System/Test/System.Net.NetworkInformation/IPInterfacePropertiesTest.cs +++ b/mcs/class/System/Test/System.Net.NetworkInformation/IPInterfacePropertiesTest.cs @@ -113,6 +113,9 @@ namespace MonoTests.System.Net.NetworkInformation [Test] public void DnsEnabled () { + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + Assert.Ignore ("IsDnsEnabled is not nessasarily enabled for all interfaces on windows."); + NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces (); foreach (NetworkInterface adapter in adapters) { diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs index 4955d3f3c60..ac0f766f2a8 100755 --- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs @@ -2599,6 +2599,72 @@ namespace MonoTests.System.Net.Sockets listensock.Close (); } + [Test] + public void ConcurrentExceedSocketLimit () + { + var tasks = new Task[4]; + for (int i = 0; i < 4; i++) { + tasks[i] = Task.Factory.StartNew (() => SendGenericExceedBuffer ()); + } + Task.WaitAll (tasks); + } + + [Test] + public void SendGenericExceedBuffer () + { + // Create a buffer larger than the default max. + const int BUFFER_SIZE = 256 * 256 * 65; + int i; + + IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, NetworkHelpers.FindFreePort ()); + + Socket listensock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + listensock.Bind (endpoint); + listensock.Listen (1); + + Socket sendsock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + sendsock.Connect (endpoint); + + Socket clientsock = listensock.Accept (); + + byte[] sendbuf = new byte[BUFFER_SIZE]; + + for (i = 0; i < BUFFER_SIZE; i++) { + sendbuf[i] = (byte)i; + } + + Task sendTask = Task.Factory.StartNew(() => { + int sent = sendsock.Send (sendbuf); + + Assert.AreEqual (BUFFER_SIZE, sent, "#1"); + }); + + byte[] recvbuf = new byte[BUFFER_SIZE]; + + Task recvTask = Task.Factory.StartNew(() => { + int totalReceived = 0; + byte[] buffer = new byte[256]; + while (totalReceived < sendbuf.Length) { + int recvd = clientsock.Receive (buffer, 0, buffer.Length, SocketFlags.None); + Array.Copy (buffer, 0, recvbuf, totalReceived, recvd); + totalReceived += recvd; + } + + Assert.AreEqual (BUFFER_SIZE, totalReceived, "#2"); + }); + + Assert.IsTrue (Task.WaitAll (new []{sendTask, recvTask}, 15 * 1000), "#2a"); + + for (i = 0; i < BUFFER_SIZE; i++) { + Assert.AreEqual (recvbuf[i], sendbuf[i], + "#3/" + i.ToString()); + } + + sendsock.Close (); + clientsock.Close (); + listensock.Close (); + } + [Test] public void ListenNotBound () { diff --git a/mcs/class/System/mobile_System.dll.sources b/mcs/class/System/mobile_System.dll.sources index dd86f5c10a3..a815d696758 100644 --- a/mcs/class/System/mobile_System.dll.sources +++ b/mcs/class/System/mobile_System.dll.sources @@ -11,11 +11,9 @@ System.Diagnostics/FileVersionInfo.cs System.Diagnostics/MonitoringDescriptionAttribute.cs System.Diagnostics/Process.cs System.Diagnostics/ProcessModule.cs -System.Diagnostics/ProcessModuleCollection.cs System.Diagnostics/ProcessPriorityClass.cs System.Diagnostics/ProcessStartInfo.cs System.Diagnostics/ProcessThread.cs -System.Diagnostics/ProcessThreadCollection.cs System.Diagnostics/ProcessWindowStyle.cs System.Diagnostics/Stopwatch.cs System.Diagnostics/ThreadPriorityLevel.cs @@ -28,6 +26,7 @@ System.IO.Compression/DeflateStream.cs System.IO.Compression/GZipStream.cs System.IO/InternalBufferOverflowException.cs System.IO/InvalidDataException.cs +System.IO/IODescriptionAttribute.cs System.IO/ErrorEventArgs.cs System.IO/ErrorEventHandler.cs System.IO/FileSystemEventArgs.cs @@ -130,6 +129,7 @@ System.Net.Sockets/SafeSocketHandle.cs ../referencesource/System/net/System/Net/Sockets/SelectMode.cs System.Net.Sockets/SendPacketsElement.cs System.Net.Sockets/Socket.cs +../referencesource/System/net/System/Net/Sockets/Socket.cs System.Net.Sockets/SocketAsyncEventArgs.cs System.Net.Sockets/SocketAsyncOperation.cs System.Net.Sockets/SocketAsyncResult.cs @@ -227,7 +227,6 @@ System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs -System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs @@ -308,7 +307,6 @@ ReferenceSources/AssertWrapper.cs ReferenceSources/CAPI.cs ReferenceSources/EnvironmentHelpers.cs ReferenceSources/HttpApi.cs -ReferenceSources/Internal.cs ReferenceSources/LocalAppContextSwitches.cs ReferenceSources/HttpSysSettings.cs ReferenceSources/Logging.cs @@ -706,6 +704,7 @@ ReferenceSources/Win32Exception.cs ../referencesource/System/net/System/Net/_ProxyChain.cs ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs ../referencesource/System/net/System/Net/_Semaphore.cs +../referencesource/System/net/System/Net/_ServiceNameStore.cs ../referencesource/System/net/System/Net/_TimerThread.cs ../referencesource/System/net/System/Net/_WebProxyDataBuilder.cs ../referencesource/System/net/System/Net/AuthenticationScheme.cs @@ -829,6 +828,7 @@ ReferenceSources/Win32Exception.cs ../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs ../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs +../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs ../referencesource/System/security/system/security/cryptography/oid.cs @@ -836,6 +836,9 @@ ReferenceSources/Win32Exception.cs ../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs +../referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs +../referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs + ../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs ../referencesource/System/services/timers/system/timers/Timer.cs ../referencesource/System/services/timers/system/timers/TimersDescriptionAttribute.cs diff --git a/mcs/class/corlib/Assembly/AssemblyInfo.cs b/mcs/class/corlib/Assembly/AssemblyInfo.cs index 75828e154eb..d315128745d 100644 --- a/mcs/class/corlib/Assembly/AssemblyInfo.cs +++ b/mcs/class/corlib/Assembly/AssemblyInfo.cs @@ -94,5 +94,4 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] #endif -[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")] [assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")] diff --git a/mcs/class/corlib/Documentation/s b/mcs/class/corlib/Documentation/s deleted file mode 100644 index aa4de6564da..00000000000 --- a/mcs/class/corlib/Documentation/s +++ /dev/null @@ -1,1374 +0,0 @@ -? s -? en/System.Collections.Concurrent -? en/ns-System.Threading.Tasks.xml -? en/ns-System.Collections.Concurrent.xml -? en/ns-System.Diagnostics.Contracts.xml -? en/System.Threading.Tasks -? en/ns-.xml -? en/System.Diagnostics.Contracts.Internal -? en/ns-System.Diagnostics.Contracts.Internal.xml -? en/System.Diagnostics.Contracts -M en/System.Runtime.InteropServices.Expando/IExpando.xml -? en/System.Runtime.Versioning/TargetFrameworkAttribute.xml -M en/System.Runtime.Versioning/ResourceScope.xml -M en/System.Runtime.Versioning/VersioningHelper.xml -M en/System.Runtime.Versioning/ResourceExposureAttribute.xml -M en/System.Runtime.Versioning/ResourceConsumptionAttribute.xml -? en/System.Threading/CountdownEvent.xml -? en/System.Threading/CancellationTokenRegistration.xml -? en/System.Threading/SpinWait.xml -? en/System.Threading/ThreadLocal`1.xml -? en/System.Threading/SemaphoreSlim.xml -? en/System.Threading/SpinLock.xml -? en/System.Threading/LazyInitializer.xml -? en/System.Threading/SemaphoreFullException.xml -? en/System.Threading/LazyThreadSafetyMode.xml -? en/System.Threading/CancellationToken.xml -? en/System.Threading/LockRecursionException.xml -? en/System.Threading/ManualResetEventSlim.xml -? en/System.Threading/CancellationTokenSource.xml -M en/System.Threading/WaitHandle.xml -M en/System.Threading/WaitCallback.xml -M en/System.Threading/EventWaitHandle.xml -M en/System.Threading/LockCookie.xml -M en/System.Threading/SynchronizationLockException.xml -M en/System.Threading/EventResetMode.xml -M en/System.Threading/RegisteredWaitHandle.xml -M en/System.Threading/ThreadPool.xml -M en/System.Threading/Overlapped.xml -M en/System.Threading/HostExecutionContextManager.xml -M en/System.Threading/ParameterizedThreadStart.xml -M en/System.Threading/ThreadStartException.xml -M en/System.Threading/SynchronizationContext.xml -M en/System.Threading/AsyncFlowControl.xml -M en/System.Threading/HostExecutionContext.xml -M en/System.Threading/Thread.xml -M en/System.Threading/ExecutionContext.xml -M en/System.Threading/ThreadState.xml -M en/System.Threading/ThreadPriority.xml -M en/System.Threading/ThreadInterruptedException.xml -M en/System.Threading/IOCompletionCallback.xml -M en/System.Threading/Timer.xml -M en/System.Threading/ManualResetEvent.xml -M en/System.Threading/WaitOrTimerCallback.xml -M en/System.Threading/ThreadStart.xml -M en/System.Threading/Timeout.xml -M en/System.Threading/Monitor.xml -M en/System.Threading/ThreadStateException.xml -M en/System.Threading/CompressedStack.xml -M en/System.Threading/ApartmentState.xml -M en/System.Threading/TimerCallback.xml -M en/System.Threading/ContextCallback.xml -M en/System.Threading/Mutex.xml -M en/System.Threading/Interlocked.xml -M en/System.Threading/WaitHandleCannotBeOpenedException.xml -M en/System.Threading/ReaderWriterLock.xml -M en/System.Threading/NativeOverlapped.xml -M en/System.Threading/SendOrPostCallback.xml -M en/System.Threading/AbandonedMutexException.xml -M en/System.Threading/AutoResetEvent.xml -M en/System.Threading/ThreadAbortException.xml -M en/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.xml -? en/System.Security/SecurityContextSource.xml -? en/System.Security/SecurityRulesAttribute.xml -? en/System.Security/SecurityRuleSet.xml -? en/System.Security/SecurityState.xml -M en/System.Security/SecurityElement.xml -M en/System.Security/IEvidenceFactory.xml -M en/System.Security/SecurityException.xml -M en/System.Security/XmlSyntaxException.xml -M en/System.Security/PolicyLevelType.xml -M en/System.Security/UnverifiableCodeAttribute.xml -M en/System.Security/IStackWalk.xml -M en/System.Security/ISecurityPolicyEncodable.xml -M en/System.Security/HostSecurityManager.xml -M en/System.Security/IPermission.xml -M en/System.Security/VerificationException.xml -M en/System.Security/SecurityManager.xml -M en/System.Security/HostProtectionException.xml -M en/System.Security/SecurityZone.xml -M en/System.Security/PermissionSet.xml -M en/System.Security/CodeAccessPermission.xml -M en/System.Security/AllowPartiallyTrustedCallersAttribute.xml -M en/System.Security/SecuritySafeCriticalAttribute.xml -M en/System.Security/SecurityCriticalAttribute.xml -M en/System.Security/NamedPermissionSet.xml -M en/System.Security/SuppressUnmanagedCodeSecurityAttribute.xml -M en/System.Security/SecurityContext.xml -M en/System.Security/HostSecurityManagerOptions.xml -M en/System.Security/SecurityCriticalScope.xml -M en/System.Security/SecureString.xml -M en/System.Security/ISecurityEncodable.xml -M en/System.Security/SecurityTransparentAttribute.xml -M en/System.Security/SecurityTreatAsSafeAttribute.xml -? en/System.Security.AccessControl/ObjectSecurity`1.xml -M en/System.Security.AccessControl/ObjectAccessRule.xml -M en/System.Security.AccessControl/RegistryAccessRule.xml -M en/System.Security.AccessControl/MutexRights.xml -M en/System.Security.AccessControl/CustomAce.xml -M en/System.Security.AccessControl/DirectoryObjectSecurity.xml -M en/System.Security.AccessControl/GenericAce.xml -M en/System.Security.AccessControl/RegistryRights.xml -M en/System.Security.AccessControl/MutexSecurity.xml -M en/System.Security.AccessControl/AceQualifier.xml -M en/System.Security.AccessControl/AceEnumerator.xml -M en/System.Security.AccessControl/GenericAcl.xml -M en/System.Security.AccessControl/EventWaitHandleAccessRule.xml -M en/System.Security.AccessControl/ObjectSecurity.xml -M en/System.Security.AccessControl/FileSystemAccessRule.xml -M en/System.Security.AccessControl/RegistrySecurity.xml -M en/System.Security.AccessControl/EventWaitHandleRights.xml -M en/System.Security.AccessControl/SystemAcl.xml -M en/System.Security.AccessControl/AuthorizationRuleCollection.xml -M en/System.Security.AccessControl/AccessControlType.xml -M en/System.Security.AccessControl/FileSystemRights.xml -M en/System.Security.AccessControl/SecurityInfos.xml -M en/System.Security.AccessControl/CommonObjectSecurity.xml -M en/System.Security.AccessControl/RawAcl.xml -M en/System.Security.AccessControl/AccessControlSections.xml -M en/System.Security.AccessControl/EventWaitHandleSecurity.xml -M en/System.Security.AccessControl/FileSystemSecurity.xml -M en/System.Security.AccessControl/CommonSecurityDescriptor.xml -M en/System.Security.AccessControl/CryptoKeySecurity.xml -M en/System.Security.AccessControl/PrivilegeNotHeldException.xml -M en/System.Security.AccessControl/AccessControlActions.xml -M en/System.Security.AccessControl/RegistryAuditRule.xml -M en/System.Security.AccessControl/AuthorizationRule.xml -M en/System.Security.AccessControl/AccessControlModification.xml -M en/System.Security.AccessControl/ResourceType.xml -M en/System.Security.AccessControl/AccessRule.xml -M en/System.Security.AccessControl/DirectorySecurity.xml -M en/System.Security.AccessControl/CompoundAceType.xml -M en/System.Security.AccessControl/DiscretionaryAcl.xml -M en/System.Security.AccessControl/CommonAce.xml -M en/System.Security.AccessControl/FileSystemAuditRule.xml -M en/System.Security.AccessControl/AceFlags.xml -M en/System.Security.AccessControl/CommonAcl.xml -M en/System.Security.AccessControl/ObjectAce.xml -M en/System.Security.AccessControl/AuditFlags.xml -M en/System.Security.AccessControl/ObjectAceFlags.xml -M en/System.Security.AccessControl/CompoundAce.xml -M en/System.Security.AccessControl/CryptoKeyAccessRule.xml -M en/System.Security.AccessControl/KnownAce.xml -M en/System.Security.AccessControl/InheritanceFlags.xml -M en/System.Security.AccessControl/CryptoKeyAuditRule.xml -M en/System.Security.AccessControl/CryptoKeyRights.xml -M en/System.Security.AccessControl/QualifiedAce.xml -M en/System.Security.AccessControl/RawSecurityDescriptor.xml -M en/System.Security.AccessControl/MutexAuditRule.xml -M en/System.Security.AccessControl/ObjectAuditRule.xml -M en/System.Security.AccessControl/AceType.xml -M en/System.Security.AccessControl/ControlFlags.xml -M en/System.Security.AccessControl/AuditRule.xml -M en/System.Security.AccessControl/PropagationFlags.xml -M en/System.Security.AccessControl/EventWaitHandleAuditRule.xml -M en/System.Security.AccessControl/GenericSecurityDescriptor.xml -M en/System.Security.AccessControl/NativeObjectSecurity.xml -M en/System.Security.AccessControl/FileSecurity.xml -M en/System.Security.AccessControl/MutexAccessRule.xml -M en/System.Security.Permissions/PublisherIdentityPermission.xml -M en/System.Security.Permissions/SecurityPermission.xml -M en/System.Security.Permissions/KeyContainerPermissionFlags.xml -M en/System.Security.Permissions/RegistryPermission.xml -M en/System.Security.Permissions/StrongNameIdentityPermissionAttribute.xml -M en/System.Security.Permissions/IsolatedStoragePermissionAttribute.xml -M en/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.xml -M en/System.Security.Permissions/PermissionState.xml -M en/System.Security.Permissions/IsolatedStorageContainment.xml -M en/System.Security.Permissions/PrincipalPermission.xml -M en/System.Security.Permissions/FileDialogPermissionAttribute.xml -M en/System.Security.Permissions/HostProtectionResource.xml -M en/System.Security.Permissions/ReflectionPermissionFlag.xml -M en/System.Security.Permissions/ZoneIdentityPermission.xml -M en/System.Security.Permissions/EnvironmentPermissionAccess.xml -M en/System.Security.Permissions/EnvironmentPermissionAttribute.xml -M en/System.Security.Permissions/GacIdentityPermissionAttribute.xml -M en/System.Security.Permissions/FileIOPermissionAccess.xml -M en/System.Security.Permissions/PublisherIdentityPermissionAttribute.xml -M en/System.Security.Permissions/KeyContainerPermission.xml -M en/System.Security.Permissions/SecurityPermissionAttribute.xml -M en/System.Security.Permissions/SecurityAction.xml -M en/System.Security.Permissions/CodeAccessSecurityAttribute.xml -M en/System.Security.Permissions/UrlIdentityPermissionAttribute.xml -M en/System.Security.Permissions/SecurityPermissionFlag.xml -M en/System.Security.Permissions/SiteIdentityPermissionAttribute.xml -M en/System.Security.Permissions/EnvironmentPermission.xml -M en/System.Security.Permissions/GacIdentityPermission.xml -M en/System.Security.Permissions/PrincipalPermissionAttribute.xml -M en/System.Security.Permissions/UIPermissionWindow.xml -M en/System.Security.Permissions/FileIOPermission.xml -M en/System.Security.Permissions/ZoneIdentityPermissionAttribute.xml -M en/System.Security.Permissions/KeyContainerPermissionAccessEntryCollection.xml -M en/System.Security.Permissions/StrongNamePublicKeyBlob.xml -M en/System.Security.Permissions/UrlIdentityPermission.xml -M en/System.Security.Permissions/UIPermission.xml -M en/System.Security.Permissions/ReflectionPermissionAttribute.xml -M en/System.Security.Permissions/SiteIdentityPermission.xml -M en/System.Security.Permissions/PermissionSetAttribute.xml -M en/System.Security.Permissions/KeyContainerPermissionAttribute.xml -M en/System.Security.Permissions/FileDialogPermissionAccess.xml -M en/System.Security.Permissions/SecurityAttribute.xml -M en/System.Security.Permissions/IUnrestrictedPermission.xml -M en/System.Security.Permissions/StrongNameIdentityPermission.xml -M en/System.Security.Permissions/IsolatedStoragePermission.xml -M en/System.Security.Permissions/IsolatedStorageFilePermission.xml -M en/System.Security.Permissions/ReflectionPermission.xml -M en/System.Security.Permissions/RegistryPermissionAccess.xml -M en/System.Security.Permissions/FileIOPermissionAttribute.xml -M en/System.Security.Permissions/RegistryPermissionAttribute.xml -M en/System.Security.Permissions/UIPermissionClipboard.xml -M en/System.Security.Permissions/KeyContainerPermissionAccessEntry.xml -M en/System.Security.Permissions/FileDialogPermission.xml -M en/System.Security.Permissions/HostProtectionAttribute.xml -M en/System.Security.Permissions/KeyContainerPermissionAccessEntryEnumerator.xml -M en/System.Security.Permissions/UIPermissionAttribute.xml -M en/System.Runtime.Remoting.Messaging/CallContext.xml -M en/System.Runtime.Remoting.Messaging/IRemotingFormatter.xml -M en/System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.xml -M en/System.Runtime.Remoting.Messaging/InternalMessageWrapper.xml -M en/System.Runtime.Remoting.Messaging/IMessageSink.xml -M en/System.Runtime.Remoting.Messaging/IMessageCtrl.xml -M en/System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.xml -M en/System.Runtime.Remoting.Messaging/ReturnMessage.xml -M en/System.Runtime.Remoting.Messaging/HeaderHandler.xml -M en/System.Runtime.Remoting.Messaging/ConstructionCall.xml -M en/System.Runtime.Remoting.Messaging/MessageSurrogateFilter.xml -M en/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.xml -M en/System.Runtime.Remoting.Messaging/OneWayAttribute.xml -M en/System.Runtime.Remoting.Messaging/Header.xml -M en/System.Runtime.Remoting.Messaging/IMethodCallMessage.xml -M en/System.Runtime.Remoting.Messaging/IMessage.xml -M en/System.Runtime.Remoting.Messaging/IMethodReturnMessage.xml -M en/System.Runtime.Remoting.Messaging/IMethodMessage.xml -M en/System.Runtime.Remoting.Messaging/MethodResponse.xml -M en/System.Runtime.Remoting.Messaging/ILogicalThreadAffinative.xml -M en/System.Runtime.Remoting.Messaging/ConstructionResponse.xml -M en/System.Runtime.Remoting.Messaging/LogicalCallContext.xml -M en/System.Runtime.Remoting.Messaging/AsyncResult.xml -M en/System.Runtime.Remoting.Messaging/MethodCall.xml -M en/System.Security.Principal/TokenImpersonationLevel.xml -M en/System.Security.Principal/IdentityNotMappedException.xml -M en/System.Security.Principal/WellKnownSidType.xml -M en/System.Security.Principal/IdentityReferenceCollection.xml -M en/System.Security.Principal/GenericIdentity.xml -M en/System.Security.Principal/IPrincipal.xml -M en/System.Security.Principal/WindowsPrincipal.xml -M en/System.Security.Principal/NTAccount.xml -M en/System.Security.Principal/PrincipalPolicy.xml -M en/System.Security.Principal/IIdentity.xml -M en/System.Security.Principal/WindowsBuiltInRole.xml -M en/System.Security.Principal/WindowsIdentity.xml -M en/System.Security.Principal/WindowsImpersonationContext.xml -M en/System.Security.Principal/IdentityReference.xml -M en/System.Security.Principal/WindowsAccountType.xml -M en/System.Security.Principal/SecurityIdentifier.xml -M en/System.Security.Principal/TokenAccessLevels.xml -M en/System.Security.Principal/GenericPrincipal.xml -M en/System.Diagnostics.SymbolStore/ISymbolBinder1.xml -M en/System.Diagnostics.SymbolStore/ISymbolVariable.xml -M en/System.Diagnostics.SymbolStore/SymAddressKind.xml -M en/System.Diagnostics.SymbolStore/SymLanguageVendor.xml -M en/System.Diagnostics.SymbolStore/ISymbolNamespace.xml -M en/System.Diagnostics.SymbolStore/ISymbolReader.xml -M en/System.Diagnostics.SymbolStore/ISymbolBinder.xml -M en/System.Diagnostics.SymbolStore/SymbolToken.xml -M en/System.Diagnostics.SymbolStore/ISymbolScope.xml -M en/System.Diagnostics.SymbolStore/SymDocumentType.xml -M en/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.xml -M en/System.Diagnostics.SymbolStore/ISymbolWriter.xml -M en/System.Diagnostics.SymbolStore/ISymbolDocument.xml -M en/System.Diagnostics.SymbolStore/SymLanguageType.xml -M en/System.Diagnostics.SymbolStore/ISymbolMethod.xml -M en/System.Runtime.Hosting/ApplicationActivator.xml -M en/System.Runtime.Hosting/ActivationArguments.xml -M en/System.Configuration.Assemblies/AssemblyHash.xml -M en/System.Configuration.Assemblies/AssemblyHashAlgorithm.xml -M en/System.Configuration.Assemblies/AssemblyVersionCompatibility.xml -? en/Microsoft.Win32.SafeHandles/SafeRegistryHandle.xml -M en/Microsoft.Win32.SafeHandles/CriticalHandleMinusOneIsInvalid.xml -M en/Microsoft.Win32.SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.xml -M en/Microsoft.Win32.SafeHandles/SafeFileHandle.xml -M en/Microsoft.Win32.SafeHandles/SafeHandleMinusOneIsInvalid.xml -M en/Microsoft.Win32.SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.xml -M en/Microsoft.Win32.SafeHandles/SafeWaitHandle.xml -? en/System.Runtime.Serialization/SafeSerializationEventArgs.xml -? en/System.Runtime.Serialization/ISafeSerializationData.xml -M en/System.Runtime.Serialization/ISerializationSurrogate.xml -M en/System.Runtime.Serialization/StreamingContextStates.xml -M en/System.Runtime.Serialization/OnDeserializedAttribute.xml -M en/System.Runtime.Serialization/ISurrogateSelector.xml -M en/System.Runtime.Serialization/SerializationInfo.xml -M en/System.Runtime.Serialization/ObjectIDGenerator.xml -M en/System.Runtime.Serialization/FormatterConverter.xml -M en/System.Runtime.Serialization/SerializationInfoEnumerator.xml -M en/System.Runtime.Serialization/SerializationException.xml -M en/System.Runtime.Serialization/IObjectReference.xml -M en/System.Runtime.Serialization/StreamingContext.xml -M en/System.Runtime.Serialization/SerializationEntry.xml -M en/System.Runtime.Serialization/SerializationObjectManager.xml -M en/System.Runtime.Serialization/OnSerializingAttribute.xml -M en/System.Runtime.Serialization/ObjectManager.xml -M en/System.Runtime.Serialization/SerializationBinder.xml -M en/System.Runtime.Serialization/Formatter.xml -M en/System.Runtime.Serialization/IFormatterConverter.xml -M en/System.Runtime.Serialization/FormatterServices.xml -M en/System.Runtime.Serialization/OnDeserializingAttribute.xml -M en/System.Runtime.Serialization/OnSerializedAttribute.xml -M en/System.Runtime.Serialization/IFormatter.xml -M en/System.Runtime.Serialization/IDeserializationCallback.xml -M en/System.Runtime.Serialization/SurrogateSelector.xml -M en/System.Runtime.Serialization/OptionalFieldAttribute.xml -M en/System.Runtime.Serialization/ISerializable.xml -? en/System/Lazy`1.xml -? en/System/Action`3.xml -? en/System/Action`5.xml -? en/System/Action`7.xml -? en/System/Environment+SpecialFolderOption.xml -? en/System/TypeAccessException.xml -? en/System/Func`1.xml -? en/System/Func`3.xml -? en/System/Func`5.xml -? en/System/Func`7.xml -? en/System/Func`9.xml -? en/System/Tuple`1.xml -? en/System/TimeZoneInfo+TransitionTime.xml -? en/System/Tuple`3.xml -? en/System/IObservable`1.xml -? en/System/Tuple`5.xml -? en/System/InsufficientExecutionStackException.xml -? en/System/Tuple`7.xml -? en/System/TimeZoneInfo+AdjustmentRule.xml -? en/System/Action.xml -? en/System/Action`2.xml -? en/System/Action`4.xml -? en/System/Action`6.xml -? en/System/Action`8.xml -? en/System/IObserver`1.xml -? en/System/TimeZoneNotFoundException.xml -? en/System/Func`2.xml -? en/System/Func`4.xml -? en/System/Func`6.xml -? en/System/Func`8.xml -? en/System/Tuple.xml -? en/System/GCNotificationStatus.xml -? en/System/TimeZoneInfo.xml -? en/System/Tuple`2.xml -? en/System/Tuple`4.xml -? en/System/Tuple`6.xml -? en/System/InvalidTimeZoneException.xml -? en/System/Tuple`8.xml -? en/System/AggregateException.xml -M en/System/UnhandledExceptionEventHandler.xml -M en/System/ApplicationException.xml -M en/System/UInt32.xml -M en/System/InvalidOperationException.xml -M en/System/ConsoleKeyInfo.xml -M en/System/Activator.xml -M en/System/Action`1.xml -M en/System/Int32.xml -M en/System/TypeLoadException.xml -M en/System/LoaderOptimizationAttribute.xml -M en/System/ConsoleColor.xml -M en/System/Void.xml -M en/System/Environment.xml -M en/System/NullReferenceException.xml -M en/System/Double.xml -M en/System/AttributeUsageAttribute.xml -M en/System/TypeCode.xml -M en/System/Char.xml -M en/System/IComparable.xml -M en/System/MissingMemberException.xml -M en/System/IndexOutOfRangeException.xml -M en/System/Convert.xml -M en/System/Random.xml -M en/System/TimeSpan.xml -M en/System/BadImageFormatException.xml -M en/System/Predicate`1.xml -M en/System/ArrayTypeMismatchException.xml -M en/System/Version.xml -M en/System/MissingMethodException.xml -M en/System/TimeZone.xml -M en/System/Comparison`1.xml -M en/System/MTAThreadAttribute.xml -M en/System/AttributeTargets.xml -M en/System/InsufficientMemoryException.xml -M en/System/StringComparer.xml -M en/System/ContextBoundObject.xml -M en/System/DateTimeOffset.xml -M en/System/OutOfMemoryException.xml -M en/System/TimeoutException.xml -M en/System/ActivationContext.xml -M en/System/TypeInitializationException.xml -M en/System/MulticastNotSupportedException.xml -M en/System/ObjectDisposedException.xml -M en/System/OverflowException.xml -M en/System/ParamArrayAttribute.xml -M en/System/IServiceProvider.xml -M en/System/IAsyncResult.xml -M en/System/ResolveEventArgs.xml -M en/System/IAppDomainSetup.xml -M en/System/RuntimeFieldHandle.xml -M en/System/SystemException.xml -M en/System/ConsoleModifiers.xml -M en/System/_AppDomain.xml -M en/System/ExecutionEngineException.xml -M en/System/ArithmeticException.xml -M en/System/RankException.xml -M en/System/Environment+SpecialFolder.xml -M en/System/ConsoleSpecialKey.xml -M en/System/EventHandler.xml -M en/System/Boolean.xml -M en/System/InvalidCastException.xml -M en/System/Guid.xml -M en/System/PlatformNotSupportedException.xml -M en/System/MissingFieldException.xml -M en/System/OperatingSystem.xml -M en/System/AssemblyLoadEventArgs.xml -M en/System/ObsoleteAttribute.xml -M en/System/MulticastDelegate.xml -M en/System/EventHandler`1.xml -M en/System/RuntimeMethodHandle.xml -M en/System/PlatformID.xml -M en/System/AppDomainUnloadedException.xml -M en/System/Byte.xml -M en/System/Enum.xml -M en/System/UIntPtr.xml -M en/System/BitConverter.xml -M en/System/CrossAppDomainDelegate.xml -M en/System/FlagsAttribute.xml -M en/System/DBNull.xml -M en/System/ArraySegment`1.xml -M en/System/ArgIterator.xml -M en/System/FieldAccessException.xml -M en/System/Math.xml -M en/System/NonSerializedAttribute.xml -M en/System/SerializableAttribute.xml -M en/System/DateTime.xml -M en/System/Exception.xml -M en/System/OperationCanceledException.xml -M en/System/ThreadStaticAttribute.xml -M en/System/DllNotFoundException.xml -M en/System/AppDomain.xml -M en/System/StackOverflowException.xml -M en/System/GCCollectionMode.xml -M en/System/ActivationContext+ContextForm.xml -M en/System/Delegate.xml -M en/System/ApplicationId.xml -M en/System/EnvironmentVariableTarget.xml -M en/System/Single.xml -M en/System/UnauthorizedAccessException.xml -M en/System/NotSupportedException.xml -M en/System/InvalidProgramException.xml -M en/System/ICloneable.xml -M en/System/StringSplitOptions.xml -M en/System/ModuleHandle.xml -M en/System/RuntimeTypeHandle.xml -M en/System/StringComparison.xml -M en/System/Console.xml -M en/System/DateTimeKind.xml -M en/System/NotImplementedException.xml -M en/System/MarshalByRefObject.xml -M en/System/WeakReference.xml -M en/System/ConsoleCancelEventHandler.xml -M en/System/ContextMarshalException.xml -M en/System/CLSCompliantAttribute.xml -M en/System/TypeUnloadedException.xml -M en/System/Array.xml -M en/System/DayOfWeek.xml -M en/System/ValueType.xml -M en/System/Nullable`1.xml -M en/System/ResolveEventHandler.xml -M en/System/ContextStaticAttribute.xml -M en/System/MethodAccessException.xml -M en/System/Type.xml -M en/System/IConvertible.xml -M en/System/SByte.xml -M en/System/UInt16.xml -M en/System/NotFiniteNumberException.xml -M en/System/MidpointRounding.xml -M en/System/GC.xml -M en/System/AppDomainSetup.xml -M en/System/AsyncCallback.xml -M en/System/ArgumentOutOfRangeException.xml -M en/System/ArgumentNullException.xml -M en/System/IEquatable`1.xml -M en/System/IDisposable.xml -M en/System/UnhandledExceptionEventArgs.xml -M en/System/Int16.xml -M en/System/ArgumentException.xml -M en/System/LocalDataStoreSlot.xml -M en/System/Attribute.xml -M en/System/AppDomainManager.xml -M en/System/AccessViolationException.xml -M en/System/ICustomFormatter.xml -M en/System/IFormattable.xml -M en/System/Buffer.xml -M en/System/ConsoleKey.xml -M en/System/IFormatProvider.xml -M en/System/AppDomainInitializer.xml -M en/System/LoaderOptimization.xml -M en/System/ApplicationIdentity.xml -M en/System/AssemblyLoadEventHandler.xml -M en/System/CharEnumerator.xml -M en/System/IntPtr.xml -M en/System/DataMisalignedException.xml -M en/System/AppDomainManagerInitializationOptions.xml -M en/System/ConsoleCancelEventArgs.xml -M en/System/Converter`2.xml -M en/System/UInt64.xml -M en/System/Base64FormattingOptions.xml -M en/System/CannotUnloadAppDomainException.xml -M en/System/Nullable.xml -M en/System/EventArgs.xml -M en/System/Decimal.xml -M en/System/IComparable`1.xml -M en/System/RuntimeArgumentHandle.xml -M en/System/STAThreadAttribute.xml -M en/System/Int64.xml -M en/System/TypedReference.xml -M en/System/DuplicateWaitObjectException.xml -M en/System/Object.xml -M en/System/String.xml -M en/System/FormatException.xml -M en/System/EntryPointNotFoundException.xml -M en/System/MemberAccessException.xml -M en/System/DivideByZeroException.xml -? en/System.Runtime.InteropServices/SafeBuffer.xml -? en/System.Runtime.InteropServices/AllowReversePInvokeCallsAttribute.xml -M en/System.Runtime.InteropServices/ExporterEventKind.xml -M en/System.Runtime.InteropServices/SafeArrayTypeMismatchException.xml -M en/System.Runtime.InteropServices/TypeLibTypeFlags.xml -M en/System.Runtime.InteropServices/UCOMIEnumString.xml -M en/System.Runtime.InteropServices/InAttribute.xml -M en/System.Runtime.InteropServices/_EventInfo.xml -M en/System.Runtime.InteropServices/_PropertyInfo.xml -M en/System.Runtime.InteropServices/FUNCKIND.xml -M en/System.Runtime.InteropServices/BINDPTR.xml -M en/System.Runtime.InteropServices/UCOMIEnumConnections.xml -M en/System.Runtime.InteropServices/ComCompatibleVersionAttribute.xml -M en/System.Runtime.InteropServices/ITypeLibConverter.xml -M en/System.Runtime.InteropServices/_ILGenerator.xml -M en/System.Runtime.InteropServices/FieldOffsetAttribute.xml -M en/System.Runtime.InteropServices/TYPEDESC.xml -M en/System.Runtime.InteropServices/_Type.xml -M en/System.Runtime.InteropServices/ITypeLibImporterNotifySink.xml -M en/System.Runtime.InteropServices/DefaultCharSetAttribute.xml -M en/System.Runtime.InteropServices/ICustomMarshaler.xml -M en/System.Runtime.InteropServices/_MemberInfo.xml -M en/System.Runtime.InteropServices/ComDefaultInterfaceAttribute.xml -M en/System.Runtime.InteropServices/HandleRef.xml -M en/System.Runtime.InteropServices/ITypeLibExporterNotifySink.xml -M en/System.Runtime.InteropServices/UnmanagedFunctionPointerAttribute.xml -M en/System.Runtime.InteropServices/CurrencyWrapper.xml -M en/System.Runtime.InteropServices/TypeLibVarFlags.xml -M en/System.Runtime.InteropServices/TYPEFLAGS.xml -M en/System.Runtime.InteropServices/SafeArrayRankMismatchException.xml -M en/System.Runtime.InteropServices/UnknownWrapper.xml -M en/System.Runtime.InteropServices/_ConstructorInfo.xml -M en/System.Runtime.InteropServices/ComInterfaceType.xml -M en/System.Runtime.InteropServices/CALLCONV.xml -M en/System.Runtime.InteropServices/TypeLibVersionAttribute.xml -M en/System.Runtime.InteropServices/LCIDConversionAttribute.xml -M en/System.Runtime.InteropServices/AutomationProxyAttribute.xml -M en/System.Runtime.InteropServices/GCHandleType.xml -M en/System.Runtime.InteropServices/OptionalAttribute.xml -M en/System.Runtime.InteropServices/VarEnum.xml -M en/System.Runtime.InteropServices/UCOMIEnumConnectionPoints.xml -M en/System.Runtime.InteropServices/IMPLTYPEFLAGS.xml -M en/System.Runtime.InteropServices/PreserveSigAttribute.xml -M en/System.Runtime.InteropServices/LayoutKind.xml -M en/System.Runtime.InteropServices/CONNECTDATA.xml -M en/System.Runtime.InteropServices/ObjectCreationDelegate.xml -M en/System.Runtime.InteropServices/ITypeLibExporterNameProvider.xml -M en/System.Runtime.InteropServices/ComSourceInterfacesAttribute.xml -M en/System.Runtime.InteropServices/AssemblyRegistrationFlags.xml -M en/System.Runtime.InteropServices/UCOMIBindCtx.xml -M en/System.Runtime.InteropServices/SafeHandle.xml -M en/System.Runtime.InteropServices/PARAMFLAG.xml -M en/System.Runtime.InteropServices/UCOMITypeComp.xml -M en/System.Runtime.InteropServices/_Exception.xml -M en/System.Runtime.InteropServices/_FieldInfo.xml -M en/System.Runtime.InteropServices/TypeLibConverter.xml -M en/System.Runtime.InteropServices/ELEMDESC+DESCUNION.xml -M en/System.Runtime.InteropServices/_CustomAttributeBuilder.xml -M en/System.Runtime.InteropServices/ClassInterfaceAttribute.xml -M en/System.Runtime.InteropServices/ComRegisterFunctionAttribute.xml -M en/System.Runtime.InteropServices/RegistrationServices.xml -M en/System.Runtime.InteropServices/ArrayWithOffset.xml -M en/System.Runtime.InteropServices/ICustomAdapter.xml -M en/System.Runtime.InteropServices/InterfaceTypeAttribute.xml -M en/System.Runtime.InteropServices/DllImportAttribute.xml -M en/System.Runtime.InteropServices/OutAttribute.xml -M en/System.Runtime.InteropServices/InvalidComObjectException.xml -M en/System.Runtime.InteropServices/_ConstructorBuilder.xml -M en/System.Runtime.InteropServices/_ParameterInfo.xml -M en/System.Runtime.InteropServices/COMException.xml -M en/System.Runtime.InteropServices/DispIdAttribute.xml -M en/System.Runtime.InteropServices/DispatchWrapper.xml -M en/System.Runtime.InteropServices/ExternalException.xml -M en/System.Runtime.InteropServices/INVOKEKIND.xml -M en/System.Runtime.InteropServices/IDLFLAG.xml -M en/System.Runtime.InteropServices/MarshalDirectiveException.xml -M en/System.Runtime.InteropServices/StructLayoutAttribute.xml -M en/System.Runtime.InteropServices/_Thread.xml -M en/System.Runtime.InteropServices/RuntimeEnvironment.xml -M en/System.Runtime.InteropServices/ComConversionLossAttribute.xml -M en/System.Runtime.InteropServices/UCOMIRunningObjectTable.xml -M en/System.Runtime.InteropServices/CallingConvention.xml -M en/System.Runtime.InteropServices/_AssemblyName.xml -M en/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.xml -M en/System.Runtime.InteropServices/EXCEPINFO.xml -M en/System.Runtime.InteropServices/SYSKIND.xml -M en/System.Runtime.InteropServices/_AssemblyBuilder.xml -M en/System.Runtime.InteropServices/UCOMIPersistFile.xml -M en/System.Runtime.InteropServices/_TypeBuilder.xml -M en/System.Runtime.InteropServices/UCOMIStream.xml -M en/System.Runtime.InteropServices/STATSTG.xml -M en/System.Runtime.InteropServices/FUNCDESC.xml -M en/System.Runtime.InteropServices/_MethodInfo.xml -M en/System.Runtime.InteropServices/FILETIME.xml -M en/System.Runtime.InteropServices/PARAMDESC.xml -M en/System.Runtime.InteropServices/MarshalAsAttribute.xml -M en/System.Runtime.InteropServices/_Attribute.xml -M en/System.Runtime.InteropServices/DISPPARAMS.xml -M en/System.Runtime.InteropServices/UCOMITypeLib.xml -M en/System.Runtime.InteropServices/TypeLibVarAttribute.xml -M en/System.Runtime.InteropServices/VARFLAGS.xml -M en/System.Runtime.InteropServices/VariantWrapper.xml -M en/System.Runtime.InteropServices/TypeLibFuncAttribute.xml -M en/System.Runtime.InteropServices/ComAliasNameAttribute.xml -M en/System.Runtime.InteropServices/TypeLibExporterFlags.xml -M en/System.Runtime.InteropServices/ComVisibleAttribute.xml -M en/System.Runtime.InteropServices/BIND_OPTS.xml -M en/System.Runtime.InteropServices/TYPEKIND.xml -M en/System.Runtime.InteropServices/SetWin32ContextInIDispatchAttribute.xml -M en/System.Runtime.InteropServices/IRegistrationServices.xml -M en/System.Runtime.InteropServices/VARDESC.xml -M en/System.Runtime.InteropServices/_ModuleBuilder.xml -M en/System.Runtime.InteropServices/ComImportAttribute.xml -M en/System.Runtime.InteropServices/TypeLibFuncFlags.xml -M en/System.Runtime.InteropServices/UnmanagedType.xml -M en/System.Runtime.InteropServices/TYPELIBATTR.xml -M en/System.Runtime.InteropServices/IDLDESC.xml -M en/System.Runtime.InteropServices/ProgIdAttribute.xml -M en/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.xml -M en/System.Runtime.InteropServices/ComMemberType.xml -M en/System.Runtime.InteropServices/VARDESC+DESCUNION.xml -M en/System.Runtime.InteropServices/_MethodBase.xml -M en/System.Runtime.InteropServices/CoClassAttribute.xml -M en/System.Runtime.InteropServices/ICustomFactory.xml -M en/System.Runtime.InteropServices/IDispatchImplAttribute.xml -M en/System.Runtime.InteropServices/ExtensibleClassFactory.xml -M en/System.Runtime.InteropServices/ELEMDESC.xml -M en/System.Runtime.InteropServices/LIBFLAGS.xml -M en/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.xml -M en/System.Runtime.InteropServices/_Module.xml -M en/System.Runtime.InteropServices/UCOMIEnumVARIANT.xml -M en/System.Runtime.InteropServices/_ParameterBuilder.xml -M en/System.Runtime.InteropServices/Marshal.xml -M en/System.Runtime.InteropServices/_EventBuilder.xml -M en/System.Runtime.InteropServices/_FieldBuilder.xml -M en/System.Runtime.InteropServices/ErrorWrapper.xml -M en/System.Runtime.InteropServices/_Activator.xml -M en/System.Runtime.InteropServices/RegistrationConnectionType.xml -M en/System.Runtime.InteropServices/IDispatchImplType.xml -M en/System.Runtime.InteropServices/SEHException.xml -M en/System.Runtime.InteropServices/_LocalBuilder.xml -M en/System.Runtime.InteropServices/RegistrationClassContext.xml -M en/System.Runtime.InteropServices/GCHandle.xml -M en/System.Runtime.InteropServices/UCOMIConnectionPoint.xml -M en/System.Runtime.InteropServices/CriticalHandle.xml -M en/System.Runtime.InteropServices/FUNCFLAGS.xml -M en/System.Runtime.InteropServices/ImporterEventKind.xml -M en/System.Runtime.InteropServices/_EnumBuilder.xml -M en/System.Runtime.InteropServices/TypeLibImportClassAttribute.xml -M en/System.Runtime.InteropServices/_Assembly.xml -M en/System.Runtime.InteropServices/DESCKIND.xml -M en/System.Runtime.InteropServices/ComEventInterfaceAttribute.xml -M en/System.Runtime.InteropServices/_MethodRental.xml -M en/System.Runtime.InteropServices/UCOMIEnumMoniker.xml -M en/System.Runtime.InteropServices/_MethodBuilder.xml -M en/System.Runtime.InteropServices/ClassInterfaceType.xml -M en/System.Runtime.InteropServices/CharSet.xml -M en/System.Runtime.InteropServices/UCOMITypeInfo.xml -M en/System.Runtime.InteropServices/_PropertyBuilder.xml -M en/System.Runtime.InteropServices/InvalidOleVariantTypeException.xml -M en/System.Runtime.InteropServices/TypeLibTypeAttribute.xml -M en/System.Runtime.InteropServices/BestFitMappingAttribute.xml -M en/System.Runtime.InteropServices/_SignatureHelper.xml -M en/System.Runtime.InteropServices/UCOMIMoniker.xml -M en/System.Runtime.InteropServices/TypeLibImporterFlags.xml -M en/System.Runtime.InteropServices/UCOMIConnectionPointContainer.xml -M en/System.Runtime.InteropServices/BStrWrapper.xml -M en/System.Runtime.InteropServices/TYPEATTR.xml -M en/System.Runtime.InteropServices/GuidAttribute.xml -M en/System.Runtime.Remoting.Activation/ActivatorLevel.xml -M en/System.Runtime.Remoting.Activation/IConstructionCallMessage.xml -M en/System.Runtime.Remoting.Activation/IActivator.xml -M en/System.Runtime.Remoting.Activation/UrlAttribute.xml -M en/System.Runtime.Remoting.Activation/IConstructionReturnMessage.xml -M en/System.Resources/ResourceManager.xml -M en/System.Resources/IResourceReader.xml -M en/System.Resources/ResourceSet.xml -M en/System.Resources/ResourceWriter.xml -M en/System.Resources/UltimateResourceFallbackLocation.xml -M en/System.Resources/MissingManifestResourceException.xml -M en/System.Resources/ResourceReader.xml -M en/System.Resources/IResourceWriter.xml -M en/System.Resources/NeutralResourcesLanguageAttribute.xml -M en/System.Resources/SatelliteContractVersionAttribute.xml -M en/System.Resources/MissingSatelliteAssemblyException.xml -M en/System.Runtime.Remoting.Contexts/IContributeClientContextSink.xml -M en/System.Runtime.Remoting.Contexts/IContextAttribute.xml -M en/System.Runtime.Remoting.Contexts/IContributeDynamicSink.xml -M en/System.Runtime.Remoting.Contexts/Context.xml -M en/System.Runtime.Remoting.Contexts/SynchronizationAttribute.xml -M en/System.Runtime.Remoting.Contexts/IDynamicMessageSink.xml -M en/System.Runtime.Remoting.Contexts/ContextProperty.xml -M en/System.Runtime.Remoting.Contexts/CrossContextDelegate.xml -M en/System.Runtime.Remoting.Contexts/IContributeEnvoySink.xml -M en/System.Runtime.Remoting.Contexts/IContextProperty.xml -M en/System.Runtime.Remoting.Contexts/IDynamicProperty.xml -M en/System.Runtime.Remoting.Contexts/IContributeObjectSink.xml -M en/System.Runtime.Remoting.Contexts/ContextAttribute.xml -M en/System.Runtime.Remoting.Contexts/IContributeServerContextSink.xml -M en/System.Runtime.Remoting.Contexts/IContextPropertyActivator.xml -? en/System.Collections/StructuralComparisons.xml -? en/System.Collections/IStructuralEquatable.xml -? en/System.Collections/IStructuralComparable.xml -M en/System.Collections/IDictionaryEnumerator.xml -M en/System.Collections/IComparer.xml -M en/System.Collections/IList.xml -M en/System.Collections/Queue.xml -M en/System.Collections/ReadOnlyCollectionBase.xml -M en/System.Collections/CaseInsensitiveComparer.xml -M en/System.Collections/CollectionBase.xml -M en/System.Collections/DictionaryEntry.xml -M en/System.Collections/IEnumerable.xml -M en/System.Collections/IEnumerator.xml -M en/System.Collections/Hashtable.xml -M en/System.Collections/SortedList.xml -M en/System.Collections/IEqualityComparer.xml -M en/System.Collections/DictionaryBase.xml -M en/System.Collections/IHashCodeProvider.xml -M en/System.Collections/ICollection.xml -M en/System.Collections/Stack.xml -M en/System.Collections/CaseInsensitiveHashCodeProvider.xml -M en/System.Collections/Comparer.xml -M en/System.Collections/ArrayList.xml -M en/System.Collections/BitArray.xml -M en/System.Collections/IDictionary.xml -M en/System.Runtime.ConstrainedExecution/Consistency.xml -M en/System.Runtime.ConstrainedExecution/CriticalFinalizerObject.xml -M en/System.Runtime.ConstrainedExecution/Cer.xml -M en/System.Runtime.ConstrainedExecution/PrePrepareMethodAttribute.xml -M en/System.Runtime.ConstrainedExecution/ReliabilityContractAttribute.xml -M en/System.Diagnostics.CodeAnalysis/SuppressMessageAttribute.xml -M en/System.Reflection.Emit/TypeToken.xml -M en/System.Reflection.Emit/MethodRental.xml -M en/System.Reflection.Emit/AssemblyBuilder.xml -M en/System.Reflection.Emit/TypeBuilder.xml -M en/System.Reflection.Emit/OperandType.xml -M en/System.Reflection.Emit/OpCodes.xml -M en/System.Reflection.Emit/ConstructorBuilder.xml -M en/System.Reflection.Emit/PackingSize.xml -M en/System.Reflection.Emit/StringToken.xml -M en/System.Reflection.Emit/OpCode.xml -M en/System.Reflection.Emit/StackBehaviour.xml -M en/System.Reflection.Emit/EnumBuilder.xml -M en/System.Reflection.Emit/ILGenerator.xml -M en/System.Reflection.Emit/ParameterToken.xml -M en/System.Reflection.Emit/MethodToken.xml -M en/System.Reflection.Emit/EventToken.xml -M en/System.Reflection.Emit/FieldToken.xml -M en/System.Reflection.Emit/PropertyToken.xml -M en/System.Reflection.Emit/DynamicILInfo.xml -M en/System.Reflection.Emit/DynamicMethod.xml -M en/System.Reflection.Emit/GenericTypeParameterBuilder.xml -M en/System.Reflection.Emit/ParameterBuilder.xml -M en/System.Reflection.Emit/MethodBuilder.xml -M en/System.Reflection.Emit/EventBuilder.xml -M en/System.Reflection.Emit/FieldBuilder.xml -M en/System.Reflection.Emit/PropertyBuilder.xml -M en/System.Reflection.Emit/ModuleBuilder.xml -M en/System.Reflection.Emit/PEFileKinds.xml -M en/System.Reflection.Emit/SignatureHelper.xml -M en/System.Reflection.Emit/LocalBuilder.xml -M en/System.Reflection.Emit/SignatureToken.xml -M en/System.Reflection.Emit/CustomAttributeBuilder.xml -M en/System.Reflection.Emit/UnmanagedMarshal.xml -M en/System.Reflection.Emit/AssemblyBuilderAccess.xml -M en/System.Reflection.Emit/FlowControl.xml -M en/System.Reflection.Emit/OpCodeType.xml -M en/System.Reflection.Emit/Label.xml -M en/System.Collections.Generic/IEqualityComparer`1.xml -M en/System.Collections.Generic/KeyValuePair`2.xml -M en/System.Collections.Generic/KeyNotFoundException.xml -M en/System.Collections.Generic/ICollection`1.xml -M en/System.Collections.Generic/Dictionary`2.xml -M en/System.Collections.Generic/Dictionary`2+KeyCollection.xml -M en/System.Collections.Generic/Dictionary`2+ValueCollection+Enumerator.xml -M en/System.Collections.Generic/Comparer`1.xml -M en/System.Collections.Generic/List`1.xml -M en/System.Collections.Generic/IDictionary`2.xml -M en/System.Collections.Generic/IComparer`1.xml -M en/System.Collections.Generic/Dictionary`2+KeyCollection+Enumerator.xml -M en/System.Collections.Generic/Dictionary`2+Enumerator.xml -M en/System.Collections.Generic/IList`1.xml -M en/System.Collections.Generic/EqualityComparer`1.xml -M en/System.Collections.Generic/IEnumerable`1.xml -M en/System.Collections.Generic/List`1+Enumerator.xml -M en/System.Collections.Generic/IEnumerator`1.xml -M en/System.Collections.Generic/Dictionary`2+ValueCollection.xml -M en/System.Deployment.Internal/InternalActivationContextHelper.xml -M en/System.Deployment.Internal/InternalApplicationIdentityHelper.xml -? en/System.Globalization/TimeSpanStyles.xml -? en/System.Globalization/CultureNotFoundException.xml -M en/System.Globalization/JapaneseCalendar.xml -M en/System.Globalization/DateTimeFormatInfo.xml -M en/System.Globalization/CalendarAlgorithmType.xml -M en/System.Globalization/DaylightTime.xml -M en/System.Globalization/UnicodeCategory.xml -M en/System.Globalization/IdnMapping.xml -M en/System.Globalization/HijriCalendar.xml -M en/System.Globalization/CultureInfo.xml -M en/System.Globalization/TextElementEnumerator.xml -M en/System.Globalization/KoreanLunisolarCalendar.xml -M en/System.Globalization/DigitShapes.xml -M en/System.Globalization/TaiwanLunisolarCalendar.xml -M en/System.Globalization/GregorianCalendar.xml -M en/System.Globalization/KoreanCalendar.xml -M en/System.Globalization/JapaneseLunisolarCalendar.xml -M en/System.Globalization/TaiwanCalendar.xml -M en/System.Globalization/CalendarWeekRule.xml -M en/System.Globalization/UmAlQuraCalendar.xml -M en/System.Globalization/StringInfo.xml -M en/System.Globalization/PersianCalendar.xml -M en/System.Globalization/EastAsianLunisolarCalendar.xml -M en/System.Globalization/NumberStyles.xml -M en/System.Globalization/GregorianCalendarTypes.xml -M en/System.Globalization/RegionInfo.xml -M en/System.Globalization/SortKey.xml -M en/System.Globalization/CharUnicodeInfo.xml -M en/System.Globalization/DateTimeStyles.xml -M en/System.Globalization/TextInfo.xml -M en/System.Globalization/ChineseLunisolarCalendar.xml -M en/System.Globalization/CompareInfo.xml -M en/System.Globalization/CompareOptions.xml -M en/System.Globalization/HebrewCalendar.xml -M en/System.Globalization/ThaiBuddhistCalendar.xml -M en/System.Globalization/CultureTypes.xml -M en/System.Globalization/Calendar.xml -M en/System.Globalization/JulianCalendar.xml -M en/System.Globalization/NumberFormatInfo.xml -M en/System.Runtime.Remoting.Channels/IClientChannelSinkProvider.xml -M en/System.Runtime.Remoting.Channels/IChannel.xml -M en/System.Runtime.Remoting.Channels/ClientChannelSinkStack.xml -M en/System.Runtime.Remoting.Channels/IChannelSender.xml -M en/System.Runtime.Remoting.Channels/IServerChannelSinkStack.xml -M en/System.Runtime.Remoting.Channels/IChannelReceiverHook.xml -M en/System.Runtime.Remoting.Channels/TransportHeaders.xml -M en/System.Runtime.Remoting.Channels/IChannelDataStore.xml -M en/System.Runtime.Remoting.Channels/IClientChannelSinkStack.xml -M en/System.Runtime.Remoting.Channels/IServerChannelSink.xml -M en/System.Runtime.Remoting.Channels/IClientFormatterSink.xml -M en/System.Runtime.Remoting.Channels/ITransportHeaders.xml -M en/System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.xml -M en/System.Runtime.Remoting.Channels/IChannelSinkBase.xml -M en/System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.xml -M en/System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.xml -M en/System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.xml -M en/System.Runtime.Remoting.Channels/ServerProcessing.xml -M en/System.Runtime.Remoting.Channels/IClientChannelSink.xml -M en/System.Runtime.Remoting.Channels/IChannelReceiver.xml -M en/System.Runtime.Remoting.Channels/ISecurableChannel.xml -M en/System.Runtime.Remoting.Channels/IServerChannelSinkProvider.xml -M en/System.Runtime.Remoting.Channels/SinkProviderData.xml -M en/System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.xml -M en/System.Runtime.Remoting.Channels/ServerChannelSinkStack.xml -M en/System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.xml -M en/System.Runtime.Remoting.Channels/ChannelServices.xml -M en/System.Runtime.Remoting.Channels/BaseChannelWithProperties.xml -M en/System.Runtime.Remoting.Channels/ChannelDataStore.xml -M en/System.Collections.ObjectModel/ReadOnlyCollection`1.xml -M en/System.Collections.ObjectModel/Collection`1.xml -M en/System.Collections.ObjectModel/KeyedCollection`2.xml -M en/System.Diagnostics/StackFrame.xml -M en/System.Diagnostics/DebuggableAttribute+DebuggingModes.xml -M en/System.Diagnostics/Debugger.xml -M en/System.Diagnostics/DebuggerHiddenAttribute.xml -M en/System.Diagnostics/StackTrace.xml -M en/System.Diagnostics/DebuggerBrowsableState.xml -M en/System.Diagnostics/DebuggerVisualizerAttribute.xml -M en/System.Diagnostics/ConditionalAttribute.xml -M en/System.Diagnostics/DebuggerDisplayAttribute.xml -M en/System.Diagnostics/DebuggableAttribute.xml -M en/System.Diagnostics/DebuggerStepThroughAttribute.xml -M en/System.Diagnostics/DebuggerBrowsableAttribute.xml -M en/System.Diagnostics/DebuggerTypeProxyAttribute.xml -M en/System.Diagnostics/DebuggerNonUserCodeAttribute.xml -M en/System.Diagnostics/DebuggerStepperBoundaryAttribute.xml -M en/System.Runtime.InteropServices.ComTypes/IMPLTYPEFLAGS.xml -M en/System.Runtime.InteropServices.ComTypes/EXCEPINFO.xml -M en/System.Runtime.InteropServices.ComTypes/ELEMDESC.xml -M en/System.Runtime.InteropServices.ComTypes/CONNECTDATA.xml -M en/System.Runtime.InteropServices.ComTypes/LIBFLAGS.xml -M en/System.Runtime.InteropServices.ComTypes/SYSKIND.xml -M en/System.Runtime.InteropServices.ComTypes/IConnectionPointContainer.xml -M en/System.Runtime.InteropServices.ComTypes/ITypeInfo2.xml -M en/System.Runtime.InteropServices.ComTypes/IRunningObjectTable.xml -M en/System.Runtime.InteropServices.ComTypes/STATSTG.xml -M en/System.Runtime.InteropServices.ComTypes/IEnumConnectionPoints.xml -M en/System.Runtime.InteropServices.ComTypes/FUNCDESC.xml -M en/System.Runtime.InteropServices.ComTypes/PARAMFLAG.xml -M en/System.Runtime.InteropServices.ComTypes/FILETIME.xml -M en/System.Runtime.InteropServices.ComTypes/PARAMDESC.xml -M en/System.Runtime.InteropServices.ComTypes/FUNCKIND.xml -M en/System.Runtime.InteropServices.ComTypes/IPersistFile.xml -M en/System.Runtime.InteropServices.ComTypes/IEnumVARIANT.xml -M en/System.Runtime.InteropServices.ComTypes/BINDPTR.xml -M en/System.Runtime.InteropServices.ComTypes/DISPPARAMS.xml -M en/System.Runtime.InteropServices.ComTypes/ITypeLib2.xml -M en/System.Runtime.InteropServices.ComTypes/IStream.xml -M en/System.Runtime.InteropServices.ComTypes/IEnumString.xml -M en/System.Runtime.InteropServices.ComTypes/ELEMDESC+DESCUNION.xml -M en/System.Runtime.InteropServices.ComTypes/IBindCtx.xml -M en/System.Runtime.InteropServices.ComTypes/VARFLAGS.xml -M en/System.Runtime.InteropServices.ComTypes/FUNCFLAGS.xml -M en/System.Runtime.InteropServices.ComTypes/ITypeComp.xml -M en/System.Runtime.InteropServices.ComTypes/IEnumConnections.xml -M en/System.Runtime.InteropServices.ComTypes/TYPEDESC.xml -M en/System.Runtime.InteropServices.ComTypes/BIND_OPTS.xml -M en/System.Runtime.InteropServices.ComTypes/ITypeLib.xml -M en/System.Runtime.InteropServices.ComTypes/IConnectionPoint.xml -M en/System.Runtime.InteropServices.ComTypes/DESCKIND.xml -M en/System.Runtime.InteropServices.ComTypes/TYPEKIND.xml -M en/System.Runtime.InteropServices.ComTypes/VARDESC.xml -M en/System.Runtime.InteropServices.ComTypes/TYPEFLAGS.xml -M en/System.Runtime.InteropServices.ComTypes/VARKIND.xml -M en/System.Runtime.InteropServices.ComTypes/INVOKEKIND.xml -M en/System.Runtime.InteropServices.ComTypes/CALLCONV.xml -M en/System.Runtime.InteropServices.ComTypes/IEnumMoniker.xml -M en/System.Runtime.InteropServices.ComTypes/IDLFLAG.xml -M en/System.Runtime.InteropServices.ComTypes/TYPELIBATTR.xml -M en/System.Runtime.InteropServices.ComTypes/ITypeInfo.xml -M en/System.Runtime.InteropServices.ComTypes/IDLDESC.xml -M en/System.Runtime.InteropServices.ComTypes/VARDESC+DESCUNION.xml -M en/System.Runtime.InteropServices.ComTypes/TYPEATTR.xml -M en/System.Runtime.InteropServices.ComTypes/IMoniker.xml -M en/index.xml -M en/System.Text/DecoderFallback.xml -M en/System.Text/Encoding.xml -M en/System.Text/EncoderFallbackBuffer.xml -M en/System.Text/UTF7Encoding.xml -M en/System.Text/UTF8Encoding.xml -M en/System.Text/UnicodeEncoding.xml -M en/System.Text/DecoderExceptionFallbackBuffer.xml -M en/System.Text/EncoderFallback.xml -M en/System.Text/DecoderReplacementFallbackBuffer.xml -M en/System.Text/ASCIIEncoding.xml -M en/System.Text/EncodingInfo.xml -M en/System.Text/DecoderFallbackException.xml -M en/System.Text/DecoderExceptionFallback.xml -M en/System.Text/DecoderReplacementFallback.xml -M en/System.Text/Decoder.xml -M en/System.Text/EncoderExceptionFallbackBuffer.xml -M en/System.Text/EncoderReplacementFallbackBuffer.xml -M en/System.Text/NormalizationForm.xml -M en/System.Text/UTF32Encoding.xml -M en/System.Text/StringBuilder.xml -M en/System.Text/EncoderFallbackException.xml -M en/System.Text/EncoderExceptionFallback.xml -M en/System.Text/EncoderReplacementFallback.xml -M en/System.Text/Encoder.xml -M en/System.Text/DecoderFallbackBuffer.xml -M en/System.Runtime.Remoting.Metadata/SoapAttribute.xml -M en/System.Runtime.Remoting.Metadata/SoapMethodAttribute.xml -M en/System.Runtime.Remoting.Metadata/SoapParameterAttribute.xml -M en/System.Runtime.Remoting.Metadata/SoapTypeAttribute.xml -M en/System.Runtime.Remoting.Metadata/XmlFieldOrderOption.xml -M en/System.Runtime.Remoting.Metadata/SoapFieldAttribute.xml -M en/System.Runtime.Remoting.Metadata/SoapOption.xml -M en/System.Security.Cryptography.X509Certificates/X509KeyStorageFlags.xml -M en/System.Security.Cryptography.X509Certificates/X509ContentType.xml -M en/System.Security.Cryptography.X509Certificates/X509Certificate.xml -M en/System.Runtime.Remoting.Proxies/ProxyAttribute.xml -M en/System.Runtime.Remoting.Proxies/RealProxy.xml -? en/System.IO.IsolatedStorage/IsolatedStorageSecurityState.xml -? en/System.IO.IsolatedStorage/IsolatedStorageSecurityOptions.xml -M en/System.IO.IsolatedStorage/IsolatedStorageScope.xml -M en/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml -M en/System.IO.IsolatedStorage/IsolatedStorageException.xml -M en/System.IO.IsolatedStorage/IsolatedStorage.xml -M en/System.IO.IsolatedStorage/IsolatedStorageFile.xml -M en/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.xml -? en/System.Runtime.CompilerServices/ConditionalWeakTable`2.xml -? en/System.Runtime.CompilerServices/ReferenceAssemblyAttribute.xml -? en/System.Runtime.CompilerServices/TypeForwardedFromAttribute.xml -? en/System.Runtime.CompilerServices/ConditionalWeakTable`2+CreateValueCallback.xml -M en/System.Runtime.CompilerServices/DiscardableAttribute.xml -M en/System.Runtime.CompilerServices/IsConst.xml -M en/System.Runtime.CompilerServices/IndexerNameAttribute.xml -M en/System.Runtime.CompilerServices/RuntimeWrappedException.xml -M en/System.Runtime.CompilerServices/MethodImplAttribute.xml -M en/System.Runtime.CompilerServices/CompilationRelaxations.xml -M en/System.Runtime.CompilerServices/DateTimeConstantAttribute.xml -M en/System.Runtime.CompilerServices/IsLong.xml -M en/System.Runtime.CompilerServices/LoadHint.xml -M en/System.Runtime.CompilerServices/IsByValue.xml -M en/System.Runtime.CompilerServices/NativeCppClassAttribute.xml -M en/System.Runtime.CompilerServices/InternalsVisibleToAttribute.xml -M en/System.Runtime.CompilerServices/IUnknownConstantAttribute.xml -M en/System.Runtime.CompilerServices/TypeForwardedToAttribute.xml -M en/System.Runtime.CompilerServices/IsImplicitlyDereferenced.xml -M en/System.Runtime.CompilerServices/DefaultDependencyAttribute.xml -M en/System.Runtime.CompilerServices/CallConvStdcall.xml -M en/System.Runtime.CompilerServices/CompilerGlobalScopeAttribute.xml -M en/System.Runtime.CompilerServices/ScopelessEnumAttribute.xml -M en/System.Runtime.CompilerServices/CallConvFastcall.xml -M en/System.Runtime.CompilerServices/RuntimeHelpers+TryCode.xml -M en/System.Runtime.CompilerServices/CompilationRelaxationsAttribute.xml -M en/System.Runtime.CompilerServices/IsExplicitlyDereferenced.xml -M en/System.Runtime.CompilerServices/MethodImplOptions.xml -M en/System.Runtime.CompilerServices/CompilerMarshalOverride.xml -M en/System.Runtime.CompilerServices/IsCopyConstructed.xml -M en/System.Runtime.CompilerServices/RuntimeHelpers+CleanupCode.xml -M en/System.Runtime.CompilerServices/StringFreezingAttribute.xml -M en/System.Runtime.CompilerServices/CallConvThiscall.xml -M en/System.Runtime.CompilerServices/FixedAddressValueTypeAttribute.xml -M en/System.Runtime.CompilerServices/IsUdtReturn.xml -M en/System.Runtime.CompilerServices/RequiredAttributeAttribute.xml -M en/System.Runtime.CompilerServices/CallConvCdecl.xml -M en/System.Runtime.CompilerServices/DecimalConstantAttribute.xml -M en/System.Runtime.CompilerServices/IsBoxed.xml -M en/System.Runtime.CompilerServices/IsSignUnspecifiedByte.xml -M en/System.Runtime.CompilerServices/HasCopySemanticsAttribute.xml -M en/System.Runtime.CompilerServices/RuntimeCompatibilityAttribute.xml -M en/System.Runtime.CompilerServices/DependencyAttribute.xml -M en/System.Runtime.CompilerServices/SuppressIldasmAttribute.xml -M en/System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.xml -M en/System.Runtime.CompilerServices/UnsafeValueTypeAttribute.xml -M en/System.Runtime.CompilerServices/IsJitIntrinsic.xml -M en/System.Runtime.CompilerServices/SpecialNameAttribute.xml -M en/System.Runtime.CompilerServices/IDispatchConstantAttribute.xml -M en/System.Runtime.CompilerServices/RuntimeHelpers.xml -M en/System.Runtime.CompilerServices/CustomConstantAttribute.xml -M en/System.Runtime.CompilerServices/IsPinned.xml -M en/System.Runtime.CompilerServices/IsVolatile.xml -M en/System.Runtime.CompilerServices/FixedBufferAttribute.xml -M en/System.Runtime.CompilerServices/CompilerGeneratedAttribute.xml -M en/System.Runtime.CompilerServices/MethodCodeType.xml -? en/System.Security.Cryptography/Aes.xml -M en/System.Security.Cryptography/MD5CryptoServiceProvider.xml -M en/System.Security.Cryptography/RIPEMD160Managed.xml -M en/System.Security.Cryptography/RC2.xml -M en/System.Security.Cryptography/TripleDESCryptoServiceProvider.xml -M en/System.Security.Cryptography/RSAOAEPKeyExchangeFormatter.xml -M en/System.Security.Cryptography/CryptographicException.xml -M en/System.Security.Cryptography/HMACSHA384.xml -M en/System.Security.Cryptography/KeySizes.xml -M en/System.Security.Cryptography/DSA.xml -M en/System.Security.Cryptography/PasswordDeriveBytes.xml -M en/System.Security.Cryptography/MaskGenerationMethod.xml -M en/System.Security.Cryptography/KeyedHashAlgorithm.xml -M en/System.Security.Cryptography/RSA.xml -M en/System.Security.Cryptography/ICryptoTransform.xml -M en/System.Security.Cryptography/HMACSHA1.xml -M en/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.xml -M en/System.Security.Cryptography/Rijndael.xml -M en/System.Security.Cryptography/SHA1CryptoServiceProvider.xml -M en/System.Security.Cryptography/HashAlgorithm.xml -M en/System.Security.Cryptography/TripleDES.xml -M en/System.Security.Cryptography/HMACSHA512.xml -M en/System.Security.Cryptography/SHA1.xml -M en/System.Security.Cryptography/RandomNumberGenerator.xml -M en/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatter.xml -M en/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter.xml -M en/System.Security.Cryptography/CryptographicUnexpectedOperationException.xml -M en/System.Security.Cryptography/FromBase64Transform.xml -M en/System.Security.Cryptography/SignatureDescription.xml -M en/System.Security.Cryptography/CryptoAPITransform.xml -M en/System.Security.Cryptography/RIPEMD160.xml -M en/System.Security.Cryptography/DESCryptoServiceProvider.xml -M en/System.Security.Cryptography/SHA256.xml -M en/System.Security.Cryptography/PKCS1MaskGenerationMethod.xml -M en/System.Security.Cryptography/Rfc2898DeriveBytes.xml -M en/System.Security.Cryptography/CspKeyContainerInfo.xml -M en/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.xml -M en/System.Security.Cryptography/HMACMD5.xml -M en/System.Security.Cryptography/SHA512Managed.xml -M en/System.Security.Cryptography/RSACryptoServiceProvider.xml -M en/System.Security.Cryptography/RNGCryptoServiceProvider.xml -M en/System.Security.Cryptography/RC2CryptoServiceProvider.xml -M en/System.Security.Cryptography/SymmetricAlgorithm.xml -M en/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatter.xml -M en/System.Security.Cryptography/SHA384Managed.xml -M en/System.Security.Cryptography/DSAParameters.xml -M en/System.Security.Cryptography/CryptoStream.xml -M en/System.Security.Cryptography/AsymmetricSignatureDeformatter.xml -M en/System.Security.Cryptography/HMACRIPEMD160.xml -M en/System.Security.Cryptography/RijndaelManagedTransform.xml -M en/System.Security.Cryptography/KeyNumber.xml -M en/System.Security.Cryptography/RijndaelManaged.xml -M en/System.Security.Cryptography/RSAPKCS1SignatureDeformatter.xml -M en/System.Security.Cryptography/HMAC.xml -M en/System.Security.Cryptography/RSAParameters.xml -M en/System.Security.Cryptography/CspParameters.xml -M en/System.Security.Cryptography/FromBase64TransformMode.xml -M en/System.Security.Cryptography/SHA1Managed.xml -M en/System.Security.Cryptography/SHA384.xml -M en/System.Security.Cryptography/PaddingMode.xml -M en/System.Security.Cryptography/DES.xml -M en/System.Security.Cryptography/CipherMode.xml -M en/System.Security.Cryptography/AsymmetricSignatureFormatter.xml -M en/System.Security.Cryptography/ToBase64Transform.xml -M en/System.Security.Cryptography/AsymmetricAlgorithm.xml -M en/System.Security.Cryptography/MD5.xml -M en/System.Security.Cryptography/DeriveBytes.xml -M en/System.Security.Cryptography/SHA256Managed.xml -M en/System.Security.Cryptography/DSASignatureDeformatter.xml -M en/System.Security.Cryptography/RSAPKCS1SignatureFormatter.xml -M en/System.Security.Cryptography/CryptoStreamMode.xml -M en/System.Security.Cryptography/HMACSHA256.xml -M en/System.Security.Cryptography/ICspAsymmetricAlgorithm.xml -M en/System.Security.Cryptography/SHA512.xml -M en/System.Security.Cryptography/DSACryptoServiceProvider.xml -M en/System.Security.Cryptography/CryptoConfig.xml -M en/System.Security.Cryptography/MACTripleDES.xml -M en/System.Security.Cryptography/CspProviderFlags.xml -M en/System.Security.Cryptography/DSASignatureFormatter.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapYear.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapQName.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNcName.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/ISoapXsd.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapAnyUri.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNmtoken.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapEntity.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDay.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapToken.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNegativeInteger.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapName.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapMonthDay.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapLanguage.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDuration.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapIdref.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapBase64Binary.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNonNegativeInteger.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNotation.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDateTime.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapInteger.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNmtokens.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapTime.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapYearMonth.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapIdrefs.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDate.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapPositiveInteger.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapEntities.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapMonth.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinary.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNonPositiveInteger.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNormalizedString.xml -M en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapId.xml -M en/System.Runtime.Remoting.Lifetime/ClientSponsor.xml -M en/System.Runtime.Remoting.Lifetime/ILease.xml -M en/System.Runtime.Remoting.Lifetime/LifetimeServices.xml -M en/System.Runtime.Remoting.Lifetime/LeaseState.xml -M en/System.Runtime.Remoting.Lifetime/ISponsor.xml -M en/System.Security.Policy/PublisherMembershipCondition.xml -M en/System.Security.Policy/ApplicationTrustCollection.xml -M en/System.Security.Policy/Evidence.xml -M en/System.Security.Policy/Hash.xml -M en/System.Security.Policy/PolicyStatement.xml -M en/System.Security.Policy/UrlMembershipCondition.xml -M en/System.Security.Policy/ApplicationSecurityManager.xml -M en/System.Security.Policy/ApplicationVersionMatch.xml -M en/System.Security.Policy/SiteMembershipCondition.xml -M en/System.Security.Policy/CodeGroup.xml -M en/System.Security.Policy/FileCodeGroup.xml -M en/System.Security.Policy/ApplicationDirectory.xml -M en/System.Security.Policy/ZoneMembershipCondition.xml -M en/System.Security.Policy/UnionCodeGroup.xml -M en/System.Security.Policy/Url.xml -M en/System.Security.Policy/Site.xml -M en/System.Security.Policy/ApplicationTrust.xml -M en/System.Security.Policy/HashMembershipCondition.xml -M en/System.Security.Policy/CodeConnectAccess.xml -M en/System.Security.Policy/ApplicationSecurityInfo.xml -M en/System.Security.Policy/ApplicationTrustEnumerator.xml -M en/System.Security.Policy/PolicyStatementAttribute.xml -M en/System.Security.Policy/IApplicationTrustManager.xml -M en/System.Security.Policy/IMembershipCondition.xml -M en/System.Security.Policy/FirstMatchCodeGroup.xml -M en/System.Security.Policy/StrongName.xml -M en/System.Security.Policy/PolicyException.xml -M en/System.Security.Policy/TrustManagerUIContext.xml -M en/System.Security.Policy/TrustManagerContext.xml -M en/System.Security.Policy/PolicyLevel.xml -M en/System.Security.Policy/GacInstalled.xml -M en/System.Security.Policy/AllMembershipCondition.xml -M en/System.Security.Policy/Publisher.xml -M en/System.Security.Policy/NetCodeGroup.xml -M en/System.Security.Policy/StrongNameMembershipCondition.xml -M en/System.Security.Policy/IIdentityPermissionFactory.xml -M en/System.Security.Policy/PermissionRequestEvidence.xml -M en/System.Security.Policy/ApplicationDirectoryMembershipCondition.xml -M en/System.Security.Policy/Zone.xml -M en/System.Security.Policy/GacMembershipCondition.xml -M en/System.Runtime.Remoting/ObjectHandle.xml -M en/System.Runtime.Remoting/ServerException.xml -M en/System.Runtime.Remoting/InternalRemotingServices.xml -M en/System.Runtime.Remoting/IEnvoyInfo.xml -M en/System.Runtime.Remoting/WellKnownServiceTypeEntry.xml -M en/System.Runtime.Remoting/ActivatedClientTypeEntry.xml -M en/System.Runtime.Remoting/RemotingServices.xml -M en/System.Runtime.Remoting/IObjectHandle.xml -M en/System.Runtime.Remoting/IChannelInfo.xml -M en/System.Runtime.Remoting/CustomErrorsModes.xml -M en/System.Runtime.Remoting/RemotingException.xml -M en/System.Runtime.Remoting/TypeEntry.xml -M en/System.Runtime.Remoting/WellKnownClientTypeEntry.xml -M en/System.Runtime.Remoting/SoapServices.xml -M en/System.Runtime.Remoting/ObjRef.xml -M en/System.Runtime.Remoting/ActivatedServiceTypeEntry.xml -M en/System.Runtime.Remoting/RemotingTimeoutException.xml -M en/System.Runtime.Remoting/IRemotingTypeInfo.xml -M en/System.Runtime.Remoting/RemotingConfiguration.xml -M en/System.Runtime.Remoting/WellKnownObjectMode.xml -? en/System.IO/UnmanagedMemoryAccessor.xml -M en/System.IO/DirectoryInfo.xml -M en/System.IO/MemoryStream.xml -M en/System.IO/FileMode.xml -M en/System.IO/DriveInfo.xml -M en/System.IO/IOException.xml -M en/System.IO/FileAttributes.xml -M en/System.IO/StringReader.xml -M en/System.IO/Stream.xml -M en/System.IO/FileStream.xml -M en/System.IO/FileInfo.xml -M en/System.IO/SearchOption.xml -M en/System.IO/DirectoryNotFoundException.xml -M en/System.IO/FileAccess.xml -M en/System.IO/FileShare.xml -M en/System.IO/StringWriter.xml -M en/System.IO/Directory.xml -M en/System.IO/BinaryReader.xml -M en/System.IO/TextReader.xml -M en/System.IO/StreamReader.xml -M en/System.IO/File.xml -M en/System.IO/BinaryWriter.xml -M en/System.IO/TextWriter.xml -M en/System.IO/EndOfStreamException.xml -M en/System.IO/StreamWriter.xml -M en/System.IO/FileOptions.xml -M en/System.IO/Path.xml -M en/System.IO/BufferedStream.xml -M en/System.IO/FileLoadException.xml -M en/System.IO/SeekOrigin.xml -M en/System.IO/FileSystemInfo.xml -M en/System.IO/UnmanagedMemoryStream.xml -M en/System.IO/DriveNotFoundException.xml -M en/System.IO/FileNotFoundException.xml -M en/System.IO/DriveType.xml -M en/System.IO/PathTooLongException.xml -? en/System.Runtime/AssemblyTargetedPatchBandAttribute.xml -? en/System.Runtime/TargetedPatchingOptOutAttribute.xml -M en/System.Runtime/GCSettings.xml -M en/System.Runtime/GCLatencyMode.xml -M en/System.Runtime/MemoryFailPoint.xml -? en/Microsoft.Win32/RegistryView.xml -? en/Microsoft.Win32/RegistryOptions.xml -M en/Microsoft.Win32/RegistryKey.xml -M en/Microsoft.Win32/RegistryValueOptions.xml -M en/Microsoft.Win32/RegistryHive.xml -M en/Microsoft.Win32/Registry.xml -M en/Microsoft.Win32/RegistryKeyPermissionCheck.xml -M en/Microsoft.Win32/RegistryValueKind.xml -M en/System.Runtime.Serialization.Formatters/ISoapMessage.xml -M en/System.Runtime.Serialization.Formatters/ServerFault.xml -M en/System.Runtime.Serialization.Formatters/InternalST.xml -M en/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.xml -M en/System.Runtime.Serialization.Formatters/FormatterTypeStyle.xml -M en/System.Runtime.Serialization.Formatters/SoapMessage.xml -M en/System.Runtime.Serialization.Formatters/IFieldInfo.xml -M en/System.Runtime.Serialization.Formatters/InternalRM.xml -M en/System.Runtime.Serialization.Formatters/SoapFault.xml -M en/System.Runtime.Serialization.Formatters/TypeFilterLevel.xml -M en/System.Runtime.Remoting.Services/EnterpriseServicesHelper.xml -M en/System.Runtime.Remoting.Services/TrackingServices.xml -M en/System.Runtime.Remoting.Services/ITrackingHandler.xml -M en/System.Reflection/Pointer.xml -M en/System.Reflection/MemberInfo.xml -M en/System.Reflection/TypeFilter.xml -M en/System.Reflection/EventAttributes.xml -M en/System.Reflection/IReflect.xml -M en/System.Reflection/FieldInfo.xml -M en/System.Reflection/CallingConventions.xml -M en/System.Reflection/ObfuscationAttribute.xml -M en/System.Reflection/AssemblyTitleAttribute.xml -M en/System.Reflection/MethodImplAttributes.xml -M en/System.Reflection/MethodBase.xml -M en/System.Reflection/AssemblyKeyFileAttribute.xml -M en/System.Reflection/MemberFilter.xml -M en/System.Reflection/AssemblyName.xml -M en/System.Reflection/AssemblyFlagsAttribute.xml -M en/System.Reflection/GenericParameterAttributes.xml -M en/System.Reflection/Module.xml -M en/System.Reflection/ParameterAttributes.xml -M en/System.Reflection/AssemblyAlgorithmIdAttribute.xml -M en/System.Reflection/BindingFlags.xml -M en/System.Reflection/TypeAttributes.xml -M en/System.Reflection/PropertyAttributes.xml -M en/System.Reflection/ParameterInfo.xml -M en/System.Reflection/AssemblyCopyrightAttribute.xml -M en/System.Reflection/ResourceAttributes.xml -M en/System.Reflection/TargetInvocationException.xml -M en/System.Reflection/DefaultMemberAttribute.xml -M en/System.Reflection/PropertyInfo.xml -M en/System.Reflection/ConstructorInfo.xml -M en/System.Reflection/PortableExecutableKinds.xml -M en/System.Reflection/AssemblyDelaySignAttribute.xml -M en/System.Reflection/AssemblyCultureAttribute.xml -M en/System.Reflection/Missing.xml -M en/System.Reflection/ReflectionTypeLoadException.xml -M en/System.Reflection/LocalVariableInfo.xml -M en/System.Reflection/InterfaceMapping.xml -M en/System.Reflection/ResourceLocation.xml -M en/System.Reflection/AssemblyDefaultAliasAttribute.xml -M en/System.Reflection/ModuleResolveEventHandler.xml -M en/System.Reflection/CustomAttributeFormatException.xml -M en/System.Reflection/AmbiguousMatchException.xml -M en/System.Reflection/CustomAttributeData.xml -M en/System.Reflection/FieldAttributes.xml -M en/System.Reflection/AssemblyCompanyAttribute.xml -M en/System.Reflection/AssemblyInformationalVersionAttribute.xml -M en/System.Reflection/EventInfo.xml -M en/System.Reflection/AssemblyNameFlags.xml -M en/System.Reflection/MethodBody.xml -M en/System.Reflection/InvalidFilterCriteriaException.xml -M en/System.Reflection/AssemblyTrademarkAttribute.xml -M en/System.Reflection/ObfuscateAssemblyAttribute.xml -M en/System.Reflection/StrongNameKeyPair.xml -M en/System.Reflection/Binder.xml -M en/System.Reflection/AssemblyProductAttribute.xml -M en/System.Reflection/CustomAttributeTypedArgument.xml -M en/System.Reflection/TypeDelegator.xml -M en/System.Reflection/ExceptionHandlingClauseOptions.xml -M en/System.Reflection/AssemblyKeyNameAttribute.xml -M en/System.Reflection/TargetParameterCountException.xml -M en/System.Reflection/ProcessorArchitecture.xml -M en/System.Reflection/ICustomAttributeProvider.xml -M en/System.Reflection/AssemblyNameProxy.xml -M en/System.Reflection/MethodAttributes.xml -M en/System.Reflection/ManifestResourceInfo.xml -M en/System.Reflection/AssemblyConfigurationAttribute.xml -M en/System.Reflection/MethodInfo.xml -M en/System.Reflection/MemberTypes.xml -M en/System.Reflection/ParameterModifier.xml -M en/System.Reflection/ExceptionHandlingClause.xml -M en/System.Reflection/TargetException.xml -M en/System.Reflection/CustomAttributeNamedArgument.xml -M en/System.Reflection/ImageFileMachine.xml -M en/System.Reflection/AssemblyDescriptionAttribute.xml -M en/System.Reflection/AssemblyFileVersionAttribute.xml -M en/System.Reflection/AssemblyVersionAttribute.xml -M en/System.Reflection/Assembly.xml diff --git a/mcs/class/corlib/ReferenceSources/String.cs b/mcs/class/corlib/ReferenceSources/String.cs index 78cd58f81a8..40707aa7790 100644 --- a/mcs/class/corlib/ReferenceSources/String.cs +++ b/mcs/class/corlib/ReferenceSources/String.cs @@ -345,15 +345,13 @@ namespace System unsafe String ReplaceInternal (char oldChar, char newChar) { -#if !BOOTSTRAP_BASIC if (this.m_stringLength == 0 || oldChar == newChar) return this; -#endif + int start_pos = IndexOfUnchecked (oldChar, 0, this.m_stringLength); -#if !BOOTSTRAP_BASIC if (start_pos == -1) return this; -#endif + if (start_pos < 4) start_pos = 0; @@ -391,11 +389,8 @@ namespace System throw new ArgumentException ("oldValue is the empty string."); if (this.Length == 0) -#if BOOTSTRAP_BASIC - throw new NotImplementedException ("BOOTSTRAP_BASIC"); -#else return this; -#endif + if (newValue == null) newValue = Empty; @@ -405,11 +400,7 @@ namespace System private unsafe String ReplaceUnchecked (String oldValue, String newValue) { if (oldValue.m_stringLength > m_stringLength) -#if BOOTSTRAP_BASIC - throw new NotImplementedException ("BOOTSTRAP_BASIC"); -#else return this; -#endif if (oldValue.m_stringLength == 1 && newValue.m_stringLength == 1) { return Replace (oldValue[0], newValue[0]); @@ -434,11 +425,8 @@ namespace System i = found + oldValue.m_stringLength; } if (count == 0) -#if BOOTSTRAP_BASIC - throw new NotImplementedException ("BOOTSTRAP_BASIC"); -#else - return this; -#endif + return this; + int nlen = 0; checked { try { @@ -488,11 +476,8 @@ namespace System if (totalWidth < 0) throw new ArgumentOutOfRangeException ("totalWidth", "Non-negative number required"); if (totalWidth <= m_stringLength) -#if BOOTSTRAP_BASIC - throw new NotImplementedException ("BOOTSTRAP_BASIC"); -#else return this; -#endif + string result = FastAllocateString (totalWidth); fixed (char *dest = result, src = &m_firstChar) { @@ -518,11 +503,7 @@ namespace System internal bool StartsWithOrdinalUnchecked (String value) { -#if BOOTSTRAP_BASIC - throw new NotImplementedException ("BOOTSTRAP_BASIC"); -#else return m_stringLength >= value.m_stringLength && CompareOrdinalUnchecked (this, 0, value.m_stringLength, value, 0, value.m_stringLength) == 0; -#endif } internal unsafe bool IsAscii () diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs deleted file mode 100644 index 3602e29e8c0..00000000000 --- a/mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// EventSourceException.cs -// -// Authors: -// Alexander Köplinger -// -// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.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; - -namespace System.Diagnostics.Tracing -{ - public class EventSourceException : Exception - { - [MonoTODO] - public EventSourceException () - { - } - - [MonoTODO] - public EventSourceException (string message) - { - } - - [MonoTODO] - public EventSourceException (string message, Exception innerException) - { - } - } -} diff --git a/mcs/class/corlib/System.IO/File.cs b/mcs/class/corlib/System.IO/File.cs index de55602cdbe..d3eebc44106 100644 --- a/mcs/class/corlib/System.IO/File.cs +++ b/mcs/class/corlib/System.IO/File.cs @@ -38,10 +38,7 @@ using System.Diagnostics; using System.Security; using System.Text; using System.Runtime.InteropServices; - -#if !MOBILE using System.Security.AccessControl; -#endif namespace System.IO { @@ -147,7 +144,6 @@ namespace System.IO FileShare.None, bufferSize, options); } -#if !MOBILE [MonoLimitation ("FileOptions and FileSecurity are ignored")] public static FileStream Create (string path, int bufferSize, FileOptions options, @@ -156,7 +152,6 @@ namespace System.IO return new FileStream (path, FileMode.Create, FileAccess.ReadWrite, FileShare.None, bufferSize, options); } -#endif public static StreamWriter CreateText (string path) { @@ -201,7 +196,6 @@ namespace System.IO return MonoIO.ExistsFile (path, out error); } -#if !MOBILE public static FileSecurity GetAccessControl (string path) { // AccessControlSections.Audit requires special permissions. @@ -215,7 +209,6 @@ namespace System.IO { return new FileSecurity (path, includeSections); } -#endif public static FileAttributes GetAttributes (string path) { @@ -434,7 +427,6 @@ namespace System.IO } } -#if !MOBILE public static void SetAccessControl (string path, FileSecurity fileSecurity) { @@ -443,7 +435,6 @@ namespace System.IO fileSecurity.PersistModifications (path); } -#endif public static void SetAttributes (string path, FileAttributes fileAttributes) diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs index b2a15cd2b60..db13468d36f 100644 --- a/mcs/class/corlib/System.IO/FileStream.cs +++ b/mcs/class/corlib/System.IO/FileStream.cs @@ -37,17 +37,11 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Remoting.Messaging; using System.Security; +using System.Security.AccessControl; using System.Security.Permissions; using System.Threading; -using Microsoft.Win32.SafeHandles; - -#if MOBILE -using System.IO.IsolatedStorage; -#else -using System.Security.AccessControl; -#endif - using System.Threading.Tasks; +using Microsoft.Win32.SafeHandles; namespace System.IO { @@ -129,7 +123,6 @@ namespace System.IO Init (handle, access, false, bufferSize, isAsync, false); } -#if !MOBILE [MonoLimitation ("This ignores the rights parameter")] public FileStream (string path, FileMode mode, FileSystemRights rights, FileShare share, @@ -146,7 +139,6 @@ namespace System.IO : this (path, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), share, bufferSize, false, options) { } -#endif internal FileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath = false, bool checkHost = false) : this (path, mode, access, share, bufferSize, false, options) @@ -942,7 +934,6 @@ namespace System.IO throw exc; } -#if !MOBILE public FileSecurity GetAccessControl () { if (safeHandle.IsClosed) @@ -964,7 +955,6 @@ namespace System.IO fileSecurity.PersistModifications (SafeFileHandle); } -#endif public override Task FlushAsync (CancellationToken cancellationToken) { diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs index d6c39114f16..8d485153e38 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs @@ -348,9 +348,6 @@ namespace System.Reflection.Emit { return null; } - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern Type create_modified_type (TypeBuilder tb, string modifiers); - private TypeBuilder GetMaybeNested (TypeBuilder t, IEnumerable nested) { TypeBuilder result = t; @@ -392,8 +389,27 @@ namespace System.Reflection.Emit { if ((result == null) && throwOnError) throw new TypeLoadException (className); if (result != null && (ts.HasModifiers || ts.IsByRef)) { - string modifiers = ts.ModifierString (); - Type mt = create_modified_type (result, modifiers); + Type mt = result; + if (result is TypeBuilder) { + var tb = result as TypeBuilder; + if (tb.is_created) + mt = tb.CreateType (); + } + foreach (var mod in ts.Modifiers) { + if (mod is PointerSpec) + mt = mt.MakePointerType (); + else if (mod is ArraySpec) { + var spec = mod as ArraySpec; + if (spec.IsBound) + return null; + if (spec.Rank == 1) + mt = mt.MakeArrayType (); + else + mt = mt.MakeArrayType (spec.Rank); + } + } + if (ts.IsByRef) + mt = mt.MakeByRefType (); result = mt as TypeBuilder; if (result == null) return mt; diff --git a/mcs/class/corlib/System.Reflection/Assembly.cs b/mcs/class/corlib/System.Reflection/Assembly.cs index bce2832992e..4f8948cc265 100644 --- a/mcs/class/corlib/System.Reflection/Assembly.cs +++ b/mcs/class/corlib/System.Reflection/Assembly.cs @@ -53,11 +53,12 @@ namespace System.Reflection { [ClassInterface(ClassInterfaceType.None)] [StructLayout (LayoutKind.Sequential)] #if MOBILE - public partial class Assembly : ICustomAttributeProvider { + public partial class Assembly : ICustomAttributeProvider, ISerializable #else - public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable { + public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable #endif - internal class ResolveEventHolder { + { + internal class ResolveEventHolder { #pragma warning disable 67 public event ModuleResolveEventHandler ModuleResolve; #pragma warning restore @@ -119,7 +120,7 @@ namespace System.Reflection { // We can't store the event directly in this class, since the // compiler would silently insert the fields before _mono_assembly // - public event ModuleResolveEventHandler ModuleResolve { + public virtual event ModuleResolveEventHandler ModuleResolve { [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)] add { resolve_event_holder.ModuleResolve += value; @@ -896,13 +897,12 @@ namespace System.Reflection { public virtual PermissionSet PermissionSet { get { return this.GrantedPermissionSet; } } - +#endif + public virtual SecurityRuleSet SecurityRuleSet { get { throw CreateNIE (); } } -#endif - static Exception CreateNIE () { return new NotImplementedException ("Derived classes must implement it"); diff --git a/mcs/class/corlib/System.Reflection/TargetException.cs b/mcs/class/corlib/System.Reflection/TargetException.cs deleted file mode 100644 index 5c5c69e4e9f..00000000000 --- a/mcs/class/corlib/System.Reflection/TargetException.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// System.Reflection.TargetException.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// (C) Ximian, Inc. http://www.ximian.com -// - -// -// Copyright (C) 2004 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.Globalization; -using System.Runtime.Serialization; -using System.Runtime.InteropServices; - -namespace System.Reflection -{ - [ComVisible (true)] - [Serializable] -#if MOBILE - public class TargetException : Exception { -#else - public class TargetException : ApplicationException { -#endif - public TargetException () - : base (Locale.GetText ("Unable to invoke an invalid target.")) - { - } - - public TargetException (string message) - : base (message) - { - } - - public TargetException (string message, Exception inner) - : base (message, inner) - { - } - - protected TargetException (SerializationInfo info, StreamingContext context) - : base (info, context) - { - } - } -} diff --git a/mcs/class/corlib/System.Reflection/TargetInvocationException.cs b/mcs/class/corlib/System.Reflection/TargetInvocationException.cs deleted file mode 100644 index 5f56432a852..00000000000 --- a/mcs/class/corlib/System.Reflection/TargetInvocationException.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// System.Reflection.TargetInvocationException -// -// Sean MacIsaac (macisaac@ximian.com) -// Duncan Mak (duncan@ximian.com) -// -// (C) 2001 Ximian, Inc. - -// -// Copyright (C) 2004 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.Runtime.Serialization; -using System.Runtime.InteropServices; - -namespace System.Reflection -{ - [ComVisible (true)] - [Serializable] -#if MOBILE - public sealed class TargetInvocationException : Exception { -#else - public sealed class TargetInvocationException : ApplicationException { -#endif - public TargetInvocationException (Exception inner) - : base ("Exception has been thrown by the target of an invocation.", inner) - { - } - - public TargetInvocationException (string message, Exception inner) - : base (message, inner) - { - } - - internal TargetInvocationException (SerializationInfo info, StreamingContext sc) - : base (info, sc) - { - } - } -} diff --git a/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs b/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs deleted file mode 100644 index 8b6c2b218e7..00000000000 --- a/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// System.Reflection.TargetParameterCountException.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// (C) Ximian, Inc. http://www.ximian.com -// - -// -// Copyright (C) 2004 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.Runtime.Serialization; -using System.Globalization; -using System.Runtime.InteropServices; - -namespace System.Reflection -{ - [ComVisible (true)] - [Serializable] -#if MOBILE - public sealed class TargetParameterCountException : Exception { -#else - public sealed class TargetParameterCountException : ApplicationException { -#endif - public TargetParameterCountException () - : base (Locale.GetText ("Number of parameter does not match expected count.")) - { - } - - public TargetParameterCountException (string message) - : base (message) - { - } - - public TargetParameterCountException (string message, Exception inner) - : base (message, inner) - { - } - - internal TargetParameterCountException (SerializationInfo info, - StreamingContext context) - : base (info, context) - { - } - } -} diff --git a/mcs/class/corlib/System.Runtime/GCLatencyMode.cs b/mcs/class/corlib/System.Runtime/GCLatencyMode.cs index 2bb0fd9f6c3..7c9f393da25 100644 --- a/mcs/class/corlib/System.Runtime/GCLatencyMode.cs +++ b/mcs/class/corlib/System.Runtime/GCLatencyMode.cs @@ -35,6 +35,7 @@ namespace System.Runtime Batch = 0, Interactive = 1, LowLatency = 2, - SustainedLowLatency = 3 + SustainedLowLatency = 3, + NoGCRegion = 4 } } diff --git a/mcs/class/corlib/System.Security.AccessControl/EventWaitHandleSecurity.cs b/mcs/class/corlib/System.Security.AccessControl/EventWaitHandleSecurity.cs index 8cfd398094e..ac20b894ef3 100644 --- a/mcs/class/corlib/System.Security.AccessControl/EventWaitHandleSecurity.cs +++ b/mcs/class/corlib/System.Security.AccessControl/EventWaitHandleSecurity.cs @@ -127,6 +127,11 @@ namespace System.Security.AccessControl { SetAuditRule((AuditRule)rule); } + + internal void Persist (SafeHandle handle) + { + PersistModifications (handle); + } } } diff --git a/mcs/class/corlib/System.Security.AccessControl/NativeObjectSecurity.cs b/mcs/class/corlib/System.Security.AccessControl/NativeObjectSecurity.cs index ab14ac5a5eb..db43c8b5490 100644 --- a/mcs/class/corlib/System.Security.AccessControl/NativeObjectSecurity.cs +++ b/mcs/class/corlib/System.Security.AccessControl/NativeObjectSecurity.cs @@ -135,12 +135,7 @@ namespace System.Security.AccessControl { Persist (name, includeSections, null); } - - internal void Persist (SafeHandle handle) - { - PersistModifications (handle); - } - + internal void PersistModifications (SafeHandle handle) { WriteLock(); diff --git a/mcs/class/corlib/System.Security.AccessControl/ObjectSecurity_T.cs b/mcs/class/corlib/System.Security.AccessControl/ObjectSecurity_T.cs index 93c4c2d451a..4bed60fc3b9 100644 --- a/mcs/class/corlib/System.Security.AccessControl/ObjectSecurity_T.cs +++ b/mcs/class/corlib/System.Security.AccessControl/ObjectSecurity_T.cs @@ -166,7 +166,7 @@ namespace System.Security.AccessControl SetAuditRule((AuditRule)rule); } - protected new void Persist (SafeHandle handle) + protected void Persist (SafeHandle handle) { WriteLock (); try { diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 94d6aac785a..2e19104a39d 100644 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -91,6 +91,7 @@ namespace System.Threading { private IntPtr thread_pinning_ref; private IntPtr abort_protected_block_count; private int priority = (int) ThreadPriority.Normal; + private IntPtr owned_mutex; /* * These fields are used to avoid having to increment corlib versions * when a new field is added to the unmanaged MonoThread structure. @@ -459,6 +460,12 @@ namespace System.Threading { { throw new PlatformNotSupportedException ("Thread.ResetAbort is not supported on the current platform."); } + + internal object AbortReason { + get { + throw new PlatformNotSupportedException ("Thread.ResetAbort is not supported on the current platform."); + } + } #endif // MONO_FEATURE_THREAD_ABORT [MethodImplAttribute (MethodImplOptions.InternalCall)] @@ -703,5 +710,10 @@ namespace System.Threading { throw new PlatformNotSupportedException ("Thread.Resume is not supported on the current platform."); } #endif + + public void DisableComObjectEagerCleanup () + { + throw new PlatformNotSupportedException (); + } } } diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs index 7b10091733f..5e854cbe3e4 100644 --- a/mcs/class/corlib/System/Environment.cs +++ b/mcs/class/corlib/System/Environment.cs @@ -57,7 +57,7 @@ namespace System { * of icalls, do not require an increment. */ #pragma warning disable 169 - private const int mono_corlib_version = 156; + private const int mono_corlib_version = 157; #pragma warning restore 169 [ComVisible (true)] @@ -322,7 +322,7 @@ namespace System { return trace.ToString (); } } -#if !MOBILE + /// /// Get a fully qualified path to the system directory /// @@ -331,7 +331,7 @@ namespace System { return GetFolderPath (SpecialFolder.System); } } -#endif + /// /// Get the number of milliseconds that have elapsed since the system was booted /// diff --git a/mcs/class/corlib/System/TermInfoDriver.cs b/mcs/class/corlib/System/TermInfoDriver.cs index ff6cc88a809..d849b03f8d6 100644 --- a/mcs/class/corlib/System/TermInfoDriver.cs +++ b/mcs/class/corlib/System/TermInfoDriver.cs @@ -1556,22 +1556,52 @@ namespace System { case 'O': // logical int second = stack.Pop().Int32; // it's a stack... the second value was pushed last int first = stack.Pop().Int32; - char c = format[pos]; - stack.Push( - c == '+' ? (first + second) : - c == '-' ? (first - second) : - c == '*' ? (first * second) : - c == '/' ? (first / second) : - c == 'm' ? (first % second) : - c == '^' ? (first ^ second) : - c == '&' ? (first & second) : - c == '|' ? (first | second) : - c == '=' ? AsInt(first == second) : - c == '>' ? AsInt(first > second) : - c == '<' ? AsInt(first < second) : - c == 'A' ? AsInt(AsBool(first) && AsBool(second)) : - c == 'O' ? AsInt(AsBool(first) || AsBool(second)) : - 0); // not possible; we just validated above + int res; + switch (format[pos]) { + case '+': + res = first + second; + break; + case '-': + res = first - second; + break; + case '*': + res = first * second; + break; + case '/': + res = first / second; + break; + case 'm': + res = first % second; + break; + case '^': + res = first ^ second; + break; + case '&': + res = first & second; + break; + case '|': + res = first | second; + break; + case '=': + res = AsInt(first == second); + break; + case '>': + res = AsInt(first > second); + break; + case '<': + res = AsInt(first < second); + break; + case 'A': + res = AsInt(AsBool(first) && AsBool(second)); + break; + case 'O': + res = AsInt(AsBool(first) || AsBool(second)); + break; + default: + res = 0; + break; + } + stack.Push(res); break; // Unary operations diff --git a/mcs/class/corlib/System/TypeSpec.cs b/mcs/class/corlib/System/TypeSpec.cs index 3cf08ae3520..f233bec088e 100644 --- a/mcs/class/corlib/System/TypeSpec.cs +++ b/mcs/class/corlib/System/TypeSpec.cs @@ -70,6 +70,18 @@ namespace System { { return Append (new Text.StringBuilder ()).ToString (); } + + public int Rank { + get { + return dimensions; + } + } + + public bool IsBound { + get { + return bound; + } + } } internal class PointerSpec : ModifierSpec diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs index 7f381d63c86..88ae954687a 100644 --- a/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs +++ b/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs @@ -794,5 +794,18 @@ namespace MonoTests.System.Reflection.Emit // ArgumentNullException should not occur. module.GetConstructorToken (method, null); } + + [Test] + public void GetType () + { + AssemblyBuilder ab = genAssembly (); + ModuleBuilder module = ab.DefineDynamicModule ("foo.dll", "foo.dll", true); + TypeBuilder tb = module.DefineType ("t1", TypeAttributes.Public); + + Assert.AreEqual ("t1[]", module.GetType ("t1[]").FullName); + Assert.AreEqual ("t1*", module.GetType ("t1*").FullName); + Assert.AreEqual ("t1&", module.GetType ("t1&").FullName); + Assert.AreEqual ("t1[]&", module.GetType ("t1[]&").FullName); + } } } diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs index d3115c76913..43f32cfa595 100644 --- a/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs +++ b/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs @@ -9094,6 +9094,8 @@ namespace MonoTests.System.Reflection.Emit [Test] + // Casts don't work with unfinished types + [Category ("NotWorking")] [Category ("NotDotNet")] public void IsAssignableFrom_NotCreated_Array () { diff --git a/mcs/class/corlib/Test/System/GCTest.cs b/mcs/class/corlib/Test/System/GCTest.cs new file mode 100644 index 00000000000..6ce65b4b432 --- /dev/null +++ b/mcs/class/corlib/Test/System/GCTest.cs @@ -0,0 +1,72 @@ +// +// GCTest.cs - NUnit Test Cases for GC +// +// Authors: +// Marek Safar +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.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; +using System.Threading.Tasks; + +using NUnit.Framework; + +namespace MonoTests.System { + + [TestFixture] + public class GCTest { + + class MyFinalizeObject + { + public volatile static int finalized; + + ~MyFinalizeObject () + { + if (finalized++ == 0) { + GC.ReRegisterForFinalize (this); + } + } + } + + static void Run_ReRegisterForFinalizeTest () + { + var m = new WeakReference (new MyFinalizeObject ()); + m.SetTarget (null); + } + + [Test] + public void ReRegisterForFinalizeTest () + { + Run_ReRegisterForFinalizeTest (); + var t = Task.Factory.StartNew (() => { + do { + GC.Collect (); + GC.WaitForPendingFinalizers (); + Task.Yield (); + } while (MyFinalizeObject.finalized != 2); + }); + + Assert.IsTrue (t.Wait (5000)); + } + } +} \ No newline at end of file diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources index 3808a598557..3716291a268 100644 --- a/mcs/class/corlib/corlib.dll.sources +++ b/mcs/class/corlib/corlib.dll.sources @@ -177,7 +177,6 @@ System.Diagnostics.Tracing/EventFieldFormat.cs System.Diagnostics.Tracing/EventFieldTags.cs System.Diagnostics.Tracing/EventIgnoreAttribute.cs System.Diagnostics.Tracing/EventManifestOptions.cs -System.Diagnostics.Tracing/EventSourceException.cs System.Diagnostics.SymbolStore/ISymbolBinder.cs System.Diagnostics.SymbolStore/ISymbolBinder1.cs System.Diagnostics.SymbolStore/ISymbolDocument.cs @@ -259,9 +258,6 @@ System.Reflection/PortableExecutableKinds.cs System.Reflection/PropertyInfo.cs System.Reflection/ReflectionTypeLoadException.cs System.Reflection/StrongNameKeyPair.cs -System.Reflection/TargetException.cs -System.Reflection/TargetInvocationException.cs -System.Reflection/TargetParameterCountException.cs System.Reflection.Emit/AssemblyBuilder.cs System.Reflection.Emit/AssemblyBuilderAccess.cs System.Reflection.Emit/ConstructorBuilder.cs @@ -1138,6 +1134,7 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs ../referencesource/mscorlib/system/diagnostics/eventing/eventactivityoptions.cs +../referencesource/mscorlib/system/diagnostics/eventing/eventsourceexception.cs ../referencesource/mscorlib/system/diagnostics/eventing/winmeta.cs ../referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/EventSourceOptions.cs @@ -1255,6 +1252,9 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/mscorlib/system/reflection/reflectioncontext.cs ../referencesource/mscorlib/system/reflection/resourceattributes.cs ../referencesource/mscorlib/system/reflection/RuntimeReflectionExtensions.cs +../referencesource/mscorlib/system/reflection/targetexception.cs +../referencesource/mscorlib/system/reflection/targetinvocationexception.cs +../referencesource/mscorlib/system/reflection/targetparametercountexception.cs ../referencesource/mscorlib/system/reflection/typeattributes.cs ../referencesource/mscorlib/system/reflection/typedelegator.cs ../referencesource/mscorlib/system/reflection/typefilter.cs @@ -1375,6 +1375,7 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/mscorlib/system/runtime/compilerservices/FormattableStringFactory.cs ../referencesource/mscorlib/system/runtime/compilerservices/hascopysemanticsattribute.cs ../referencesource/mscorlib/system/runtime/compilerservices/IAsyncStateMachine.cs +../referencesource/mscorlib/system/runtime/compilerservices/idispatchconstantattribute.cs ../referencesource/mscorlib/system/runtime/compilerservices/indexernameattribute.cs ../referencesource/mscorlib/system/runtime/compilerservices/INotifyCompletion.cs ../referencesource/mscorlib/system/runtime/compilerservices/internalsvisibletoattribute.cs diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources index bfa344cf598..bc43d92b920 100644 --- a/mcs/class/corlib/corlib_test.dll.sources +++ b/mcs/class/corlib/corlib_test.dll.sources @@ -22,6 +22,7 @@ System/CharCategoryTest.cs System/CharEnumeratorTest.cs System/CharTest.cs System/DelegateTest.cs +System/GCTest.cs System/ModuleHandleTest.cs System/NullableTest.cs System/ObsoleteAttributeTest.cs diff --git a/mcs/class/corlib/net_4_x_corlib.dll.sources b/mcs/class/corlib/net_4_x_corlib.dll.sources deleted file mode 100644 index 2ea5c40c16e..00000000000 --- a/mcs/class/corlib/net_4_x_corlib.dll.sources +++ /dev/null @@ -1,2 +0,0 @@ -#include corlib.dll.sources -../referencesource/mscorlib/system/runtime/compilerservices/idispatchconstantattribute.cs diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs index 329928fd80c..b87eecde4e0 100644 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs +++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs @@ -48,6 +48,10 @@ namespace System.Runtime.CompilerServices { public static DebugInfoGenerator CreatePdbGenerator() { return new SymbolDocumentGenerator(); } +#else + public static DebugInfoGenerator CreatePdbGenerator() { + throw new PlatformNotSupportedException(); + } #endif /// /// Marks a sequence point. diff --git a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/UnionQueryOperator.cs b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/UnionQueryOperator.cs index c2d07020d58..8dec8d4d72c 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/UnionQueryOperator.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/UnionQueryOperator.cs @@ -189,7 +189,9 @@ namespace System.Linq.Parallel private QueryOperatorEnumerator, TLeftKey> m_leftSource; // Left data source. private QueryOperatorEnumerator, TRightKey> m_rightSource; // Right data source. +#if !MONO private readonly int m_partitionIndex; // The current partition. +#endif private Set m_hashLookup; // The hash lookup, used to produce the union. private CancellationToken m_cancellationToken; private Shared m_outputLoopCount; @@ -210,7 +212,9 @@ namespace System.Linq.Parallel m_leftSource = leftSource; m_rightSource = rightSource; +#if !MONO m_partitionIndex = partitionIndex; +#endif m_comparer = comparer; m_cancellationToken = cancellationToken; } diff --git a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Options/OrderingQueryOperator.cs b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Options/OrderingQueryOperator.cs index 33baf3f8056..08ae2840d33 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Options/OrderingQueryOperator.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Options/OrderingQueryOperator.cs @@ -23,8 +23,10 @@ namespace System.Linq.Parallel /// internal sealed class OrderingQueryOperator : QueryOperator { +#if !MONO // Turns on order (AsOrdered) or turns off order (AsUnordered) private bool m_orderOn; +#endif private QueryOperator m_child; private OrdinalIndexState m_ordinalIndexState; @@ -33,7 +35,9 @@ namespace System.Linq.Parallel { m_child = child; m_ordinalIndexState = m_child.OrdinalIndexState; +#if !MONO m_orderOn = orderOn; +#endif } internal override QueryResults Open(QuerySettings settings, bool preferStriping) diff --git a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ConcatQueryOperator.cs b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ConcatQueryOperator.cs index d55436affb5..6f8c4a521f5 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ConcatQueryOperator.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ConcatQueryOperator.cs @@ -233,7 +233,9 @@ namespace System.Linq.Parallel class ConcatQueryOperatorResults : BinaryQueryOperatorResults { +#if !MONO ConcatQueryOperator m_concatOp; // Operator that generated the results +#endif int m_leftChildCount; // The number of elements in the left child result set int m_rightChildCount; // The number of elements in the right child result set @@ -260,7 +262,9 @@ namespace System.Linq.Parallel bool preferStriping) : base(leftChildQueryResults, rightChildQueryResults, concatOp, settings, preferStriping) { +#if !MONO m_concatOp = concatOp; +#endif Contract.Assert(leftChildQueryResults.IsIndexible && rightChildQueryResults.IsIndexible); m_leftChildCount = leftChildQueryResults.ElementsCount; diff --git a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs index b73b8bd0829..02d220bce78 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs @@ -150,7 +150,9 @@ namespace System.Linq.Parallel protected QueryResults m_childQueryResults; // Results of the child query private SortQueryOperator m_op; // Operator that generated these results private QuerySettings m_settings; // Settings collected from the query +#if !MONO private bool m_preferStriping; // If the results are indexible, should we use striping when partitioning them +#endif internal SortQueryOperatorResults( QueryResults childQueryResults, SortQueryOperator op, @@ -159,7 +161,9 @@ namespace System.Linq.Parallel m_childQueryResults = childQueryResults; m_op = op; m_settings = settings; +#if !MONO m_preferStriping = preferStriping; +#endif } internal override bool IsIndexible diff --git a/mcs/class/referencesource/System.Core/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs b/mcs/class/referencesource/System.Core/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs index f1e99baedb4..598d1e13aa3 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs @@ -25,7 +25,9 @@ namespace System.Linq.Parallel class OrderPreservingPipeliningSpoolingTask : SpoolingTaskBase { private readonly QueryTaskGroupState m_taskGroupState; // State shared among tasks. +#if !MONO private readonly TaskScheduler m_taskScheduler; // The task manager to execute the query. +#endif private readonly QueryOperatorEnumerator m_partition; // The source partition. private readonly bool[] m_consumerWaiting; // Whether a consumer is waiting on a particular producer private readonly bool[] m_producerWaiting; // Whether a particular producer is waiting on the consumer @@ -83,7 +85,9 @@ namespace System.Linq.Parallel m_partitionIndex = partitionIndex; m_buffers = buffers; m_bufferLock = bufferLock; +#if !MONO m_taskScheduler = taskScheduler; +#endif m_autoBuffered = autoBuffered; } diff --git a/mcs/class/referencesource/System.Core/System/Linq/Parallel/Utils/Sorting.cs b/mcs/class/referencesource/System.Core/System/Linq/Parallel/Utils/Sorting.cs index fb355997295..5007e479c74 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/Parallel/Utils/Sorting.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/Parallel/Utils/Sorting.cs @@ -70,11 +70,15 @@ namespace System.Linq.Parallel Contract.Assert(sharedkeys != null); Contract.Assert(sharedValues != null); Contract.Assert(sharedBarriers != null); +#if !MONO Contract.Assert(groupState.CancellationState.MergedCancellationToken != null); +#endif Contract.Assert(sharedIndices.Length <= sharedkeys.Length); Contract.Assert(sharedIndices.Length == sharedValues.Length); Contract.Assert(sharedIndices.Length == sharedBarriers.GetLength(1)); +#if !MONO Contract.Assert(groupState.CancellationState.MergedCancellationToken != null); +#endif m_source = source; m_partitionCount = partitionCount; diff --git a/mcs/class/referencesource/System.Core/System/Linq/SequenceQuery.cs b/mcs/class/referencesource/System.Core/System/Linq/SequenceQuery.cs index c26925aae8d..365a490d06d 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/SequenceQuery.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/SequenceQuery.cs @@ -101,7 +101,9 @@ namespace System.Linq { object IQueryProvider.Execute(Expression expression){ if (expression == null) throw Error.ArgumentNull("expression"); +#if !MONO Type execType = typeof(EnumerableExecutor<>).MakeGenericType(expression.Type); +#endif return EnumerableExecutor.Create(expression).ExecuteBoxed(); } @@ -194,7 +196,9 @@ namespace System.Linq { // check for args changed if (obj != m.Object || args != m.Arguments) { +#if !MONO Expression[] argArray = args.ToArray(); +#endif Type[] typeArgs = (m.Method.IsGenericMethod) ? m.Method.GetGenericArguments() : null; if ((m.Method.IsStatic || m.Method.DeclaringType.IsAssignableFrom(obj.Type)) diff --git a/mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableServices.cs b/mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableServices.cs index c36cb152e95..bf5a3cb3e52 100644 --- a/mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableServices.cs +++ b/mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableServices.cs @@ -67,7 +67,6 @@ namespace System.Runtime.Serialization nodes[i].WriteTo(xmlWriter); } -#if !MOBILE internal static string AddDefaultSchemaMethodName = "AddDefaultSchema"; public static void AddDefaultSchema(XmlSchemaSet schemas, XmlQualifiedName typeQName) { @@ -77,6 +76,5 @@ namespace System.Runtime.Serialization throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeQName"); SchemaExporter.AddDefaultXmlType(schemas, typeQName.Name, typeQName.Namespace); } -#endif } } diff --git a/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs b/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs index 1d92faa541f..506c90a59d6 100644 --- a/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs +++ b/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs @@ -4,6 +4,10 @@ // //------------------------------------------------------------------------------ +#if MONO +#undef FEATURE_PAL +#endif + namespace System.Net.Sockets { using System.Collections; using System.Collections.Generic; @@ -24,9 +28,9 @@ namespace System.Net.Sockets { /// interface. /// - - public class Socket : IDisposable + public partial class Socket : IDisposable { +#if !MONO internal const int DefaultCloseTimeout = -1; // don't change for default, otherwise breaking change // AcceptQueue - queued list of accept requests for BeginAccept or async Result for Begin Connect @@ -81,12 +85,12 @@ namespace System.Net.Sockets { // // Overlapped constants. // -#if !FEATURE_PAL || CORIOLIS +#if !(FEATURE_PAL && !MONO) || CORIOLIS internal static volatile bool UseOverlappedIO; #else // Disable the I/O completion port for Rotor internal static volatile bool UseOverlappedIO = true; -#endif // !FEATURE_PAL || CORIOLIS +#endif // !(FEATURE_PAL && !MONO) || CORIOLIS private bool useOverlappedIO; // Bool marked true if the native socket m_Handle was bound to the ThreadPool @@ -120,6 +124,7 @@ namespace System.Net.Sockets { #if !FEATURE_PAL // perfcounter internal static volatile bool s_PerfCountersEnabled; #endif +#endif // !MONO //************* constructors ************************* @@ -131,6 +136,7 @@ namespace System.Net.Sockets { DualMode = true; } +#if !MONO /// /// /// Initializes a new instance of the class. @@ -475,6 +481,7 @@ namespace System.Net.Sockets { return m_RemoteEndPoint; } } +#endif // !MONO /// /// @@ -484,10 +491,13 @@ namespace System.Net.Sockets { /// public IntPtr Handle { get { +#if !MONO ExceptionHelper.UnmanagedPermission.Demand(); +#endif return m_Handle.DangerousGetHandle(); } } +#if !MONO internal SafeCloseSocket SafeHandle { get { return m_Handle; @@ -534,6 +544,7 @@ namespace System.Net.Sockets { willBlock = current; } } +#endif // !MONO public bool UseOnlyOverlappedIO{ get { @@ -544,16 +555,17 @@ namespace System.Net.Sockets { } set { - +#if !MONO if (m_BoundToThreadPool) { throw new InvalidOperationException(SR.GetString(SR.net_io_completionportwasbound)); } +#endif useOverlappedIO = value; } } - +#if !MONO /// /// /// Gets the connection state of the Socket. This property will return the latest @@ -577,6 +589,7 @@ namespace System.Net.Sockets { return m_IsConnected; } } +#endif // !MONO /// /// @@ -611,13 +624,13 @@ namespace System.Net.Sockets { } } - +#if !MONO public bool IsBound{ get{ return (m_RightEndPoint != null); } } - +#endif // !MONO public bool ExclusiveAddressUse{ get { @@ -707,6 +720,7 @@ namespace System.Net.Sockets { } } +#if !MONO public bool NoDelay { get { return (int)GetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay) != 0 ? true : false; @@ -715,6 +729,7 @@ namespace System.Net.Sockets { SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, value ? 1 : 0); } } +#endif // !MONO public short Ttl{ get { @@ -769,6 +784,7 @@ namespace System.Net.Sockets { } } +#if !MONO public bool MulticastLoopback{ get { if (addressFamily == AddressFamily.InterNetwork) { @@ -796,7 +812,6 @@ namespace System.Net.Sockets { } } - public bool EnableBroadcast{ get { return (int)GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast) != 0 ? true : false; @@ -805,7 +820,8 @@ namespace System.Net.Sockets { SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, value ? 1 : 0); } } - +#endif // !MONO + public bool DualMode { get { if (AddressFamily != AddressFamily.InterNetworkV6) { @@ -837,7 +853,7 @@ namespace System.Net.Sockets { - +#if !MONO /// /// Associates a socket with an end point. /// @@ -1258,7 +1274,7 @@ namespace System.Net.Sockets { } return socket; } - +#endif // !MONO /// /// Sends a data buffer to a connected socket. @@ -1300,7 +1316,7 @@ namespace System.Net.Sockets { return bytesTransferred; } - +#if !MONO public int Send(IList> buffers, SocketFlags socketFlags, out SocketError errorCode) { if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Send", ""); if (CleanedUp) { @@ -1392,8 +1408,7 @@ namespace System.Net.Sockets { if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Send", bytesTransferred); return bytesTransferred; } - - +#endif // !MONO /// /// Sends a file to @@ -1406,8 +1421,7 @@ namespace System.Net.Sockets { SendFile(fileName,null,null,TransmitFileOptions.UseDefaultWorkerThread); } - - +#if !MONO /// /// Sends a file to /// a connected socket. @@ -1492,6 +1506,7 @@ namespace System.Net.Sockets { if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "SendFile", errorCode); return; } +#endif // !MONO #endif // !FEATURE_PAL @@ -1511,8 +1526,7 @@ namespace System.Net.Sockets { return bytesTransferred; } - - +#if !MONO public int Send(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode) { if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Send", ""); @@ -1688,6 +1702,7 @@ namespace System.Net.Sockets { if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "SendTo", bytesTransferred); return bytesTransferred; } +#endif // !MONO /// /// Sends data to a specific end point, starting at the indicated location in the data. @@ -1695,12 +1710,14 @@ namespace System.Net.Sockets { public int SendTo(byte[] buffer, int size, SocketFlags socketFlags, EndPoint remoteEP) { return SendTo(buffer, 0, size, socketFlags, remoteEP); } + /// /// [To be supplied.] /// public int SendTo(byte[] buffer, SocketFlags socketFlags, EndPoint remoteEP) { return SendTo(buffer, 0, buffer!=null ? buffer.Length : 0, socketFlags, remoteEP); } + /// /// [To be supplied.] /// @@ -1742,7 +1759,7 @@ namespace System.Net.Sockets { return bytesTransferred; } - +#if !MONO public int Receive(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode) { if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Receive", ""); if (CleanedUp) { @@ -1820,7 +1837,7 @@ namespace System.Net.Sockets { return bytesTransferred; } - +#endif // !MONO public int Receive(IList> buffers) { return Receive(buffers,SocketFlags.None); @@ -1836,6 +1853,7 @@ namespace System.Net.Sockets { return bytesTransferred; } +#if !MONO public int Receive(IList> buffers, SocketFlags socketFlags, out SocketError errorCode) { if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Receive", ""); if (CleanedUp) { @@ -2153,8 +2171,7 @@ namespace System.Net.Sockets { if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "ReceiveFrom", bytesTransferred); return bytesTransferred; } - - +#endif // !MONO /// /// Receives a datagram and stores the source end point. @@ -2175,6 +2192,7 @@ namespace System.Net.Sockets { return ReceiveFrom(buffer, 0, buffer!=null ? buffer.Length : 0, SocketFlags.None, ref remoteEP); } +#if !MONO // UE /// /// [To be supplied.] @@ -2220,6 +2238,7 @@ namespace System.Net.Sockets { return realOptionLength; } +#endif // !MONO // UE /// @@ -2229,6 +2248,7 @@ namespace System.Net.Sockets { return IOControl(unchecked((int)ioControlCode),optionInValue,optionOutValue); } +#if !MONO internal int IOControl( IOControlCode ioControlCode, IntPtr optionInValue, int inValueSize, @@ -2273,6 +2293,7 @@ namespace System.Net.Sockets { return realOptionLength; } +#endif // !MONO public void SetIPProtectionLevel(IPProtectionLevel level) { if (level == IPProtectionLevel.Unspecified) { @@ -2290,6 +2311,7 @@ namespace System.Net.Sockets { } } +#if !MONO /// /// /// Sets the specified option to the specified value. @@ -2660,6 +2682,7 @@ namespace System.Net.Sockets { SelectFileDescriptor(checkWrite, writefileDescriptorSet); SelectFileDescriptor(checkError, errfileDescriptorSet); } +#endif // !MONO #if !FEATURE_PAL /// @@ -2678,7 +2701,7 @@ namespace System.Net.Sockets { } #endif - +#if !MONO // // Async Winsock Support, the following functions use either // the Async Winsock support to do overlapped I/O WSASend/WSARecv @@ -3100,6 +3123,7 @@ namespace System.Net.Sockets { if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "BeginConnect", result); return result; } +#endif // !MONO [HostProtection(ExternalThreading=true)] public IAsyncResult BeginConnect(IPAddress address, int port, AsyncCallback requestCallback, object state){ @@ -3124,6 +3148,7 @@ namespace System.Net.Sockets { return result; } +#if !MONO [HostProtection(ExternalThreading=true)] public IAsyncResult BeginConnect(IPAddress[] addresses, int port, AsyncCallback requestCallback, object state) { @@ -3193,7 +3218,7 @@ namespace System.Net.Sockets { GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::DoBeginDisconnect() "); -#if FEATURE_PAL +#if FEATURE_PAL && !MONO throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired)); #endif @@ -3242,9 +3267,9 @@ namespace System.Net.Sockets { throw new ObjectDisposedException(this.GetType().FullName); } -#if FEATURE_PAL +#if FEATURE_PAL && !MONO throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired)); -#endif // FEATURE_PAL +#endif // FEATURE_PAL && !MONO GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Disconnect() "); @@ -3370,9 +3395,9 @@ namespace System.Net.Sockets { throw new ObjectDisposedException(this.GetType().FullName); } -#if FEATURE_PAL +#if FEATURE_PAL && !MONO throw new PlatformNotSupportedException(SR.GetString(SR.WinNTRequired)); -#endif // FEATURE_PAL +#endif // FEATURE_PAL && !MONO if (asyncResult==null) { throw new ArgumentNullException("asyncResult"); @@ -3412,7 +3437,7 @@ namespace System.Net.Sockets { if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "EndDisconnect", null); return; } - +#endif // !MONO /*++ @@ -3451,6 +3476,7 @@ namespace System.Net.Sockets { return result; } +#if !MONO [HostProtection(ExternalThreading=true)] public IAsyncResult BeginSend(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { @@ -3620,9 +3646,9 @@ namespace System.Net.Sockets { throw new ObjectDisposedException(this.GetType().FullName); } -#if FEATURE_PAL +#if FEATURE_PAL && !MONO throw new PlatformNotSupportedException(SR.GetString(SR.WinNTRequired)); -#endif // FEATURE_PAL +#endif // FEATURE_PAL && !MONO if (!Connected) { @@ -3698,7 +3724,7 @@ namespace System.Net.Sockets { } #endif // !FEATURE_PAL - +#endif // !MONO /// /// [To be supplied.] @@ -3714,7 +3740,7 @@ namespace System.Net.Sockets { return result; } - +#if !MONO [HostProtection(ExternalThreading=true)] public IAsyncResult BeginSend(IList> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { @@ -3804,7 +3830,7 @@ namespace System.Net.Sockets { } return errorCode; } - +#endif // !MONO /*++ @@ -3836,7 +3862,7 @@ namespace System.Net.Sockets { return bytesTransferred; } - +#if !MONO public int EndSend(IAsyncResult asyncResult, out SocketError errorCode) { if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "EndSend", asyncResult); if (CleanedUp) { @@ -3904,9 +3930,9 @@ namespace System.Net.Sockets { throw new ObjectDisposedException(this.GetType().FullName); } -#if FEATURE_PAL +#if FEATURE_PAL && !MONO throw new PlatformNotSupportedException(SR.GetString(SR.WinNTRequired)); -#endif // FEATURE_PAL +#endif // FEATURE_PAL && !MONO // // parameter validation // @@ -4160,7 +4186,7 @@ namespace System.Net.Sockets { if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "EndSendTo", bytesTransferred); return bytesTransferred; } - +#endif // !MONO /*++ @@ -4206,6 +4232,7 @@ namespace System.Net.Sockets { } +#if !MONO [HostProtection(ExternalThreading=true)] public IAsyncResult BeginReceive(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { @@ -4329,7 +4356,7 @@ namespace System.Net.Sockets { return errorCode; } - +#endif // !MONO [HostProtection(ExternalThreading=true)] public IAsyncResult BeginReceive(IList> buffers, SocketFlags socketFlags, AsyncCallback callback, object state) @@ -4342,7 +4369,7 @@ namespace System.Net.Sockets { return result; } - +#if !MONO [HostProtection(ExternalThreading=true)] public IAsyncResult BeginReceive(IList> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) { @@ -4451,6 +4478,8 @@ namespace System.Net.Sockets { private int m_LastReceiveTick; #endif +#endif // !MONO + /*++ Routine Description: @@ -4481,7 +4510,7 @@ namespace System.Net.Sockets { return bytesTransferred; } - +#if !MONO public int EndReceive(IAsyncResult asyncResult, out SocketError errorCode) { if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "EndReceive", asyncResult); if (CleanedUp) { @@ -5342,8 +5371,10 @@ namespace System.Net.Sockets { } } } +#endif // !MONO #if !FEATURE_PAL +#if !MONO private bool CanUseAcceptEx { get @@ -5352,6 +5383,7 @@ namespace System.Net.Sockets { (Thread.CurrentThread.IsThreadPoolThread || SettingsSectionInternal.Section.AlwaysUseCompletionPortsForAccept || m_IsDisconnected); } } +#endif // !MONO /// /// [To be supplied.] @@ -5363,6 +5395,7 @@ namespace System.Net.Sockets { /// This is the true async version that uses AcceptEx +#if !MONO /// /// [To be supplied.] /// @@ -5461,10 +5494,9 @@ namespace System.Net.Sockets { throw socketException; } } - +#endif // !MONO #endif // !FEATURE_PAL - /*++ Routine Description: @@ -5483,6 +5515,7 @@ namespace System.Net.Sockets { --*/ +#if !MONO /// /// [To be supplied.] /// @@ -5552,9 +5585,9 @@ namespace System.Net.Sockets { } return acceptedSocket; } +#endif // !MONO #if !FEATURE_PAL - /// /// [To be supplied.] /// @@ -5569,6 +5602,7 @@ namespace System.Net.Sockets { return socket; } +#if !MONO /// /// [To be supplied.] /// @@ -5635,13 +5669,13 @@ namespace System.Net.Sockets { } return socket; } - +#endif // !MONO #endif // !FEATURE_PAL - +#if !MONO /// /// /// Disables sends and receives on a socket. @@ -5821,6 +5855,7 @@ namespace System.Net.Sockets { Interlocked.CompareExchange(ref m_AcceptQueueOrConnectResult, new Queue(16), null); return (Queue)m_AcceptQueueOrConnectResult; } +#endif // !MONO internal bool CleanedUp { get { @@ -5828,6 +5863,7 @@ namespace System.Net.Sockets { } } +#if !MONO internal TransportType Transport { get { return @@ -6330,6 +6366,7 @@ namespace System.Net.Sockets { m_AsyncEvent.Close(); } } +#endif // !MONO public void Dispose() { Dispose(true); @@ -6340,6 +6377,7 @@ namespace System.Net.Sockets { Dispose(false); } +#if !MONO // this version does not throw. internal void InternalShutdown(SocketShutdown how) { GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::InternalShutdown() how:" + how.ToString()); @@ -8350,10 +8388,10 @@ namespace System.Net.Sockets { return retval; } - +#endif // !MONO } // end of class Socket - +#if !MONO internal class ConnectAsyncResult:ContextAwareResult{ private EndPoint m_EndPoint; internal ConnectAsyncResult(object myObject, EndPoint endPoint, object myState, AsyncCallback myCallBack):base(myObject, myState, myCallBack) { @@ -10234,5 +10272,6 @@ namespace System.Net.Sockets { } } #endif // SOCKETTHREADPOOL +#endif // !MONO } diff --git a/mcs/class/referencesource/System/regex/system/text/regularexpressions/Regex.cs b/mcs/class/referencesource/System/regex/system/text/regularexpressions/Regex.cs index 7b9b1e19115..46757711386 100644 --- a/mcs/class/referencesource/System/regex/system/text/regularexpressions/Regex.cs +++ b/mcs/class/referencesource/System/regex/system/text/regularexpressions/Regex.cs @@ -473,6 +473,7 @@ namespace System.Text.RegularExpressions { } #if NETSTANDARD + [CLSCompliant (false)] protected IDictionary Caps { get @@ -500,6 +501,7 @@ namespace System.Text.RegularExpressions { } } + [CLSCompliant (false)] protected IDictionary CapNames { get @@ -1398,7 +1400,7 @@ namespace System.Text.RegularExpressions { return newcached; } -#if !(SILVERLIGHT||FULL_AOT_RUNTIME) +#if !SILVERLIGHT /* * True if the O option was set */ @@ -1408,7 +1410,11 @@ namespace System.Text.RegularExpressions { protected bool UseOptionC() { /* Mono: Set to false until we investigate https://bugzilla.xamarin.com/show_bug.cgi?id=25671 */ return false; +#if FULL_AOT_RUNTIME + return false; +#else return(roptions & RegexOptions.Compiled) != 0; +#endif } #endif diff --git a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs index ef960754ba8..85d996b827a 100644 --- a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs +++ b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs @@ -53,6 +53,270 @@ namespace System.Diagnostics { public void CopyTo(ProcessModule[] array, int index) { InnerList.CopyTo(array, index); } + +#if MOBILE + [Obsolete ("This API is no longer available", true)] + public int Capacity { + get { + throw new NotSupportedException (); + } + set { + throw new NotSupportedException (); + } + } + + [Obsolete ("This API is no longer available", true)] + public void Add (ProcessModule item) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void AddRange (System.Collections.Generic.IEnumerable collection) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.ObjectModel.ReadOnlyCollection AsReadOnly() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int BinarySearch(int index, int count, ProcessModule item, System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int BinarySearch(ProcessModule item) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int BinarySearch(ProcessModule item, System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Clear() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.Generic.List ConvertAll(Converter converter) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void CopyTo(ProcessModule[] array) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void CopyTo(int index, ProcessModule[] array, int arrayIndex, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public bool Exists(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public ProcessModule Find(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.Generic.List FindAll(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindIndex(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindIndex(int startIndex, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindIndex(int startIndex, int count, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public ProcessModule FindLast(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindLastIndex(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindLastIndex(int startIndex, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindLastIndex(int startIndex, int count, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void ForEach(Action action) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.Generic.List GetRange(int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int IndexOf(ProcessModule item, int index) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int IndexOf(ProcessModule item, int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Insert(int index, ProcessModule item) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void InsertRange(int index, System.Collections.Generic.IEnumerable collection) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int LastIndexOf(ProcessModule item) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int LastIndexOf(ProcessModule item, int index) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int LastIndexOf(ProcessModule item, int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public bool Remove(ProcessModule item) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int RemoveAll(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void RemoveAt(int index) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void RemoveRange(int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Reverse() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Reverse(int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort(System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort(int index, int count, System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort(Comparison comparison) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public ProcessModule[] ToArray() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void TrimExcess() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public bool TrueForAll(Predicate match) + { + throw new NotSupportedException (); + } +#endif } } diff --git a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs index 127c1d4319a..94fa2f43bbd 100644 --- a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs +++ b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs @@ -77,6 +77,252 @@ namespace System.Diagnostics { public void CopyTo(ProcessThread[] array, int index) { InnerList.CopyTo(array, index); } + +#if MOBILE + [Obsolete ("This API is no longer available", true)] + public int Capacity { + get { + throw new NotSupportedException (); + } + set { + throw new NotSupportedException (); + } + } + + [Obsolete ("This API is no longer available", true)] + public void AddRange (System.Collections.Generic.IEnumerable collection) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.ObjectModel.ReadOnlyCollection AsReadOnly() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int BinarySearch(int index, int count, ProcessThread item, System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int BinarySearch(ProcessThread item) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int BinarySearch(ProcessThread item, System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Clear() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.Generic.List ConvertAll(Converter converter) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void CopyTo(ProcessThread[] array) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void CopyTo(int index, ProcessThread[] array, int arrayIndex, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public bool Exists(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public ProcessThread Find(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.Generic.List FindAll(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindIndex(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindIndex(int startIndex, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindIndex(int startIndex, int count, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public ProcessThread FindLast(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindLastIndex(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindLastIndex(int startIndex, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int FindLastIndex(int startIndex, int count, Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void ForEach(Action action) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public System.Collections.Generic.List GetRange(int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int IndexOf(ProcessThread item, int index) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int IndexOf(ProcessThread item, int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void InsertRange(int index, System.Collections.Generic.IEnumerable collection) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int LastIndexOf(ProcessThread item) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int LastIndexOf(ProcessThread item, int index) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int LastIndexOf(ProcessThread item, int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public int RemoveAll(Predicate match) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void RemoveAt(int index) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void RemoveRange(int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Reverse() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Reverse(int index, int count) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort(System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort(int index, int count, System.Collections.Generic.IComparer comparer) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void Sort(Comparison comparison) + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public ProcessThread[] ToArray() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public void TrimExcess() + { + throw new NotSupportedException (); + } + + [Obsolete ("This API is no longer available", true)] + public bool TrueForAll(Predicate match) + { + throw new NotSupportedException (); + } +#endif } } diff --git a/mcs/class/referencesource/mscorlib/system/contextboundobject.cs b/mcs/class/referencesource/mscorlib/system/contextboundobject.cs index b0290241aa4..f7298b8d117 100644 --- a/mcs/class/referencesource/mscorlib/system/contextboundobject.cs +++ b/mcs/class/referencesource/mscorlib/system/contextboundobject.cs @@ -20,7 +20,7 @@ namespace System { using System.Security.Permissions; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] -#if FEATURE_REMOTING +#if FEATURE_REMOTING || MONO public abstract class ContextBoundObject : MarshalByRefObject { #else // FEATURE_REMOTING public abstract class ContextBoundObject { diff --git a/mcs/class/referencesource/mscorlib/system/io/fileinfo.cs b/mcs/class/referencesource/mscorlib/system/io/fileinfo.cs index 2402d9d2bde..cb2f144af24 100644 --- a/mcs/class/referencesource/mscorlib/system/io/fileinfo.cs +++ b/mcs/class/referencesource/mscorlib/system/io/fileinfo.cs @@ -17,7 +17,7 @@ ===========================================================*/ using System; -#if FEATURE_MACL +#if FEATURE_MACL || MONO using System.Security.AccessControl; #endif using System.Security.Permissions; @@ -226,7 +226,7 @@ namespace System.IO { } } -#if FEATURE_MACL +#if FEATURE_MACL || MONO [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] public FileSecurity GetAccessControl() diff --git a/mcs/class/referencesource/mscorlib/system/io/filesysteminfo.cs b/mcs/class/referencesource/mscorlib/system/io/filesysteminfo.cs index aab4fe94975..2db4c807d87 100644 --- a/mcs/class/referencesource/mscorlib/system/io/filesysteminfo.cs +++ b/mcs/class/referencesource/mscorlib/system/io/filesysteminfo.cs @@ -34,7 +34,7 @@ namespace System.IO { [FileIOPermissionAttribute(SecurityAction.InheritanceDemand,Unrestricted=true)] #endif [ComVisible(true)] -#if FEATURE_REMOTING +#if FEATURE_REMOTING || MONO public abstract class FileSystemInfo : MarshalByRefObject, ISerializable { #else // FEATURE_REMOTING public abstract class FileSystemInfo : ISerializable { diff --git a/mcs/class/referencesource/mscorlib/system/io/stream.cs b/mcs/class/referencesource/mscorlib/system/io/stream.cs index 007745c7ab5..fa022e96e5d 100644 --- a/mcs/class/referencesource/mscorlib/system/io/stream.cs +++ b/mcs/class/referencesource/mscorlib/system/io/stream.cs @@ -39,7 +39,7 @@ namespace System.IO { #if CONTRACTS_FULL [ContractClass(typeof(StreamContract))] #endif -#if FEATURE_REMOTING +#if FEATURE_REMOTING || MONO public abstract class Stream : MarshalByRefObject, IDisposable { #else // FEATURE_REMOTING public abstract class Stream : IDisposable { diff --git a/mcs/class/referencesource/mscorlib/system/io/textreader.cs b/mcs/class/referencesource/mscorlib/system/io/textreader.cs index 5f8e7b98a7d..9023902cbfc 100644 --- a/mcs/class/referencesource/mscorlib/system/io/textreader.cs +++ b/mcs/class/referencesource/mscorlib/system/io/textreader.cs @@ -39,7 +39,7 @@ namespace System.IO { // There are methods on the Stream class for reading bytes. [Serializable] [ComVisible(true)] -#if FEATURE_REMOTING +#if FEATURE_REMOTING || MONO public abstract class TextReader : MarshalByRefObject, IDisposable { #else // FEATURE_REMOTING public abstract class TextReader : IDisposable { diff --git a/mcs/class/referencesource/mscorlib/system/io/textwriter.cs b/mcs/class/referencesource/mscorlib/system/io/textwriter.cs index 2afe3a6cbfa..3f484ffaddb 100644 --- a/mcs/class/referencesource/mscorlib/system/io/textwriter.cs +++ b/mcs/class/referencesource/mscorlib/system/io/textwriter.cs @@ -39,7 +39,7 @@ namespace System.IO { // There are methods on the Stream class for writing bytes. [Serializable] [ComVisible(true)] -#if FEATURE_REMOTING +#if FEATURE_REMOTING || MONO public abstract class TextWriter : MarshalByRefObject, IDisposable { #else // FEATURE_REMOTING public abstract class TextWriter : IDisposable { diff --git a/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs b/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs index 0e7bfafaf9e..b82294c787b 100644 --- a/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs +++ b/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs @@ -34,7 +34,7 @@ namespace System.Runtime.Serialization.Formatters.Binary { [System.Runtime.InteropServices.ComVisible(true)] sealed public class BinaryFormatter : -#if !FEATURE_REMOTING +#if !FEATURE_REMOTING && !MONO IFormatter #else IRemotingFormatter diff --git a/mcs/class/referencesource/mscorlib/system/security/attributes.cs b/mcs/class/referencesource/mscorlib/system/security/attributes.cs index cd8b165baaf..090998e0a51 100644 --- a/mcs/class/referencesource/mscorlib/system/security/attributes.cs +++ b/mcs/class/referencesource/mscorlib/system/security/attributes.cs @@ -86,12 +86,12 @@ namespace System.Security { #pragma warning disable 618 // We still use SecurityCriticalScope for v2 compat -#if !FEATURE_CORECLR && !MOBILE +#if !FEATURE_CORECLR private SecurityCriticalScope _val; #endif // FEATURE_CORECLR public SecurityCriticalAttribute () {} -#if !FEATURE_CORECLR && !MOBILE +#if !FEATURE_CORECLR public SecurityCriticalAttribute(SecurityCriticalScope scope) { _val = scope; diff --git a/mcs/class/referencesource/mscorlib/system/threading/threadabortexception.cs b/mcs/class/referencesource/mscorlib/system/threading/threadabortexception.cs index 60046c7dba2..3063b06aed6 100644 --- a/mcs/class/referencesource/mscorlib/system/threading/threadabortexception.cs +++ b/mcs/class/referencesource/mscorlib/system/threading/threadabortexception.cs @@ -39,12 +39,11 @@ namespace System.Threading : base(info, context) { } -#if !MOBILE + public Object ExceptionState { [System.Security.SecuritySafeCritical] // auto-generated get {return Thread.CurrentThread.AbortReason;} } -#endif } } diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay index 63ddee82bfa..fea30ff25c6 100644 --- a/mcs/ilasm/parser/ILParser.jay +++ b/mcs/ilasm/parser/ILParser.jay @@ -3276,13 +3276,13 @@ exptype_head : D_CLASS K_EXTERN expt_attr comp_name expt_attr : { $$ = 0; } /* EMPTY */ | expt_attr K_PRIVATE { $$ = (TypeAttr)$1 | TypeAttr.Private; } | expt_attr K_PUBLIC { $$ = (TypeAttr)$1 | TypeAttr.Public; } + | expt_attr K_FORWARDER { $$ = (TypeAttr)$1 | TypeAttr.Forwarder; } | expt_attr K_NESTED K_PUBLIC { $$ = (TypeAttr)$1 | TypeAttr.NestedPublic; } | expt_attr K_NESTED K_PRIVATE { $$ = (TypeAttr)$1 | TypeAttr.NestedPrivate; } | expt_attr K_NESTED K_FAMILY { $$ = (TypeAttr)$1 | TypeAttr.NestedFamily; } | expt_attr K_NESTED K_ASSEMBLY { $$ = (TypeAttr)$1 | TypeAttr.NestedAssembly;} | expt_attr K_NESTED K_FAMANDASSEM { $$ = (TypeAttr)$1 | TypeAttr.NestedFamAndAssem; } | expt_attr K_NESTED K_FAMORASSEM { $$ = (TypeAttr)$1 | TypeAttr.NestedFamOrAssem; } - | K_FORWARDER { $$ = TypeAttr.Forwarder; } ; exptype_decls : /* EMPTY */ diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs index edc860eca83..2077f26bf2c 100644 --- a/mcs/mcs/ecore.cs +++ b/mcs/mcs/ecore.cs @@ -4784,7 +4784,7 @@ namespace Mono.CSharp { // is no better expression conversion // if (candidate_pd.Count < best_pd.Count) { - if (!candidate_params && !candidate_pd.FixedParameters [j - j].HasDefaultValue) { + if (!candidate_params && !candidate_pd.FixedParameters [j - 1].HasDefaultValue) { return true; } } else if (candidate_pd.Count == best_pd.Count) { diff --git a/mcs/mcs/generic.cs b/mcs/mcs/generic.cs index 48d2dc01b96..fdf5b81f92c 100644 --- a/mcs/mcs/generic.cs +++ b/mcs/mcs/generic.cs @@ -3159,7 +3159,7 @@ namespace Mono.CSharp { var ga_u = u.TypeArguments; var ga_v = v.TypeArguments; - if (u.TypeArguments.Length != u.TypeArguments.Length) + if (u.TypeArguments.Length != v.TypeArguments.Length) return 0; int score = 0; diff --git a/mcs/mcs/import.cs b/mcs/mcs/import.cs index 60073b9f4c1..9518427e1a1 100644 --- a/mcs/mcs/import.cs +++ b/mcs/mcs/import.cs @@ -142,6 +142,7 @@ namespace Mono.CSharp compiled_types = new Dictionary (40, ReferenceEquality.Default); assembly_2_definition = new Dictionary (ReferenceEquality.Default); IgnorePrivateMembers = true; + IgnoreCompilerGeneratedField = true; } #region Properties @@ -154,6 +155,8 @@ namespace Mono.CSharp public bool IgnorePrivateMembers { get; set; } + public bool IgnoreCompilerGeneratedField { get; set; } + #endregion public abstract void AddCompiledType (TypeBuilder builder, TypeSpec spec); @@ -179,8 +182,10 @@ namespace Mono.CSharp break; default: // Ignore private fields (even for error reporting) to not require extra dependencies - if ((IgnorePrivateMembers && !declaringType.IsStruct) || - HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace)) + if (IgnorePrivateMembers && !declaringType.IsStruct) + return null; + + if (IgnoreCompilerGeneratedField && HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace)) return null; mod = Modifiers.PRIVATE; diff --git a/mcs/mcs/property.cs b/mcs/mcs/property.cs index 8036f2c1126..6b1990e1f09 100644 --- a/mcs/mcs/property.cs +++ b/mcs/mcs/property.cs @@ -1210,12 +1210,11 @@ namespace Mono.CSharp backing_field = new Field (Parent, new TypeExpression (MemberType, Location), - Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)), + Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.DEBUGGER_HIDDEN | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)), MemberName, null); Parent.PartialContainer.Members.Add (backing_field); backing_field.Initializer = Initializer; - backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED; // Call define because we passed fields definition backing_field.Define (); diff --git a/mcs/tests/test-16628-lib.il b/mcs/tests/test-16628-lib.il new file mode 100644 index 00000000000..ca46405c0fd --- /dev/null +++ b/mcs/tests/test-16628-lib.il @@ -0,0 +1,33 @@ +.assembly bz16628.typeforwarder2 {} +.assembly extern mscorlib {} +.assembly extern bz16628.typeforwardee2 {} + +.class extern public forwarder NSwForwardee2.Foo_SPECIAL{ + .assembly extern bz16628.typeforwardee2 +} + +.class public auto ansi beforefieldinit NSwForwardee2.Bar_SPECIAL + extends [mscorlib]System.Object +{ + .field public static int32 A + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method Foo::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.s 320 + IL_0002: stsfld int32 NSwForwardee2.Bar_SPECIAL::A + IL_0007: ret + } // end of method Foo::.cctor +} + diff --git a/mcs/tests/test-254.cs b/mcs/tests/test-254.cs index 1971d2f4e48..36453ea86b3 100644 --- a/mcs/tests/test-254.cs +++ b/mcs/tests/test-254.cs @@ -1,5 +1,6 @@ using System; using System.Reflection; +using System.Runtime.CompilerServices; [assembly: Test] @@ -130,7 +131,8 @@ public class ClassMain Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), false, 44); Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 45); FieldInfo fi = typeof(Test_3).GetField ("e_1", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - Assert (fi.GetCustomAttributes (true), true, 46); + Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 46); + Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), true, 47); ei = typeof(Test_3).GetEvent ("e_2"); Assert (ei.GetCustomAttributes (true), false, 51); @@ -139,7 +141,8 @@ public class ClassMain Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), true, 54); Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 55); fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - Assert (fi.GetCustomAttributes (true), false, 56); + Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 56); + Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 57); ei = typeof(Test_4).GetEvent ("e_2"); Assert (ei.GetCustomAttributes (true), false, 71); @@ -148,7 +151,8 @@ public class ClassMain Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), false, 74); Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), true, 75); fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - Assert (fi.GetCustomAttributes (true), false, 76); + Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 76); + Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 77); ei = typeof(Test_4).GetEvent ("e_3"); Assert (ei.GetCustomAttributes (true), false, 81); @@ -159,7 +163,8 @@ public class ClassMain Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 86); Assert (ei.GetRemoveMethod ().GetParameters ()[0].GetCustomAttributes (true), true, 87); fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); - Assert (fi.GetCustomAttributes (true), false, 88); + Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 86); + Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 87); return failed ? 1 : 0; } diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml index 0cbfab76394..df5884f7fe9 100644 --- a/mcs/tests/ver-il-net_4_x.xml +++ b/mcs/tests/ver-il-net_4_x.xml @@ -36775,7 +36775,7 @@ 80 - 1169 + 1309 7 diff --git a/mcs/tools/corcompare/mono-api-info.cs b/mcs/tools/corcompare/mono-api-info.cs index 7636c2b204f..cf6b1777107 100644 --- a/mcs/tools/corcompare/mono-api-info.cs +++ b/mcs/tools/corcompare/mono-api-info.cs @@ -1155,11 +1155,14 @@ namespace CorCompare string direction = first && HasExtensionParameter ? "this" : "in"; first = false; - if (parameter.ParameterType is ByReferenceType) + var pt = parameter.ParameterType; + var brt = pt as ByReferenceType; + if (brt != null) { direction = parameter.IsOut ? "out" : "ref"; + pt = brt.ElementType; + } - TypeReference t = parameter.ParameterType; - AddAttribute ("type", Utils.CleanupTypeName (t)); + AddAttribute ("type", Utils.CleanupTypeName (pt)); if (parameter.IsOptional) { AddAttribute ("optional", "true"); @@ -1538,13 +1541,15 @@ namespace CorCompare ParameterDefinition info = infos [i]; + string modifier = string.Empty; if (info.ParameterType.IsByReference) { - string modifier; - if ((info.Attributes & (ParameterAttributes.Out | ParameterAttributes.In)) == ParameterAttributes.Out) + if ((info.Attributes & ParameterAttributes.In) != 0) + modifier = "in"; + else if ((info.Attributes & ParameterAttributes.Out) != 0) modifier = "out"; - else - modifier = "ref"; + } + if (modifier.Length > 0) { signature.Append (modifier); signature.Append (" "); } diff --git a/mcs/tools/gacutil/Makefile b/mcs/tools/gacutil/Makefile index f98314ecec7..ff66d61364c 100644 --- a/mcs/tools/gacutil/Makefile +++ b/mcs/tools/gacutil/Makefile @@ -2,8 +2,8 @@ thisdir = tools/gacutil SUBDIRS = include ../../build/rules.make -LIB_REFS = Mono.Security -LOCAL_MCS_FLAGS = -unsafe +LIB_REFS = System Mono.Security System.Security +LOCAL_MCS_FLAGS = -unsafe -define:NO_SYMBOL_WRITER PROGRAM = gacutil.exe diff --git a/mcs/tools/gacutil/driver.cs b/mcs/tools/gacutil/driver.cs index 13f686e22c6..47c4ac8df96 100644 --- a/mcs/tools/gacutil/driver.cs +++ b/mcs/tools/gacutil/driver.cs @@ -14,7 +14,6 @@ using System; using System.IO; using System.Diagnostics; using System.Text; -using System.Reflection; using System.Collections; using System.Globalization; using System.Runtime.InteropServices; @@ -23,6 +22,8 @@ using System.Security.Cryptography; using Mono.Security; using Mono.Security.Cryptography; +using IKVM.Reflection; + namespace Mono.Tools { public class Driver { @@ -48,6 +49,7 @@ namespace Mono.Tools { private static bool silent; static bool in_bootstrap; + private static Universe _universe; public static int Main (string [] args) { @@ -244,7 +246,7 @@ namespace Mono.Tools { AssemblyName an = null; try { - assembly = Assembly.LoadFrom (name); + assembly = ReflectionOnlyLoadFrom (name); } catch { WriteLine (string.Format (failure_msg, name) + "The file specified is not a valid assembly."); return false; @@ -744,12 +746,27 @@ namespace Mono.Tools { } } + private static Universe GetUniverse () { + if (_universe == null) { + _universe = new Universe (UniverseOptions.MetadataOnly); + } + return _universe; + } + + private static Assembly ReflectionOnlyLoadFrom (string fileName) + { + return GetUniverse ().LoadFile (fileName); + } + private static AssemblyName GetCorlibName () + { + return GetUniverse ().Mscorlib.GetName (); + } + private static bool CheckReferencedAssemblies (AssemblyName an) { - AppDomain d = null; try { - Assembly a = Assembly.LoadFrom (an.CodeBase); - AssemblyName corlib = typeof (object).Assembly.GetName (); + Assembly a = ReflectionOnlyLoadFrom (an.CodeBase); + AssemblyName corlib = GetCorlibName (); foreach (AssemblyName ref_an in a.GetReferencedAssemblies ()) { if (ref_an.Name == corlib.Name) // Just do a string compare so we can install on diff versions @@ -763,12 +780,6 @@ namespace Mono.Tools { } catch (Exception e) { WriteLine (e.ToString ()); // This should be removed pre beta3 return false; - } finally { - if (d != null) { - try { - AppDomain.Unload (d); - } catch { } - } } return true; @@ -800,8 +811,8 @@ namespace Mono.Tools { static bool LoadConfig (bool quiet) { - MethodInfo config = typeof (System.Environment).GetMethod ("GetMachineConfigPath", - BindingFlags.Static | BindingFlags.NonPublic); + System.Reflection.MethodInfo config = typeof (System.Environment).GetMethod ("GetMachineConfigPath", + System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); if (config != null) { string path = (string) config.Invoke (null, null); @@ -832,7 +843,7 @@ namespace Mono.Tools { // Note: MustVerify is based on the original token (by design). Public key // remapping won't affect if the assembly is verified or not. - if (StrongNameManager.MustVerify (an)) { + if (StrongNameManager.MustVerify (new System.Reflection.AssemblyName (an.FullName))) { RSA rsa = CryptoConvert.FromCapiPublicKeyBlob (publicKey, 12); StrongName sn = new StrongName (rsa); if (sn.Verify (assemblyFile)) { @@ -899,20 +910,20 @@ namespace Mono.Tools { public static extern int symlink (string oldpath, string newpath); private static string GetGacDir () { - PropertyInfo gac = typeof (System.Environment).GetProperty ("GacPath", - BindingFlags.Static|BindingFlags.NonPublic); + System.Reflection.PropertyInfo gac = typeof (System.Environment).GetProperty ("GacPath", + System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.NonPublic); if (gac == null) { WriteLine ("ERROR: Mono runtime not detected, please use " + "the mono runtime for gacutil.exe"); Environment.Exit (1); } - MethodInfo get_gac = gac.GetGetMethod (true); + System.Reflection.MethodInfo get_gac = gac.GetGetMethod (true); return (string) get_gac.Invoke (null, null); } private static string GetLibDir () { - MethodInfo libdir = typeof (System.Environment).GetMethod ("internalGetGacPath", - BindingFlags.Static|BindingFlags.NonPublic); + System.Reflection.MethodInfo libdir = typeof (System.Environment).GetMethod ("internalGetGacPath", + System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.NonPublic); if (libdir == null) { WriteLine ("ERROR: Mono runtime not detected, please use " + "the mono runtime for gacutil.exe"); diff --git a/mcs/tools/gacutil/gacutil.exe.sources b/mcs/tools/gacutil/gacutil.exe.sources index 911afaf9d82..4772378b43c 100644 --- a/mcs/tools/gacutil/gacutil.exe.sources +++ b/mcs/tools/gacutil/gacutil.exe.sources @@ -1,2 +1,9 @@ driver.cs ../security/StrongNameManager.cs +../../../external/ikvm/reflect/*.cs +../../../external/ikvm/reflect/Metadata/*.cs +../../../external/ikvm/reflect/Emit/*.cs +../../../external/ikvm/reflect/Reader/*.cs +../../../external/ikvm/reflect/Writer/*.cs +../../../external/ikvm/reflect/Impl/ITypeOwner.cs +../../../external/ikvm/reflect/Impl/SymbolSupport.cs diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs index ef681913e28..cc891536b8a 100755 --- a/mcs/tools/mkbundle/mkbundle.cs +++ b/mcs/tools/mkbundle/mkbundle.cs @@ -23,7 +23,6 @@ using System.Runtime.InteropServices; using System.Text; using IKVM.Reflection; using System.Linq; -using System.Diagnostics; using System.Net; using System.Threading.Tasks; @@ -31,6 +30,7 @@ class MakeBundle { static string output = "a.out"; static string object_out = null; static List link_paths = new List (); + static Dictionary libraries = new Dictionary (); static bool autodeps = false; static bool keeptemp = false; static bool compile_only = false; @@ -126,6 +126,33 @@ class MakeBundle { cross_target = args [++i]; break; + case "--library": + if (i+1 == top){ + Help (); + return 1; + } + if (custom_mode){ + Console.Error.WriteLine ("--library can only be used with --simple/--runtime/--cross mode"); + Help (); + return 1; + } + var lspec = args [++i]; + var p = lspec.IndexOf (","); + string alias, path; + if (p == -1){ + alias = Path.GetFileName (lspec); + path = lspec; + } else { + alias = lspec.Substring (0, p); + path = lspec.Substring (p+1); + } + if (!File.Exists (path)){ + Console.Error.WriteLine ($"The specified library file {path} does not exist"); + return 1; + } + libraries [alias] = path; + break; + case "--fetch-target": if (i+1 == top){ Help (); @@ -289,7 +316,7 @@ class MakeBundle { return 1; } var env = args [++i]; - var p = env.IndexOf ('='); + p = env.IndexOf ('='); if (p == -1) environment.Add (env, ""); else @@ -602,6 +629,11 @@ class MakeBundle { foreach (var key in environment.Keys) maker.AddStringPair ("env:" + key, key, environment [key]); } + if (libraries.Count > 0){ + foreach (var alias_and_path in libraries){ + maker.Add ("library:" + alias_and_path.Key, alias_and_path.Value); + } + } maker.Dump (); maker.Close (); return true; @@ -854,7 +886,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons string monoPath = GetEnv("MONOPREFIX", @"C:\Program Files (x86)\Mono"); string[] includes = new string[] {winsdkPath + @"\Include\um", winsdkPath + @"\Include\shared", vsPath + @"\include", monoPath + @"\include\mono-2.0", "." }; - string[] libs = new string[] { winsdkPath + @"\Lib\winv6.3\um\x86" , vsPath + @"\lib" }; + // string[] libs = new string[] { winsdkPath + @"\Lib\winv6.3\um\x86" , vsPath + @"\lib" }; var linkLibraries = new string[] { "kernel32.lib", "version.lib", "Ws2_32.lib", @@ -1120,40 +1152,42 @@ void mono_register_config_for_assembly (const char* assembly_name, cons { Console.WriteLine ("Usage is: mkbundle [options] assembly1 [assembly2...]\n\n" + "Options:\n" + - " --config F Bundle system config file `F'\n" + - " --config-dir D Set MONO_CFG_DIR to `D'\n" + - " --deps Turns on automatic dependency embedding (default on simple)\n" + - " -L path Adds `path' to the search path for assemblies\n" + - " --machine-config F Use the given file as the machine.config for the application.\n" + - " -o out Specifies output filename\n" + - " --nodeps Turns off automatic dependency embedding (default on custom)\n" + - " --skip-scan Skip scanning assemblies that could not be loaded (but still embed them).\n" + - " --i18n ENCODING none, all or comma separated list of CJK, MidWest, Other, Rare, West.\n" + - " -v Verbose output\n" + + " --config F Bundle system config file `F'\n" + + " --config-dir D Set MONO_CFG_DIR to `D'\n" + + " --deps Turns on automatic dependency embedding (default on simple)\n" + + " -L path Adds `path' to the search path for assemblies\n" + + " --machine-config F Use the given file as the machine.config for the application.\n" + + " -o out Specifies output filename\n" + + " --nodeps Turns off automatic dependency embedding (default on custom)\n" + + " --skip-scan Skip scanning assemblies that could not be loaded (but still embed them).\n" + + " --i18n ENCODING none, all or comma separated list of CJK, MidWest, Other, Rare, West.\n" + + " -v Verbose output\n" + "\n" + "--simple Simple mode does not require a C toolchain and can cross compile\n" + - " --cross TARGET Generates a binary for the given TARGET\n"+ - " --local-targets Lists locally available targets\n" + - " --list-targets Lists available targets on the remote server\n" + - " --options OPTIONS Embed the specified Mono command line options on target\n" + - " --runtime RUNTIME Manually specifies the Mono runtime to use\n" + - " --target-server URL Specified a server to download targets from, default is " + target_server + "\n" + - " --env KEY=VALUE Hardcodes an environment variable for the target\n" + + " --cross TARGET Generates a binary for the given TARGET\n"+ + " --env KEY=VALUE Hardcodes an environment variable for the target\n" + + " --library [LIB,]PATH Bundles the specified dynamic library to be used at runtime\n" + + " LIB is optional shortname for file located at PATH\n" + + " --list-targets Lists available targets on the remote server\n" + + " --local-targets Lists locally available targets\n" + + " --options OPTIONS Embed the specified Mono command line options on target\n" + + " --runtime RUNTIME Manually specifies the Mono runtime to use\n" + + " --target-server URL Specified a server to download targets from, default is " + target_server + "\n" + "\n" + "--custom Builds a custom launcher, options for --custom\n" + - " -c Produce stub only, do not compile\n" + - " -oo obj Specifies output filename for helper object file\n" + + " -c Produce stub only, do not compile\n" + + " -oo obj Specifies output filename for helper object file\n" + " --dos2unix[=true|false]\n" + - " When no value provided, or when `true` specified\n" + - " `dos2unix` will be invoked to convert paths on Windows.\n" + - " When `--dos2unix=false` used, dos2unix is NEVER used.\n" + - " --keeptemp Keeps the temporary files\n" + - " --static Statically link to mono libs\n" + - " --nomain Don't include a main() function, for libraries\n" + - " --custom-main C Link the specified compilation unit (.c or .obj) with entry point/init code\n" + - " -z Compress the assemblies before embedding.\n" + - " --static-ctor ctor Add a constructor call to the supplied function.\n" + - " You need zlib development headers and libraries.\n"); + " When no value provided, or when `true` specified\n" + + " `dos2unix` will be invoked to convert paths on Windows.\n" + + " When `--dos2unix=false` used, dos2unix is NEVER used.\n" + + " --keeptemp Keeps the temporary files\n" + + " --static Statically link to mono libs\n" + + " --nomain Don't include a main() function, for libraries\n" + + " --custom-main C Link the specified compilation unit (.c or .obj) with entry point/init code\n" + + " -z Compress the assemblies before embedding.\n" + + " --static-ctor ctor Add a constructor call to the supplied function.\n" + + " You need zlib development headers and libraries.\n"); } [DllImport ("libc")] diff --git a/mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources b/mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources index 57e354026a2..da336168f90 100644 --- a/mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources +++ b/mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources @@ -99,3 +99,12 @@ Logger.cs ../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs ../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs ../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/*.cs +../../../external/cecil/symbols/pdb/Microsoft.Cci.Pdb/*.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/ISymUnmanagedDocumentWriter.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/ISymUnmanagedWriter2.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/ModuleMetadata.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/PdbHelper.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/PdbReader.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/PdbWriter.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/SymDocumentWriter.cs +../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/SymWriter.cs diff --git a/mcs/tools/xbuild/tests/Vbc/1.vbproj b/mcs/tools/xbuild/tests/Vbc/1.vbproj new file mode 100644 index 00000000000..c056fd1c2b2 --- /dev/null +++ b/mcs/tools/xbuild/tests/Vbc/1.vbproj @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + diff --git a/mcs/tools/xbuild/tests/Vbc/2.vbproj b/mcs/tools/xbuild/tests/Vbc/2.vbproj new file mode 100644 index 00000000000..517036ac501 --- /dev/null +++ b/mcs/tools/xbuild/tests/Vbc/2.vbproj @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/mcs/tools/xbuild/tests/Vbc/test.vb b/mcs/tools/xbuild/tests/Vbc/test.vb new file mode 100644 index 00000000000..4f76bf6817e --- /dev/null +++ b/mcs/tools/xbuild/tests/Vbc/test.vb @@ -0,0 +1,7 @@ +Imports System + +Public Module mainmod + Sub Main() + Console.WriteLine("Hello, world!") + End sub +End Module diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index 3b8d92bb84d..d541472ada7 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -101,6 +101,7 @@ null_gc_sources = \ common_sources = \ $(platform_sources) \ assembly.c \ + assembly-internals.h \ attach.h \ attach.c \ cil-coff.h \ @@ -225,7 +226,6 @@ common_sources = \ handle.c \ handle.h \ w32mutex.h \ - w32mutex-utils.h \ w32semaphore.h \ w32event.h \ w32handle-namespace.h \ diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index 13a545a67bb..0608394ff10 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -84,7 +84,7 @@ * Changes which are already detected at runtime, like the addition * of icalls, do not require an increment. */ -#define MONO_CORLIB_VERSION 156 +#define MONO_CORLIB_VERSION 157 typedef struct { diff --git a/mono/metadata/assembly-internals.h b/mono/metadata/assembly-internals.h new file mode 100644 index 00000000000..5af7bd6b9a3 --- /dev/null +++ b/mono/metadata/assembly-internals.h @@ -0,0 +1,12 @@ +/* + * Copyright 2015 Xamarin Inc + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#ifndef __MONO_METADATA_ASSEMBLY_INTERNALS_H__ +#define __MONO_METADATA_ASSEMBLY_INTERNALS_H__ + +#include + +MONO_API MonoImage* mono_assembly_load_module_checked (MonoAssembly *assembly, uint32_t idx, MonoError *error); + +#endif /* __MONO_METADATA_ASSEMBLY_INTERNALS_H__ */ diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c index af7cd6dfaa1..64d1000bbb6 100644 --- a/mono/metadata/assembly.c +++ b/mono/metadata/assembly.c @@ -16,7 +16,9 @@ #include #include #include "assembly.h" +#include "assembly-internals.h" #include "image.h" +#include "image-internals.h" #include "object-internals.h" #include #include @@ -3433,9 +3435,19 @@ mono_assembly_close (MonoAssembly *assembly) MonoImage* mono_assembly_load_module (MonoAssembly *assembly, guint32 idx) { - return mono_image_load_file_for_image (assembly->image, idx); + MonoError error; + MonoImage *result = mono_assembly_load_module_checked (assembly, idx, &error); + mono_error_assert_ok (&error); + return result; } +MONO_API MonoImage* +mono_assembly_load_module_checked (MonoAssembly *assembly, uint32_t idx, MonoError *error) +{ + return mono_image_load_file_for_image_checked (assembly->image, idx, error); +} + + /** * mono_assembly_foreach: * @func: function to invoke for each assembly loaded diff --git a/mono/metadata/assembly.h b/mono/metadata/assembly.h index bdf3d75f62c..b414971e171 100644 --- a/mono/metadata/assembly.h +++ b/mono/metadata/assembly.h @@ -1,6 +1,7 @@ #ifndef _MONONET_METADATA_ASSEMBLY_H_ #define _MONONET_METADATA_ASSEMBLY_H_ +#include #include MONO_BEGIN_DECLS @@ -32,7 +33,7 @@ MONO_API MonoAssembly* mono_assembly_loaded_full (MonoAssemblyName *aname, mono_ MONO_API void mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname); MONO_API void mono_assembly_load_reference (MonoImage *image, int index); MONO_API void mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status); -MONO_API MonoImage* mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx); +MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx); MONO_API void mono_assembly_close (MonoAssembly *assembly); MONO_API void mono_assembly_setrootdir (const char *root_dir); MONO_API MONO_CONST_RETURN char *mono_assembly_getrootdir (void); diff --git a/mono/metadata/boehm-gc.c b/mono/metadata/boehm-gc.c index d22f162085b..e7ee0517dd2 100644 --- a/mono/metadata/boehm-gc.c +++ b/mono/metadata/boehm-gc.c @@ -111,6 +111,10 @@ mono_gc_base_init (void) mono_counters_init (); +#ifndef HOST_WIN32 + mono_w32handle_init (); +#endif + /* * Handle the case when we are called from a thread different from the main thread, * confusing libgc. diff --git a/mono/metadata/class-internals.h b/mono/metadata/class-internals.h index b62d6155f91..a8e73da2776 100644 --- a/mono/metadata/class-internals.h +++ b/mono/metadata/class-internals.h @@ -1350,6 +1350,12 @@ mono_class_get_generic_container (MonoClass *klass); MonoGenericClass* mono_class_get_generic_class (MonoClass *klass); +gpointer +mono_class_alloc (MonoClass *klass, int size); + +gpointer +mono_class_alloc0 (MonoClass *klass, int size); + void mono_class_alloc_ext (MonoClass *klass); diff --git a/mono/metadata/class.c b/mono/metadata/class.c index a419af38149..6a206188977 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -18,7 +18,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -216,7 +218,7 @@ mono_class_from_typeref_checked (MonoImage *image, guint32 type_token, MonoError goto done; case MONO_RESOLUTION_SCOPE_MODULEREF: - module = mono_image_load_module (image, idx); + module = mono_image_load_module_checked (image, idx, error); if (module) res = mono_class_from_name_checked (module, nspace, name, error); goto done; @@ -1130,6 +1132,15 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k result->sre_method = FALSE; result->signature = NULL; + if (method->wrapper_type) { + MonoMethodWrapper *mw = (MonoMethodWrapper*)method; + MonoMethodWrapper *resw = (MonoMethodWrapper*)result; + int len = GPOINTER_TO_INT (((void**)mw->method_data) [0]); + + resw->method_data = (void **)g_malloc (sizeof (gpointer) * (len + 1)); + memcpy (resw->method_data, mw->method_data, sizeof (gpointer) * (len + 1)); + } + if (iresult->context.method_inst) { /* Set the generic_container of the result to the generic_container of method */ MonoGenericContainer *generic_container = mono_method_get_generic_container (method); @@ -1422,7 +1433,7 @@ mono_error_set_for_class_failure (MonoError *oerror, MonoClass *klass) * Allocate memory for some data belonging to CLASS, either from its image's mempool, * or from the heap. */ -static gpointer +gpointer mono_class_alloc (MonoClass *klass, int size) { if (klass->generic_class) @@ -1431,7 +1442,7 @@ mono_class_alloc (MonoClass *klass, int size) return mono_image_alloc (klass->image, size); } -static gpointer +gpointer mono_class_alloc0 (MonoClass *klass, int size) { gpointer res; @@ -7813,7 +7824,7 @@ search_modules (MonoImage *image, const char *name_space, const char *name, Mono if (cols [MONO_FILE_FLAGS] == FILE_CONTAINS_NO_METADATA) continue; - file_image = mono_image_load_file_for_image (image, i + 1); + file_image = mono_image_load_file_for_image_checked (image, i + 1, error); if (file_image) { klass = mono_class_from_name_checked (file_image, name_space, name, error); if (klass || !is_ok (error)) @@ -7909,7 +7920,7 @@ mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, cons impl = cols [MONO_EXP_TYPE_IMPLEMENTATION]; if ((impl & MONO_IMPLEMENTATION_MASK) == MONO_IMPLEMENTATION_FILE) { - loaded_image = mono_assembly_load_module (image->assembly, impl >> MONO_IMPLEMENTATION_BITS); + loaded_image = mono_assembly_load_module_checked (image->assembly, impl >> MONO_IMPLEMENTATION_BITS, error); if (!loaded_image) return NULL; klass = mono_class_from_name_checked_aux (loaded_image, name_space, name, visited_images, error); diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h index 5e3516eb17d..507c67244a7 100644 --- a/mono/metadata/icall-def.h +++ b/mono/metadata/icall-def.h @@ -293,9 +293,9 @@ ICALL(GC_0b, "GetMaxGeneration", mono_gc_max_generation) ICALL(GC_1, "GetTotalMemory", ves_icall_System_GC_GetTotalMemory) ICALL(GC_2, "InternalCollect", ves_icall_System_GC_InternalCollect) ICALL(GC_3, "KeepAlive", ves_icall_System_GC_KeepAlive) -ICALL(GC_4, "ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize) ICALL(GC_4a, "RecordPressure", mono_gc_add_memory_pressure) ICALL(GC_6, "WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers) +ICALL(GC_6b, "_ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize) ICALL(GC_7, "_SuppressFinalize", ves_icall_System_GC_SuppressFinalize) ICALL(GC_9, "get_ephemeron_tombstone", ves_icall_System_GC_get_ephemeron_tombstone) ICALL(GC_8, "register_ephemeron_array", ves_icall_System_GC_register_ephemeron_array) @@ -556,7 +556,6 @@ ICALL(MODULEB_8, "RegisterToken", ves_icall_ModuleBuilder_RegisterToken) ICALL(MODULEB_1, "WriteToFile", ves_icall_ModuleBuilder_WriteToFile) ICALL(MODULEB_2, "basic_init", ves_icall_ModuleBuilder_basic_init) ICALL(MODULEB_3, "build_metadata", ves_icall_ModuleBuilder_build_metadata) -ICALL(MODULEB_4, "create_modified_type", ves_icall_ModuleBuilder_create_modified_type) ICALL(MODULEB_5, "getMethodToken", ves_icall_ModuleBuilder_getMethodToken) ICALL(MODULEB_6, "getToken", ves_icall_ModuleBuilder_getToken) ICALL(MODULEB_7, "getUSIndex", ves_icall_ModuleBuilder_getUSIndex) diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index 6403f1975e9..526ff5e075e 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -43,7 +43,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -984,11 +986,6 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStac /* if we have no info we are optimistic and assume there is enough room */ if (!stack_addr) return TRUE; -#ifdef HOST_WIN32 - // FIXME: Windows dynamically extends the stack, so stack_addr might be close - // to the current sp - return TRUE; -#endif current = (guint8 *)&stack_addr; if (current > stack_addr) { if ((current - stack_addr) < min_size) @@ -4830,8 +4827,8 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflection g_assert ((impl & MONO_IMPLEMENTATION_MASK) == MONO_IMPLEMENTATION_FILE); file_idx = impl >> MONO_IMPLEMENTATION_BITS; - module = mono_image_load_file_for_image (assembly->assembly->image, file_idx); - if (!module) + module = mono_image_load_file_for_image_checked (assembly->assembly->image, file_idx, &error); + if (mono_error_set_pending_exception (&error) || !module) return NULL; } else @@ -5031,7 +5028,9 @@ ves_icall_System_Reflection_Assembly_GetModulesInternal (MonoReflectionAssembly mono_array_setref (res, j, rm); } else { - MonoImage *m = mono_image_load_file_for_image (image, i + 1); + MonoImage *m = mono_image_load_file_for_image_checked (image, i + 1, &error); + if (mono_error_set_pending_exception (&error)) + return NULL; if (!m) { MonoString *fname = mono_string_new (mono_domain_get (), mono_metadata_string_heap (image, cols [MONO_FILE_NAME])); mono_set_pending_exception (mono_get_exception_file_not_found2 (NULL, fname)); @@ -5555,7 +5554,9 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, /* Append data from all modules in the assembly */ for (i = 0; i < table->rows; ++i) { if (!(mono_metadata_decode_row_col (table, i, MONO_FILE_FLAGS) & FILE_CONTAINS_NO_METADATA)) { - MonoImage *loaded_image = mono_assembly_load_module (image->assembly, i + 1); + MonoImage *loaded_image = mono_assembly_load_module_checked (image->assembly, i + 1, &error); + if (mono_error_set_pending_exception (&error)) + return NULL; if (loaded_image) { MonoArray *ex2; MonoArray *res2; diff --git a/mono/metadata/image-internals.h b/mono/metadata/image-internals.h index 959575f6a0a..6281e3b241c 100644 --- a/mono/metadata/image-internals.h +++ b/mono/metadata/image-internals.h @@ -10,4 +10,10 @@ MonoImage * mono_find_image_owner (void *ptr); +MonoImage* +mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error); + +MonoImage* +mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error); + #endif /* __MONO_METADATA_IMAGE_INTERNALS_H__ */ diff --git a/mono/metadata/image.c b/mono/metadata/image.c index 50eaded2e37..ae1b204ca26 100644 --- a/mono/metadata/image.c +++ b/mono/metadata/image.c @@ -66,18 +66,43 @@ enum { }; static GHashTable *loaded_images_hashes [4] = {NULL, NULL, NULL, NULL}; -static GHashTable *get_loaded_images_hash (gboolean refonly) +static GHashTable * +get_loaded_images_hash (gboolean refonly) { int idx = refonly ? IMAGES_HASH_PATH_REFONLY : IMAGES_HASH_PATH; return loaded_images_hashes [idx]; } -static GHashTable *get_loaded_images_by_name_hash (gboolean refonly) +static GHashTable * +get_loaded_images_by_name_hash (gboolean refonly) { int idx = refonly ? IMAGES_HASH_NAME_REFONLY : IMAGES_HASH_NAME; return loaded_images_hashes [idx]; } +// Change the assembly set in `image` to the assembly set in `assemblyImage`. Halt if overwriting is attempted. +// Can be used on modules loaded through either the "file" or "module" mechanism +static gboolean +assign_assembly_parent_for_netmodule (MonoImage *image, MonoImage *assemblyImage, MonoError *error) +{ + // Assembly to assign + MonoAssembly *assembly = assemblyImage->assembly; + + while (1) { + // Assembly currently assigned + MonoAssembly *assemblyOld = image->assembly; + if (assemblyOld) { + if (assemblyOld == assembly) + return TRUE; + mono_error_set_bad_image (error, assemblyImage, "Attempted to load module %s which has already been loaded by assembly %s. This is not supported in Mono.", image->name, assemblyOld->image->name); + return FALSE; + } + gpointer result = InterlockedExchangePointer((gpointer *)&image->assembly, assembly); + if (result == assembly) + return TRUE; + } +} + static gboolean debug_assembly_unload = FALSE; #define mono_images_lock() if (mutex_inited) mono_os_mutex_lock (&images_mutex) @@ -632,13 +657,13 @@ load_modules (MonoImage *image) } /** - * mono_image_load_module: + * mono_image_load_module_checked: * * Load the module with the one-based index IDX from IMAGE and return it. Return NULL if - * it cannot be loaded. + * it cannot be loaded. NULL without MonoError being set will be interpreted as "not found". */ MonoImage* -mono_image_load_module (MonoImage *image, int idx) +mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error) { MonoTableInfo *t; MonoTableInfo *file_table; @@ -648,6 +673,8 @@ mono_image_load_module (MonoImage *image, int idx) GList *list_iter, *valid_modules = NULL; MonoImageOpenStatus status; + mono_error_init (error); + if ((image->module_count == 0) || (idx > image->module_count || idx <= 0)) return NULL; if (image->modules_loaded [idx - 1]) @@ -683,10 +710,18 @@ mono_image_load_module (MonoImage *image, int idx) } if (valid) { module_ref = g_build_filename (base_dir, name, NULL); - image->modules [idx - 1] = mono_image_open_full (module_ref, &status, refonly); - if (image->modules [idx - 1]) { - mono_image_addref (image->modules [idx - 1]); - image->modules [idx - 1]->assembly = image->assembly; + MonoImage *moduleImage = mono_image_open_full (module_ref, &status, refonly); + if (moduleImage) { + if (!assign_assembly_parent_for_netmodule (moduleImage, image, error)) { + mono_image_close (moduleImage); + g_free (module_ref); + g_free (base_dir); + g_list_free (valid_modules); + return NULL; + } + + image->modules [idx - 1] = image; + #ifdef HOST_WIN32 if (image->modules [idx - 1]->is_module_handle) mono_image_fixup_vtable (image->modules [idx - 1]); @@ -705,6 +740,15 @@ mono_image_load_module (MonoImage *image, int idx) return image->modules [idx - 1]; } +MonoImage* +mono_image_load_module (MonoImage *image, int idx) +{ + MonoError error; + MonoImage *result = mono_image_load_module_checked (image, idx, &error); + mono_error_assert_ok (&error); + return result; +} + static gpointer class_key_extract (gpointer value) { @@ -1653,6 +1697,17 @@ mono_wrapper_caches_free (MonoWrapperCaches *cache) free_hash (cache->thunk_invoke_cache); } +static void +mono_image_close_except_pools_all (MonoImage**images, int image_count) +{ + for (int i = 0; i < image_count; ++i) { + if (images [i]) { + if (!mono_image_close_except_pools (images [i])) + images [i] = NULL; + } + } +} + /* * Returns whether mono_image_close_finish() must be called as well. * We must unload images in two steps because clearing the domain in @@ -1773,7 +1828,6 @@ mono_image_close_except_pools (MonoImage *image) g_free (image->name); g_free (image->guid); g_free (image->version); - g_free (image->files); } if (image->method_cache) @@ -1852,12 +1906,8 @@ mono_image_close_except_pools (MonoImage *image) g_free (image->image_info); } - for (i = 0; i < image->module_count; ++i) { - if (image->modules [i]) { - if (!mono_image_close_except_pools (image->modules [i])) - image->modules [i] = NULL; - } - } + mono_image_close_except_pools_all (image->files, image->file_count); + mono_image_close_except_pools_all (image->modules, image->module_count); if (image->modules_loaded) g_free (image->modules_loaded); @@ -1876,6 +1926,17 @@ mono_image_close_except_pools (MonoImage *image) return TRUE; } +static void +mono_image_close_all (MonoImage**images, int image_count) +{ + for (int i = 0; i < image_count; ++i) { + if (images [i]) + mono_image_close_finish (images [i]); + } + if (images) + g_free (images); +} + void mono_image_close_finish (MonoImage *image) { @@ -1891,12 +1952,8 @@ mono_image_close_finish (MonoImage *image) image->references = NULL; } - for (i = 0; i < image->module_count; ++i) { - if (image->modules [i]) - mono_image_close_finish (image->modules [i]); - } - if (image->modules) - g_free (image->modules); + mono_image_close_all (image->files, image->file_count); + mono_image_close_all (image->modules, image->module_count); #ifndef DISABLE_PERFCOUNTERS mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (image->mempool); @@ -2153,8 +2210,9 @@ mono_image_get_resource (MonoImage *image, guint32 offset, guint32 *size) return data; } +// Returning NULL with no error set will be interpeted as "not found" MonoImage* -mono_image_load_file_for_image (MonoImage *image, int fileidx) +mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error) { char *base_dir, *name; MonoImage *res; @@ -2162,6 +2220,8 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx) const char *fname; guint32 fname_id; + mono_error_init (error); + if (fileidx < 1 || fileidx > t->rows) return NULL; @@ -2189,14 +2249,21 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx) } else { int i; /* g_print ("loaded file %s from %s (%p)\n", name, image->name, image->assembly); */ - res->assembly = image->assembly; + if (!assign_assembly_parent_for_netmodule (res, image, error)) { + mono_image_unlock (image); + mono_image_close (res); + return NULL; + } + for (i = 0; i < res->module_count; ++i) { if (res->modules [i] && !res->modules [i]->assembly) res->modules [i]->assembly = image->assembly; } - if (!image->files) + if (!image->files) { image->files = g_new0 (MonoImage*, t->rows); + image->file_count = t->rows; + } image->files [fileidx - 1] = res; mono_image_unlock (image); /* vtable fixup can't happen with the image lock held */ @@ -2212,6 +2279,15 @@ done: return res; } +MonoImage* +mono_image_load_file_for_image (MonoImage *image, int fileidx) +{ + MonoError error; + MonoImage *result = mono_image_load_file_for_image_checked (image, fileidx, &error); + mono_error_assert_ok (&error); + return result; +} + /** * mono_image_get_strong_name: * @image: a MonoImage diff --git a/mono/metadata/image.h b/mono/metadata/image.h index c3ad58b3431..b158ec26834 100644 --- a/mono/metadata/image.h +++ b/mono/metadata/image.h @@ -3,6 +3,7 @@ #include #include +#include MONO_BEGIN_DECLS @@ -50,9 +51,9 @@ MONO_API int mono_image_ensure_section_idx (MonoImage *image, MONO_API uint32_t mono_image_get_entry_point (MonoImage *image); MONO_API const char *mono_image_get_resource (MonoImage *image, uint32_t offset, uint32_t *size); -MONO_API MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx); +MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx); -MONO_API MonoImage* mono_image_load_module (MonoImage *image, int idx); +MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_image_load_module (MonoImage *image, int idx); MONO_API const char* mono_image_get_name (MonoImage *image); MONO_API const char* mono_image_get_filename (MonoImage *image); diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index 64e7d06e56f..e2a91f0975f 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -1123,6 +1123,14 @@ cached_module_load (const char *name, int flags, char **err) return res; } +void +mono_loader_register_module (const char *name, MonoDl *module) +{ + if (!global_module_map) + global_module_map = g_hash_table_new (g_str_hash, g_str_equal); + g_hash_table_insert (global_module_map, g_strdup (name), module); +} + static MonoDl *internal_module; static gboolean @@ -2133,8 +2141,6 @@ mono_method_get_wrapper_data (MonoMethod *method, guint32 id) g_assert (method != NULL); g_assert (method->wrapper_type != MONO_WRAPPER_NONE); - if (method->is_inflated) - method = ((MonoMethodInflated *) method)->declaring; data = (void **)((MonoMethodWrapper *)method)->method_data; g_assert (data != NULL); g_assert (id <= GPOINTER_TO_UINT (*data)); diff --git a/mono/metadata/loader.h b/mono/metadata/loader.h index a2c6d349ddf..6382c774ae3 100644 --- a/mono/metadata/loader.h +++ b/mono/metadata/loader.h @@ -4,6 +4,7 @@ #include #include #include +#include MONO_BEGIN_DECLS @@ -63,6 +64,8 @@ mono_lookup_internal_call (MonoMethod *method); void* mono_lookup_internal_call_full (MonoMethod *method, mono_bool *uses_handles); +void +mono_loader_register_module (const char *name, MonoDl *module); MONO_API const char* mono_lookup_icall_symbol (MonoMethod *m); diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c index b457211c83d..d12e345ca26 100644 --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@ -2691,6 +2691,11 @@ mono_marshal_method_from_wrapper (MonoMethod *wrapper) return info->d.runtime_invoke.method; else return NULL; + case MONO_WRAPPER_DELEGATE_INVOKE: + if (info) + return info->d.delegate_invoke.method; + else + return NULL; default: return NULL; } diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index a1b9eb84178..a529a3f3642 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -175,10 +175,12 @@ typedef struct { struct _MonoImage { /* - * The number of assemblies which reference this MonoImage though their 'image' - * field plus the number of images which reference this MonoImage through their - * 'modules' field, plus the number of threads holding temporary references to - * this image between calls of mono_image_open () and mono_image_close (). + * This count is incremented during these situations: + * - An assembly references this MonoImage though its 'image' field + * - This MonoImage is present in the 'files' field of an image + * - This MonoImage is present in the 'modules' field of an image + * - A thread is holding a temporary reference to this MonoImage between + * calls to mono_image_open and mono_image_close () */ int ref_count; @@ -258,16 +260,16 @@ struct _MonoImage { MonoAssembly **references; int nreferences; - /* Code files in the assembly. */ + /* Code files in the assembly. The main assembly has a "file" table and also a "module" + * table, where the module table is a subset of the file table. We track both lists, + * and because we can lazy-load them at different times we reference-increment both. + */ MonoImage **modules; guint32 module_count; gboolean *modules_loaded; - /* - * Files in the assembly. Items are either NULL or alias items in modules, so this does not impact ref_count. - * Protected by the image lock. - */ MonoImage **files; + guint32 file_count; gpointer aot_module; diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index 27115ccc9c1..f9e2bc51488 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -2789,6 +2789,9 @@ free_inflated_method (MonoMethodInflated *imethod) if (method->signature) mono_metadata_free_inflated_signature (method->signature); + if (method->wrapper_type) + g_free (((MonoMethodWrapper*)method)->method_data); + g_free (method); } diff --git a/mono/metadata/null-gc.c b/mono/metadata/null-gc.c index 1ab1e0ebb2d..0f47c00fa62 100644 --- a/mono/metadata/null-gc.c +++ b/mono/metadata/null-gc.c @@ -26,6 +26,10 @@ mono_gc_base_init (void) mono_counters_init (); +#ifndef HOST_WIN32 + mono_w32handle_init (); +#endif + memset (&cb, 0, sizeof (cb)); /* TODO: This casts away an incompatible pointer type warning in the same manner that boehm-gc does it. This is probably worth investigating diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h index d28bd6c9f79..d643b57206a 100644 --- a/mono/metadata/object-internals.h +++ b/mono/metadata/object-internals.h @@ -381,6 +381,7 @@ struct _MonoInternalThread { gpointer thread_pinning_ref; gsize abort_protected_block_count; gint32 priority; + GPtrArray *owned_mutexes; /* * These fields are used to avoid having to increment corlib versions * when a new field is added to this structure. @@ -1800,9 +1801,6 @@ void ves_icall_EnumBuilder_setup_enum_type (MonoReflectionType *enumtype, MonoReflectionType *t); -MonoReflectionType* -ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers); - void ves_icall_ModuleBuilder_basic_init (MonoReflectionModuleBuilder *moduleb); diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index 92b6f0686fe..4b6a5d355ef 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -2208,12 +2208,9 @@ sgen_client_thread_register (SgenThreadInfo* info, void *stack_bottom_fallback) info->client_info.signal = 0; #endif - /* On win32, stack_start_limit should be 0, since the stack can grow dynamically */ mono_thread_info_get_stack_bounds (&staddr, &stsize); if (staddr) { -#ifndef HOST_WIN32 info->client_info.stack_start_limit = staddr; -#endif info->client_info.stack_end = staddr + stsize; } else { gsize stack_bottom = (gsize)stack_bottom_fallback; @@ -2973,6 +2970,10 @@ mono_gc_base_init (void) mono_counters_init (); +#ifndef HOST_WIN32 + mono_w32handle_init (); +#endif + #ifdef HEAVY_STATISTICS mono_counters_register ("los marked cards", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &los_marked_cards); mono_counters_register ("los array cards scanned ", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &los_array_cards); diff --git a/mono/metadata/sgen-os-win32.c b/mono/metadata/sgen-os-win32.c index 8b78616129a..d78be35069d 100644 --- a/mono/metadata/sgen-os-win32.c +++ b/mono/metadata/sgen-os-win32.c @@ -21,7 +21,7 @@ sgen_resume_thread (SgenThreadInfo *info) CloseHandle (handle); - return result != (DWORD)-1; + return result != (DWORD)-1 && result > 0; } gboolean diff --git a/mono/metadata/socket-io.c b/mono/metadata/socket-io.c index d4d168da766..b4a85f27fa4 100644 --- a/mono/metadata/socket-io.c +++ b/mono/metadata/socket-io.c @@ -1787,7 +1787,7 @@ Socket_to_SOCKET (MonoObject *sockobj) MonoSafeHandle *safe_handle; MonoClassField *field; - field = mono_class_get_field_from_name (sockobj->vtable->klass, "safe_handle"); + field = mono_class_get_field_from_name (sockobj->vtable->klass, "m_Handle"); safe_handle = ((MonoSafeHandle *)(*(gpointer *)(((char *)sockobj) + field->offset))); if (safe_handle == NULL) diff --git a/mono/metadata/sre.c b/mono/metadata/sre.c index c15bd42b74a..80ab849b688 100644 --- a/mono/metadata/sre.c +++ b/mono/metadata/sre.c @@ -5220,77 +5220,6 @@ ves_icall_EnumBuilder_setup_enum_type (MonoReflectionType *enumtype, enumtype->type = t->type; } -MonoReflectionType* -ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers) -{ - MonoError error; - MonoReflectionType *ret; - MonoClass *klass; - int isbyref = 0, rank; - char *p; - char *str = mono_string_to_utf8_checked (smodifiers, &error); - if (mono_error_set_pending_exception (&error)) - return NULL; - - klass = mono_class_from_mono_type (tb->type.type); - p = str; - /* logic taken from mono_reflection_parse_type(): keep in sync */ - while (*p) { - switch (*p) { - case '&': - if (isbyref) { /* only one level allowed by the spec */ - g_free (str); - return NULL; - } - isbyref = 1; - p++; - - g_free (str); - - ret = mono_type_get_object_checked (mono_object_domain (tb), &klass->this_arg, &error); - mono_error_set_pending_exception (&error); - - return ret; - case '*': - klass = mono_ptr_class_get (&klass->byval_arg); - mono_class_init (klass); - p++; - break; - case '[': - rank = 1; - p++; - while (*p) { - if (*p == ']') - break; - if (*p == ',') - rank++; - else if (*p != '*') { /* '*' means unknown lower bound */ - g_free (str); - return NULL; - } - ++p; - } - if (*p != ']') { - g_free (str); - return NULL; - } - p++; - klass = mono_array_class_get (klass, rank); - mono_class_init (klass); - break; - default: - break; - } - } - - g_free (str); - - ret = mono_type_get_object_checked (mono_object_domain (tb), &klass->byval_arg, &error); - mono_error_set_pending_exception (&error); - - return ret; -} - void ves_icall_ModuleBuilder_basic_init (MonoReflectionModuleBuilder *moduleb) { diff --git a/mono/metadata/threadpool-ms.c b/mono/metadata/threadpool-ms.c index 462fd69a77f..7849d4554f5 100644 --- a/mono/metadata/threadpool-ms.c +++ b/mono/metadata/threadpool-ms.c @@ -162,7 +162,7 @@ typedef struct { typedef struct { gint32 ref; - MonoCoopSem sem; + MonoCoopCond cond; } ThreadPoolDomainCleanupSemaphore; typedef enum { @@ -439,7 +439,7 @@ domain_get (MonoDomain *domain, gboolean create) ThreadPoolDomainCleanupSemaphore *cleanup_semaphore; cleanup_semaphore = g_new0 (ThreadPoolDomainCleanupSemaphore, 1); cleanup_semaphore->ref = 2; - mono_coop_sem_init (&cleanup_semaphore->sem, 0); + mono_coop_cond_init (&cleanup_semaphore->cond); g_assert(!domain->cleanup_semaphore); domain->cleanup_semaphore = cleanup_semaphore; @@ -702,11 +702,12 @@ worker_thread (gpointer data) g_assert (removed); cleanup_semaphore = (ThreadPoolDomainCleanupSemaphore*) tpdomain->domain->cleanup_semaphore; + g_assert (cleanup_semaphore); + + mono_coop_cond_signal (&cleanup_semaphore->cond); - g_assert(cleanup_semaphore); - mono_coop_sem_post (&cleanup_semaphore->sem); if (InterlockedDecrement (&cleanup_semaphore->ref) == 0) { - mono_coop_sem_destroy (&cleanup_semaphore->sem); + mono_coop_cond_destroy (&cleanup_semaphore->cond); g_free (cleanup_semaphore); tpdomain->domain->cleanup_semaphore = NULL; } @@ -1453,10 +1454,10 @@ mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, Mono gboolean mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout) { - gint res; - gint64 now, end; + gint64 end; ThreadPoolDomain *tpdomain; ThreadPoolDomainCleanupSemaphore *cleanup_semaphore; + gboolean ret; g_assert (domain); g_assert (timeout >= -1); @@ -1493,29 +1494,41 @@ mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout) return TRUE; } - mono_coop_mutex_unlock(&threadpool->domains_lock); - g_assert (domain->cleanup_semaphore); - cleanup_semaphore = (ThreadPoolDomainCleanupSemaphore*) domain->cleanup_semaphore; - if (timeout == -1) { - res = mono_coop_sem_wait (&cleanup_semaphore->sem, MONO_SEM_FLAGS_NONE); - g_assert (res == MONO_SEM_TIMEDWAIT_RET_SUCCESS); - } else { - now = mono_msec_ticks(); - if (now > end) - return FALSE; - res = mono_coop_sem_timedwait (&cleanup_semaphore->sem, end - now, MONO_SEM_FLAGS_NONE); - } + ret = TRUE; + + do { + if (timeout == -1) { + mono_coop_cond_wait (&cleanup_semaphore->cond, &threadpool->domains_lock); + } else { + gint64 now; + gint res; + + now = mono_msec_ticks(); + if (now > end) { + ret = FALSE; + break; + } + + res = mono_coop_cond_timedwait (&cleanup_semaphore->cond, &threadpool->domains_lock, end - now); + if (res != 0) { + ret = FALSE; + break; + } + } + } while (tpdomain->outstanding_request != 0); if (InterlockedDecrement (&cleanup_semaphore->ref) == 0) { - mono_coop_sem_destroy (&cleanup_semaphore->sem); + mono_coop_cond_destroy (&cleanup_semaphore->cond); g_free (cleanup_semaphore); domain->cleanup_semaphore = NULL; } - return res == MONO_SEM_TIMEDWAIT_RET_SUCCESS; + mono_coop_mutex_unlock(&threadpool->domains_lock); + + return ret; } void diff --git a/mono/metadata/threads-types.h b/mono/metadata/threads-types.h index e1ea4217d01..a7fd76f1f1c 100644 --- a/mono/metadata/threads-types.h +++ b/mono/metadata/threads-types.h @@ -266,4 +266,7 @@ mono_thread_internal_current_is_attached (void); void mono_thread_internal_describe (MonoInternalThread *internal, GString *str); +gboolean +mono_thread_internal_is_current (MonoInternalThread *internal); + #endif /* _MONO_METADATA_THREADS_TYPES_H_ */ diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 3cdd6d58a29..7a237962880 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -1117,6 +1118,10 @@ mono_thread_detach_internal (MonoInternalThread *thread) THREAD_DEBUG (g_message ("%s: mono_thread_detach for %p (%"G_GSIZE_FORMAT")", __func__, thread, (gsize)thread->tid)); +#ifndef HOST_WIN32 + mono_w32mutex_abandon (); +#endif + thread_cleanup (thread); SET_CURRENT_OBJECT (NULL); @@ -5162,23 +5167,26 @@ mono_threads_is_ready_to_be_interrupted (void) void mono_thread_internal_describe (MonoInternalThread *internal, GString *text) { - MonoThreadInfo *info; - g_string_append_printf (text, ", thread handle : %p", internal->handle); - info = (MonoThreadInfo*) internal->thread_info; - if (!info) - return; - - g_string_append (text, ", state : "); - mono_thread_info_describe_interrupt_token (info, text); + if (internal->thread_info) { + g_string_append (text, ", state : "); + mono_thread_info_describe_interrupt_token ((MonoThreadInfo*) internal->thread_info, text); + } - if (info->owned_mutexes) { + if (internal->owned_mutexes) { int i; g_string_append (text, ", owns : ["); - for (i = 0; i < info->owned_mutexes->len; i++) - g_string_append_printf (text, i == 0 ? "%p" : ", %p", g_ptr_array_index (info->owned_mutexes, i)); + for (i = 0; i < internal->owned_mutexes->len; i++) + g_string_append_printf (text, i == 0 ? "%p" : ", %p", g_ptr_array_index (internal->owned_mutexes, i)); g_string_append (text, "]"); } } + +gboolean +mono_thread_internal_is_current (MonoInternalThread *internal) +{ + g_assert (internal); + return mono_native_thread_id_equals (mono_native_thread_id_get (), MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid)); +} diff --git a/mono/metadata/w32mutex-unix.c b/mono/metadata/w32mutex-unix.c index 5ffdda1af94..a995eeb3640 100644 --- a/mono/metadata/w32mutex-unix.c +++ b/mono/metadata/w32mutex-unix.c @@ -8,12 +8,12 @@ */ #include "w32mutex.h" -#include "w32mutex-utils.h" #include #include "w32handle-namespace.h" #include "mono/io-layer/io-layer.h" +#include "mono/metadata/object-internals.h" #include "mono/utils/mono-logger-internals.h" #include "mono/utils/mono-threads.h" #include "mono/utils/w32handle.h" @@ -29,6 +29,35 @@ struct MonoW32HandleNamedMutex { MonoW32HandleNamespace sharedns; }; +static void +thread_own_mutex (MonoInternalThread *internal, gpointer handle) +{ + mono_w32handle_ref (handle); + + /* if we are not on the current thread, there is a + * race condition when allocating internal->owned_mutexes */ + g_assert (mono_thread_internal_is_current (internal)); + + if (!internal->owned_mutexes) + internal->owned_mutexes = g_ptr_array_new (); + + g_ptr_array_add (internal->owned_mutexes, handle); +} + +static void +thread_disown_mutex (MonoInternalThread *internal, gpointer handle) +{ + gboolean removed; + + g_assert (mono_thread_internal_is_current (internal)); + + g_assert (internal->owned_mutexes); + removed = g_ptr_array_remove (internal->owned_mutexes, handle); + g_assert (removed); + + mono_w32handle_unref (handle); +} + static gboolean mutex_handle_own (gpointer handle, MonoW32HandleType type, guint32 *statuscode) { @@ -41,15 +70,20 @@ mutex_handle_own (gpointer handle, MonoW32HandleType type, guint32 *statuscode) return FALSE; } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, tid %p, recursion %u", - __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, before: [tid: %p, recursion: %d], after: [tid: %p, recursion: %d], abandoned: %s", + __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false"); + + if (mutex_handle->recursion != 0) { + g_assert (pthread_equal (pthread_self (), mutex_handle->tid)); + mutex_handle->recursion++; + } else { + mutex_handle->tid = pthread_self (); + mutex_handle->recursion = 1; - mono_thread_info_own_mutex (mono_thread_info_current (), handle); + thread_own_mutex (mono_thread_internal_current (), handle); + } - mutex_handle->tid = pthread_self (); - mutex_handle->recursion++; if (mutex_handle->abandoned) { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: mutex handle %p was abandoned", __func__, handle); mutex_handle->abandoned = FALSE; *statuscode = WAIT_ABANDONED_0; } @@ -77,8 +111,8 @@ mutex_handle_is_owned (gpointer handle, MonoW32HandleType type) __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self ()); return TRUE; } else { - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, but locked %d times by %p", - __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self (), mutex_handle->recursion, (gpointer) mutex_handle->tid); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, tid: %p recursion: %d", + __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion); return FALSE; } } @@ -363,8 +397,8 @@ ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle) return FALSE; } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p", - __func__, mono_w32handle_ops_typename (type), handle); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p, tid: %p recursion: %d", + __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion); thr_ret = mono_w32handle_lock_handle (handle); g_assert (thr_ret == 0); @@ -386,10 +420,10 @@ ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle) mutex_handle->recursion--; if (mutex_handle->recursion == 0) { - mono_thread_info_disown_mutex (mono_thread_info_current (), handle); + thread_disown_mutex (mono_thread_internal_current (), handle); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p", - __func__, mono_w32handle_ops_typename (type), handle); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d", + __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion); mutex_handle->tid = 0; mono_w32handle_set_signal_state (handle, TRUE, FALSE); @@ -441,45 +475,69 @@ cleanup: } void -mono_w32mutex_abandon (gpointer handle, MonoNativeThreadId tid) +mono_w32mutex_abandon (void) { - MonoW32HandleType type; - MonoW32HandleMutex *mutex_handle; - int thr_ret; + MonoInternalThread *internal; - switch (type = mono_w32handle_get_type (handle)) { - case MONO_W32HANDLE_MUTEX: - case MONO_W32HANDLE_NAMEDMUTEX: - break; - default: - g_assert_not_reached (); - } + g_assert (mono_thread_internal_current_is_attached ()); - if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) { - g_warning ("%s: error looking up %s handle %p", - __func__, mono_w32handle_ops_typename (type), handle); + internal = mono_thread_internal_current (); + g_assert (internal); + + if (!internal->owned_mutexes) return; - } - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandon %s handle %p", - __func__, mono_w32handle_ops_typename (type), handle); + while (internal->owned_mutexes->len) { + MonoW32HandleType type; + MonoW32HandleMutex *mutex_handle; + MonoNativeThreadId tid; + gpointer handle; + int thr_ret; + + handle = g_ptr_array_index (internal->owned_mutexes, 0); + + switch (type = mono_w32handle_get_type (handle)) { + case MONO_W32HANDLE_MUTEX: + case MONO_W32HANDLE_NAMEDMUTEX: + break; + default: + g_assert_not_reached (); + } - thr_ret = mono_w32handle_lock_handle (handle); - g_assert (thr_ret == 0); + if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) { + g_error ("%s: error looking up %s handle %p", + __func__, mono_w32handle_ops_typename (type), handle); + } + + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoning %s handle %p", + __func__, mono_w32handle_ops_typename (type), handle); + + tid = MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid); + + if (!pthread_equal (mutex_handle->tid, tid)) + g_error ("%s: trying to release mutex %p acquired by thread %p from thread %p", + __func__, handle, (gpointer) mutex_handle->tid, (gpointer) tid); + + thr_ret = mono_w32handle_lock_handle (handle); + g_assert (thr_ret == 0); - if (pthread_equal (mutex_handle->tid, tid)) { mutex_handle->recursion = 0; mutex_handle->tid = 0; mutex_handle->abandoned = TRUE; mono_w32handle_set_signal_state (handle, TRUE, FALSE); + thread_disown_mutex (internal, handle); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoned %s handle %p", __func__, mono_w32handle_ops_typename (type), handle); + + thr_ret = mono_w32handle_unlock_handle (handle); + g_assert (thr_ret == 0); } - thr_ret = mono_w32handle_unlock_handle (handle); - g_assert (thr_ret == 0); + g_ptr_array_free (internal->owned_mutexes, TRUE); + internal->owned_mutexes = NULL; } MonoW32HandleNamespace* diff --git a/mono/metadata/w32mutex-utils.h b/mono/metadata/w32mutex-utils.h deleted file mode 100644 index a7bad8cf977..00000000000 --- a/mono/metadata/w32mutex-utils.h +++ /dev/null @@ -1,20 +0,0 @@ - -/* This is just a hack so we can call mono_w32mutex_abandon - * from mono/utils/mono-threads-posix.c, without importing - * the whole object.h - * In the best of all world, mutex owning + disowning + abandoning - * should be done in metadata/ */ - -#ifndef _MONO_METADATA_W32MUTEX_UTILS_H_ -#define _MONO_METADATA_W32MUTEX_UTILS_H_ - -#include -#include - -#include "mono/utils/mono-threads.h" - -void -mono_w32mutex_abandon (gpointer handle, MonoNativeThreadId tid); - -#endif /* _MONO_METADATA_W32MUTEX_UTILS_H_ */ - diff --git a/mono/metadata/w32mutex.h b/mono/metadata/w32mutex.h index 3c636192c5e..917b36f1dd3 100644 --- a/mono/metadata/w32mutex.h +++ b/mono/metadata/w32mutex.h @@ -25,4 +25,9 @@ typedef struct MonoW32HandleNamedMutex MonoW32HandleNamedMutex; MonoW32HandleNamespace* mono_w32mutex_get_namespace (MonoW32HandleNamedMutex *mutex); +#ifndef HOST_WIN32 +void +mono_w32mutex_abandon (void); +#endif + #endif /* _MONO_METADATA_W32MUTEX_H_ */ diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index 3ad4c53b921..4a502964121 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -219,6 +219,7 @@ typedef struct MonoAotCompile { gboolean gas_line_numbers; /* Whenever to emit an object file directly from llc */ gboolean llvm_owriter; + gboolean llvm_owriter_supported; MonoImageWriter *w; MonoDwarfWriter *dwarf; FILE *fp; @@ -879,6 +880,7 @@ arch_init (MonoAotCompile *acfg) { acfg->llc_args = g_string_new (""); acfg->as_args = g_string_new (""); + acfg->llvm_owriter_supported = TRUE; /* * The prefix LLVM likes to put in front of symbol names on darwin. @@ -941,6 +943,10 @@ arch_init (MonoAotCompile *acfg) #ifdef MONOTOUCH acfg->global_symbols = TRUE; #endif + +#ifdef TARGET_ANDROID + acfg->llvm_owriter_supported = FALSE; +#endif } #ifdef TARGET_ARM64 @@ -9963,16 +9969,23 @@ compile_asm (MonoAotCompile *acfg) wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags); #else // Default (linux) - char *args = g_strdup_printf ("%s -shared -o %s %s %s %s", LD_OPTIONS, - wrap_path (tmp_outfile_name), wrap_path (llvm_ofile), - wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags); - - if (acfg->llvm) { - command = g_strdup_printf ("clang++ %s", args); + if (acfg->aot_opts.tool_prefix) { + /* Cross compiling */ + command = g_strdup_printf ("\"%sld\" %s -shared -o %s %s %s %s", tool_prefix, LD_OPTIONS, + wrap_path (tmp_outfile_name), wrap_path (llvm_ofile), + wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags); } else { - command = g_strdup_printf ("\"%sld\" %s", tool_prefix, args); + char *args = g_strdup_printf ("%s -shared -o %s %s %s %s", LD_OPTIONS, + wrap_path (tmp_outfile_name), wrap_path (llvm_ofile), + wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags); + + if (acfg->llvm) { + command = g_strdup_printf ("clang++ %s", args); + } else { + command = g_strdup_printf ("\"%sld\" %s", tool_prefix, args); + } + g_free (args); } - g_free (args); #endif aot_printf (acfg, "Executing the native linker: %s\n", command); @@ -10500,19 +10513,6 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options) aot_printerrf (acfg, "Compiling with LLVM and the asm-only option requires the llvm-outputfile= option."); return 1; } - - /* - * Emit all LLVM code into a separate assembly/object file and link with it - * normally. - */ - if (!acfg->aot_opts.asm_only) { - acfg->llvm_owriter = TRUE; - } else if (acfg->aot_opts.llvm_outfile) { - int len = strlen (acfg->aot_opts.llvm_outfile); - - if (len >= 2 && acfg->aot_opts.llvm_outfile [len - 2] == '.' && acfg->aot_opts.llvm_outfile [len - 1] == 'o') - acfg->llvm_owriter = TRUE; - } } if (mono_aot_mode_is_full (&acfg->aot_opts)) @@ -10545,6 +10545,22 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options) arch_init (acfg); + if (mono_use_llvm || acfg->aot_opts.llvm) { + + /* + * Emit all LLVM code into a separate assembly/object file and link with it + * normally. + */ + if (!acfg->aot_opts.asm_only && acfg->llvm_owriter_supported) { + acfg->llvm_owriter = TRUE; + } else if (acfg->aot_opts.llvm_outfile) { + int len = strlen (acfg->aot_opts.llvm_outfile); + + if (len >= 2 && acfg->aot_opts.llvm_outfile [len - 2] == '.' && acfg->aot_opts.llvm_outfile [len - 1] == 'o') + acfg->llvm_owriter = TRUE; + } + } + if (acfg->llvm && acfg->thumb_mixed) acfg->flags = (MonoAotFileFlags)(acfg->flags | MONO_AOT_FILE_FLAG_LLVM_THUMB); if (acfg->aot_opts.llvm_only) diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 9a4d566c754..0da4ad6168d 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -4025,32 +4025,6 @@ find_aot_method_in_amodule (MonoAotModule *amodule, MonoMethod *method, guint32 break; } - /* - * Special case: wrappers of shared generic methods. - * This is needed because of the way mini_get_shared_method () works, - * we could end up with multiple copies of the same wrapper. - */ - if (m && method->wrapper_type && method->wrapper_type == m->wrapper_type && - method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) { - MonoMethod *w1 = mono_marshal_method_from_wrapper (method); - MonoMethod *w2 = mono_marshal_method_from_wrapper (m); - - if ((w1 == w2) || (w1->is_inflated && ((MonoMethodInflated *)w1)->declaring == w2)) { - index = value; - break; - } - } - if (m && method->wrapper_type && method->wrapper_type == m->wrapper_type && - method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE) { - WrapperInfo *info1 = mono_marshal_get_wrapper_info (method); - WrapperInfo *info2 = mono_marshal_get_wrapper_info (m); - - if (info1 && info2 && info1->subtype == info2->subtype && info1->d.delegate_invoke.method == info2->d.delegate_invoke.method) { - index = value; - break; - } - } - /* Methods decoded needlessly */ if (m) { //printf ("%d %s %s %p\n", n_extra_decodes, mono_method_full_name (method, TRUE), mono_method_full_name (m, TRUE), orig_p); diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 7aa562c591d..9bfbb44647b 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -271,7 +271,7 @@ typedef struct { #define HEADER_LENGTH 11 #define MAJOR_VERSION 2 -#define MINOR_VERSION 43 +#define MINOR_VERSION 44 typedef enum { CMD_SET_VM = 1, @@ -499,6 +499,7 @@ typedef enum { CMD_STACK_FRAME_GET_THIS = 2, CMD_STACK_FRAME_SET_VALUES = 3, CMD_STACK_FRAME_GET_DOMAIN = 4, + CMD_STACK_FRAME_SET_THIS = 5, } CmdStackFrame; typedef enum { @@ -9269,6 +9270,25 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf) buffer_add_domainid (buf, frame->domain); break; } + case CMD_STACK_FRAME_SET_THIS: { + guint8 *val_buf; + MonoType *t; + MonoDebugVarInfo *var; + + t = &frame->actual_method->klass->byval_arg; + /* Checked by the sender */ + g_assert (MONO_TYPE_ISSTRUCT (t)); + var = jit->this_var; + g_assert (var); + + val_buf = (guint8 *)g_alloca (mono_class_instance_size (mono_class_from_mono_type (t))); + err = decode_value (t, frame->domain, val_buf, p, &p, end); + if (err != ERR_NONE) + return err; + + set_var (&frame->actual_method->klass->this_arg, var, &frame->ctx, frame->domain, val_buf, frame->reg_locations, &tls->restore_state.ctx); + break; + } default: return ERR_NOT_IMPLEMENTED; } @@ -9688,6 +9708,7 @@ static const char* stack_frame_cmds_str[] = { "GET_THIS", "SET_VALUES", "GET_DOMAIN", + "SET_THIS" }; static const char* array_cmds_str[] = { diff --git a/mono/mini/driver.c b/mono/mini/driver.c index a6d2bd117b1..6e06724a9f0 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -1500,6 +1500,7 @@ switch_gc (char* argv[], const char* target_gc) #ifdef HAVE_EXECVP execvp (path->str, argv); + fprintf (stderr, "Error: Failed to switch to %s gc. mono-%s is not installed.\n", target_gc, target_gc); #else fprintf (stderr, "Error: --gc= option not supported on this platform.\n"); #endif diff --git a/mono/mini/ir-emit.h b/mono/mini/ir-emit.h index abfa1ffe73b..ba9d6531367 100644 --- a/mono/mini/ir-emit.h +++ b/mono/mini/ir-emit.h @@ -100,11 +100,48 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) } } +/* + * Macros used to generate intermediate representation macros + * + * The macros use a `MonoConfig` object as its context, and among other + * things it is used to associate instructions with the memory pool with + * it. + * + * The macros come in three variations with slightly different + * features, the patter is: NEW_OP, EMIT_NEW_OP, MONO_EMIT_NEW_OP, + * the differences are as follows: + * + * `NEW_OP`: these are the basic macros to setup an instruction that is + * passed as an argument. + * + * `EMIT_NEW_OP`: these macros in addition to creating the instruction + * add the instruction to the current basic block in the `MonoConfig` + * object passed. Usually these are used when further customization of + * the `inst` parameter is desired before the instruction is added to the + * MonoConfig current basic block. + * + * `MONO_EMIT_NEW_OP`: These variations of the instructions are used when + * you are merely interested in emitting the instruction into the `MonoConfig` + * parameter. + */ #undef MONO_INST_NEW /* * FIXME: zeroing out some fields is not needed with the new IR, but the old * JIT code still uses the left and right fields, so it has to stay. */ + +/* + * MONO_INST_NEW: create a new MonoInst instance that is allocated on the MonoConfig pool. + * + * @cfg: the MonoConfig object that will be used as the context for the + * instruction. + * @dest: this is the place where the instance of the `MonoInst` is stored. + * @op: the value that should be stored in the MonoInst.opcode field + * + * This initializes an empty MonoInst that has been nulled out, it is allocated + * from the memory pool associated with the MonoConfig, but it is not linked anywhere. + * the cil_code is set to the cfg->ip address. + */ #define MONO_INST_NEW(cfg,dest,op) do { \ (dest) = (MonoInst *)mono_mempool_alloc ((cfg)->mempool, sizeof (MonoInst)); \ (dest)->inst_c0 = (dest)->inst_c1 = 0; \ diff --git a/mono/mini/main.c b/mono/mini/main.c index 8d2f5bd1712..6149ca75fa0 100644 --- a/mono/mini/main.c +++ b/mono/mini/main.c @@ -1,8 +1,24 @@ +/* + * main.c: The main entry point for the mono executable + * + * The main entry point does a few things: + * + * * It probes whether the executable has a bundle appended + * at the end, and if so, registers the various bundled + * resources with Mono and executes the contained bundle + * + * * Parses the MONO_ENV_OPTIONS variable to treat the + * contents of the variable as command line arguments for + * the mono runtime + * + * * Launches Mono, by calling mono_main. + */ #include #include #include #include #include +#include #include "mini.h" #ifdef HAVE_UNISTD_H @@ -29,6 +45,51 @@ mono_main_with_options (int argc, char *argv []) return mono_main (argc, argv); } +/* + * The Mono executable can initialize itself from a payload attached + * at the end of the main program. The payload contains the + * main assembly, one or more managed assemblies, configuration + * files and other assets that are used instead of launching a + * program from the command line. + * + * The startup sequence probes for a magical signature at the end of + * the executable, if the 16 characters "xmonkeysloveplay" are found, + * the code expects the 64-bits just before it to contain an offset + * within the executable with a directory of assets. + * + * All pointers in the file format are encoded as little-endian values + * + * The format of the file is thus: + * + * Location Content + * -------- ------- + * lenght-16 Optional "xmonkeysloveplay", indicating that a + * bundled payload is contained in the executable. + * length-24 pointer to the directory in the file, address DIR + * + * DIR 32-bit value with the number of entries in the directory + * DIR+4 First directory entry. + * + * Each directory entry is made up of: + * 4-bytes uint32_t containing the size of a string (STR) + * STRING UTF8 encoded and \0 terminated string + * 8-bytes uint64_t offset in the file with the payload associated with STRING + * 4-bytes uint32_t size of the asset + * + * The following are the known directory entries, without the quotes: + * "assembly:NAME" An assembly with the name NAME, assembly is in the payload + * "config:NAME" A configuration file (usually file.dll.config) in the payload that is + * loaded as the config file for an assembly + * "systemconfig:" Treats as a Mono system configuration, payload contains the config file. + * "options:" The payload contains command line options to initialize Mono, as if you + had set them on MONO_ENV_OPTIONS + * "config_dir:DIR" Configures the MONO_PATH to point to point to DIR + * "machineconfig:" The payload contains the machine.config file to use at runtime + * "env:" Sets the environment variable to the value encoded in the payload + * payload contains: 1-byte lenght for the \0 terminated variable, + * followed by the value. + * "library:NAME" Bundled dynamic library NAME, payload contains the dynamic library + */ #define STREAM_INT(x) GUINT32_TO_LE((*(uint32_t*)x)) #define STREAM_LONG(x) GUINT64_TO_LE((*(uint64_t*)x)) @@ -64,6 +125,60 @@ load_from_region (int fd, uint64_t offset, uint64_t size) return buffer; } +/* Did we initialize the temporary directory for dynamic libraries */ +static int bundle_save_library_initialized; + +/* List of bundled libraries we unpacked */ +static GSList *bundle_library_paths; + +/* Directory where we unpacked dynamic libraries */ +static char *bundled_dylibrary_directory; + +static void +delete_bundled_libraries () +{ + GSList *list; + + for (list = bundle_library_paths; list != NULL; list = list->next){ + unlink (list->data); + } + rmdir (bundled_dylibrary_directory); +} + +static void +bundle_save_library_initialize () +{ + bundle_save_library_initialized = 1; + char *path = g_build_filename (g_get_tmp_dir (), "mono-bundle-XXXXXX"); + bundled_dylibrary_directory = g_mkdtemp (path); + g_free (path); + if (bundled_dylibrary_directory == NULL) + return; + atexit (delete_bundled_libraries); +} + +static void +save_library (int fd, uint64_t offset, uint64_t size, const char *destfname) +{ + MonoDl *lib; + char *file, *buffer, *err; + if (!bundle_save_library_initialized) + bundle_save_library_initialize (); + + file = g_build_filename (bundled_dylibrary_directory, destfname); + buffer = load_from_region (fd, offset, size); + g_file_set_contents (file, buffer, size, NULL); + lib = mono_dl_open (file, MONO_DL_LAZY, &err); + if (err != NULL){ + fprintf (stderr, "Error loading shared library: %s\n", file); + exit (1); + } + mono_loader_register_module (destfname, lib); + bundle_library_paths = g_slist_append (bundle_library_paths, file); + + g_free (buffer); +} + static gboolean probe_embedded (const char *program, int *ref_argc, char **ref_argv []) { @@ -150,13 +265,15 @@ probe_embedded (const char *program, int *ref_argc, char **ref_argv []) uint8_t count = *data++; char *value = data + count + 1; g_setenv (data, value, FALSE); + } else if (strncmp (kind, "library:", strlen ("library:")) == 0){ + save_library (fd, offset, item_size, kind + strlen ("library:")); } else { fprintf (stderr, "Unknown stream on embedded package: %s\n", kind); exit (1); } } g_array_append_val (assemblies, last); - + mono_register_bundled_assemblies ((const MonoBundledAssembly **) assemblies->data); new_argv = g_new (char *, (*ref_argc)+1); for (j = 0; j < *ref_argc; j++) diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 1b55991ff02..95b0002ea91 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -6125,8 +6125,13 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign return NULL; } else if (cmethod->klass == mono_defaults.monitor_class) { gboolean is_enter = FALSE; + gboolean is_v4 = FALSE; - if (!strcmp (cmethod->name, "Enter") && mono_method_signature (cmethod)->param_count == 1) + if (!strcmp (cmethod->name, "Enter") && fsig->param_count == 2 && fsig->params [1]->byref) { + is_enter = TRUE; + is_v4 = TRUE; + } + if (!strcmp (cmethod->name, "Enter") && fsig->param_count == 1) is_enter = TRUE; if (is_enter) { @@ -6138,10 +6143,10 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign NEW_BBLOCK (cfg, end_bb); - ins = mono_emit_jit_icall (cfg, (gpointer)mono_monitor_enter_fast, args); + 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, (gpointer)mono_monitor_enter, args); + 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; } diff --git a/mono/mini/mini-arm64.c b/mono/mini/mini-arm64.c index bc1b5021a01..e19467f8945 100644 --- a/mono/mini/mini-arm64.c +++ b/mono/mini/mini-arm64.c @@ -934,7 +934,15 @@ arm_patch_full (MonoCompile *cfg, MonoDomain *domain, guint8 *code, guint8 *targ { switch (relocation) { case MONO_R_ARM64_B: - arm_b (code, target); + if (arm_is_bl_disp (code, target)) { + arm_b (code, target); + } else { + gpointer thunk; + + thunk = create_thunk (cfg, domain, code, target); + g_assert (arm_is_bl_disp (code, thunk)); + arm_b (code, thunk); + } break; case MONO_R_ARM64_BCC: { int cond; @@ -966,7 +974,7 @@ arm_patch_full (MonoCompile *cfg, MonoDomain *domain, guint8 *code, guint8 *targ thunk = create_thunk (cfg, domain, code, target); g_assert (arm_is_bl_disp (code, thunk)); - arm_bl (code, thunk); + arm_bl (code, thunk); } break; default: diff --git a/mono/mini/mini-generic-sharing.c b/mono/mini/mini-generic-sharing.c index aca368c9dba..736493198ed 100644 --- a/mono/mini/mini-generic-sharing.c +++ b/mono/mini/mini-generic-sharing.c @@ -3436,6 +3436,24 @@ mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gs MonoGenericContext *context = mono_method_get_context (method); MonoGenericInst *inst; + /* + * Instead of creating a shared version of the wrapper, create a shared version of the original + * method and construct a wrapper for it. Otherwise, we could end up with two copies of the + * same wrapper, breaking AOT which assumes wrappers are unique. + * FIXME: Add other cases. + */ + if (method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) { + MonoMethod *wrapper = mono_marshal_method_from_wrapper (method); + + return mono_marshal_get_synchronized_wrapper (mini_get_shared_method_full (wrapper, all_vt, is_gsharedvt)); + } + if (method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE) { + WrapperInfo *info = mono_marshal_get_wrapper_info (method); + + if (info->subtype == WRAPPER_SUBTYPE_NONE) + return mono_marshal_get_delegate_invoke (mini_get_shared_method_full (info->d.delegate_invoke.method, all_vt, is_gsharedvt), NULL); + } + if (method->is_generic || (method->klass->generic_container && !method->is_inflated)) { declaring_method = method; } else { diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c index 77775169fd7..122334e6ea6 100644 --- a/mono/mini/mini-trampolines.c +++ b/mono/mini/mini-trampolines.c @@ -366,12 +366,9 @@ mini_add_method_trampoline (MonoMethod *m, gpointer compiled_method, gboolean ad if (callee_array_helper) { add_static_rgctx_tramp = FALSE; - /* FIXME: ji->from_aot is not set for llvm methods */ - if (ji && (ji->from_aot || mono_aot_only)) { - /* In AOT mode, compiled_method points to one of the InternalArray methods in Array. */ - if (!mono_llvm_only && mono_method_needs_static_rgctx_invoke (jinfo_get_method (ji), TRUE)) - add_static_rgctx_tramp = TRUE; - } + /* In AOT mode, compiled_method points to one of the InternalArray methods in Array. */ + if (ji && !mono_llvm_only && mono_method_needs_static_rgctx_invoke (jinfo_get_method (ji), TRUE)) + add_static_rgctx_tramp = TRUE; } if (mono_llvm_only) diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index 1a83dfa5898..36e5c9a5ef0 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -6,7 +6,7 @@ else FEATUREFUL_RUNTIME_TEST = test-appdomain-unload endif -check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-cattr-type-load test-reflection-load-with-context test_platform \ +check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-multi-netmodule test-cattr-type-load test-reflection-load-with-context test_platform \ test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress rm-empty-logs check-full: test-sgen check-local check-parallel: compile-tests check-full @@ -1066,6 +1066,14 @@ test-type-load: $(TEST_DRIVER_DEPEND) @echo "Testing load-exception.exe..." @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr +EXTRA_DIST += test-multi-netmodule-1-netmodule.cs test-multi-netmodule-2-dll1.cs test-multi-netmodule-3-dll2.cs test-multi-netmodule-4-exe.cs +test-multi-netmodule: + @$(MCS) -t:module test-multi-netmodule-1-netmodule.cs + @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-2-dll1.cs + @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-3-dll2.cs + @$(MCS) -r:test-multi-netmodule-2-dll1.dll test-multi-netmodule-4-exe.cs + $(RUNTIME) test-multi-netmodule-4-exe.exe > test-multi-netmodule-4-exe.exe.stdout 2> test-multi-netmodule-4-exe.exe.stderr + EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs test-cattr-type-load: $(TEST_DRIVER_DEPEND) custom-attr-errors.cs custom-attr-errors-lib.cs $(MCS) -D:WITH_MEMBERS /t:library $(srcdir)/custom-attr-errors-lib.cs diff --git a/mono/tests/test-multi-netmodule-1-netmodule.cs b/mono/tests/test-multi-netmodule-1-netmodule.cs new file mode 100644 index 00000000000..2abdc39d627 --- /dev/null +++ b/mono/tests/test-multi-netmodule-1-netmodule.cs @@ -0,0 +1,4 @@ +// Compiler options: -t:module + +public class M1 { +} diff --git a/mono/tests/test-multi-netmodule-2-dll1.cs b/mono/tests/test-multi-netmodule-2-dll1.cs new file mode 100644 index 00000000000..018db84323a --- /dev/null +++ b/mono/tests/test-multi-netmodule-2-dll1.cs @@ -0,0 +1,5 @@ +// Compiler options: -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library + +public class M2 { + public M1 m1 = new M1(); +} diff --git a/mono/tests/test-multi-netmodule-3-dll2.cs b/mono/tests/test-multi-netmodule-3-dll2.cs new file mode 100644 index 00000000000..4229b80e101 --- /dev/null +++ b/mono/tests/test-multi-netmodule-3-dll2.cs @@ -0,0 +1,5 @@ +// Compiler options: -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library + +public class M3 { + public M1 m1 = new M1(); +} diff --git a/mono/tests/test-multi-netmodule-4-exe.cs b/mono/tests/test-multi-netmodule-4-exe.cs new file mode 100644 index 00000000000..03cd2425921 --- /dev/null +++ b/mono/tests/test-multi-netmodule-4-exe.cs @@ -0,0 +1,28 @@ +// Compiler options: -r:test-multi-netmodule-2-dll1.dll + +using System; +using System.Reflection; + +public class M4 { + public static int Main () { + M2 m2 = new M2(); + + // Expecting failure + try { + var DLL = Assembly.LoadFile(@"test-multi-netmodule-3-dll2.dll"); + var m3Type = DLL.GetType("M3"); + var m3 = Activator.CreateInstance(m3Type); + var m3m1Field = m3Type.GetField("m1"); + + Console.WriteLine("M3 assembly:" + m3Type.Assembly); + Console.WriteLine("M3.M1 assembly:" + m3m1Field.DeclaringType.Assembly); + } catch (System.TypeLoadException) { + return 0; + } + + Console.WriteLine("M2 assembly:" + typeof (M2).Assembly); + Console.WriteLine("M2.M1 assembly:" + m2.m1.GetType().Assembly); + + return 1; + } +} diff --git a/mono/utils/checked-build.c b/mono/utils/checked-build.c index 43a690c7592..09926ffcd5f 100644 --- a/mono/utils/checked-build.c +++ b/mono/utils/checked-build.c @@ -473,6 +473,12 @@ check_image_may_reference_image(MonoImage *from, MonoImage *to) // For each queued image visit all directly referenced images int inner_idx; + // 'files' and 'modules' semantically contain the same items but because of lazy loading we must check both + for (inner_idx = 0; !success && inner_idx < checking->file_count; inner_idx++) + { + CHECK_IMAGE_VISIT (checking->files[inner_idx]); + } + for (inner_idx = 0; !success && inner_idx < checking->module_count; inner_idx++) { CHECK_IMAGE_VISIT (checking->modules[inner_idx]); @@ -480,8 +486,8 @@ check_image_may_reference_image(MonoImage *from, MonoImage *to) for (inner_idx = 0; !success && inner_idx < checking->nreferences; inner_idx++) { - // References are lazy-loaded and thus allowed to be NULL. - // If they are NULL, we don't care about them for this search, because they haven't impacted ref_count yet. + // Assembly references are lazy-loaded and thus allowed to be NULL. + // If they are NULL, we don't care about them for this search, because their images haven't impacted ref_count yet. if (checking->references[inner_idx]) { CHECK_IMAGE_VISIT (checking->references[inner_idx]->image); @@ -540,10 +546,10 @@ check_image_set_may_reference_image_set (MonoImageSet *from, MonoImageSet *to) if (to->images[to_idx] == mono_defaults.corlib) seen = TRUE; - // For each item in to->images, scan over from->images looking for it. + // For each item in to->images, scan over from->images seeking a path to it. for (from_idx = 0; !seen && from_idx < from->nimages; from_idx++) { - if (to->images[to_idx] == from->images[from_idx]) + if (check_image_may_reference_image (from->images[from_idx], to->images[to_idx])) seen = TRUE; } diff --git a/mono/utils/mono-counters.c b/mono/utils/mono-counters.c index ae33b4a9f39..f867960803b 100644 --- a/mono/utils/mono-counters.c +++ b/mono/utils/mono-counters.c @@ -347,6 +347,13 @@ page_faults (void) return mono_process_get_data (GINT_TO_POINTER (mono_process_current_pid ()), MONO_PROCESS_FAULTS); } + +// If cpu_load gets inlined on Windows then cpu_load_1min, cpu_load_5min and cpu_load_15min can be folded into a single function and that will +// cause a failure when registering counters since the same function address will be used by all three functions. Preventing this method from being inlined +// will make sure the registered callback functions remains unique. +#ifdef _MSC_VER +__declspec(noinline) +#endif static double cpu_load (int kind) { diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c index 53458ed6c7f..a8a5b53274e 100644 --- a/mono/utils/mono-threads-posix.c +++ b/mono/utils/mono-threads-posix.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -46,8 +45,6 @@ mono_threads_platform_register (MonoThreadInfo *info) { gpointer thread_handle; - info->owned_mutexes = g_ptr_array_new (); - thread_handle = mono_w32handle_new (MONO_W32HANDLE_THREAD, NULL); if (thread_handle == INVALID_HANDLE_VALUE) g_error ("%s: failed to create handle", __func__); @@ -290,27 +287,14 @@ mono_native_thread_set_name (MonoNativeThreadId tid, const char *name) void mono_threads_platform_set_exited (MonoThreadInfo *info) { - gpointer mutex_handle; - int i, thr_ret; - pthread_t tid; + int thr_ret; g_assert (info->handle); - if (mono_w32handle_issignalled (info->handle)) g_error ("%s: handle %p thread %p has already exited, it's handle is signalled", __func__, info->handle, mono_thread_info_get_tid (info)); if (mono_w32handle_get_type (info->handle) == MONO_W32HANDLE_UNUSED) g_error ("%s: handle %p thread %p has already exited, it's handle type is 'unused'", __func__, info->handle, mono_thread_info_get_tid (info)); - tid = pthread_self (); - - for (i = 0; i < info->owned_mutexes->len; i++) { - mutex_handle = g_ptr_array_index (info->owned_mutexes, i); - mono_w32mutex_abandon (mutex_handle, tid); - mono_thread_info_disown_mutex (info, mutex_handle); - } - - g_ptr_array_free (info->owned_mutexes, TRUE); - thr_ret = mono_w32handle_lock_handle (info->handle); g_assert (thr_ret == 0); @@ -325,22 +309,6 @@ mono_threads_platform_set_exited (MonoThreadInfo *info) info->handle = NULL; } -void -mono_threads_platform_own_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - mono_w32handle_ref (mutex_handle); - - g_ptr_array_add (info->owned_mutexes, mutex_handle); -} - -void -mono_threads_platform_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - mono_w32handle_unref (mutex_handle); - - g_ptr_array_remove (info->owned_mutexes, mutex_handle); -} - static const gchar* thread_typename (void) { return "Thread"; diff --git a/mono/utils/mono-threads-windows.c b/mono/utils/mono-threads-windows.c index 65898d52303..e2b489ecc10 100644 --- a/mono/utils/mono-threads-windows.c +++ b/mono/utils/mono-threads-windows.c @@ -317,18 +317,6 @@ mono_threads_platform_set_exited (MonoThreadInfo *info) info->handle = NULL; } -void -mono_threads_platform_own_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - g_assert_not_reached (); -} - -void -mono_threads_platform_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - g_assert_not_reached (); -} - void mono_threads_platform_init (void) { diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index d0c7fa1040e..3eb88171257 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -260,8 +260,6 @@ mono_threads_wait_pending_operations (void) //Thread initialization code -static void mono_threads_unregister_current_thread (MonoThreadInfo *info); - static inline void mono_hazard_pointer_clear_all (MonoThreadHazardPointers *hp, int retain) { @@ -400,6 +398,7 @@ unregister_thread (void *arg) gpointer gc_unsafe_stackdata; MonoThreadInfo *info; int small_id; + gboolean result; info = (MonoThreadInfo *) arg; g_assert (info); @@ -416,8 +415,6 @@ unregister_thread (void *arg) mono_native_tls_set_value (thread_exited_key, GUINT_TO_POINTER (1)); - mono_threads_platform_unregister (info); - /* * TLS destruction order is not reliable so small_id might be cleaned up * before us. @@ -444,7 +441,10 @@ unregister_thread (void *arg) */ if (threads_callbacks.thread_unregister) threads_callbacks.thread_unregister (info); - mono_threads_unregister_current_thread (info); + + mono_threads_platform_unregister (info); + result = mono_thread_info_remove (info); + g_assert (result); mono_threads_transition_detach (info); mono_thread_info_suspend_unlock (); @@ -480,20 +480,6 @@ thread_exited_dtor (void *arg) #endif } -/** - * Removes the current thread from the thread list. - * This must be called from the thread unregister callback and nowhere else. - * The current thread must be passed as TLS might have already been cleaned up. -*/ -static void -mono_threads_unregister_current_thread (MonoThreadInfo *info) -{ - gboolean result; - g_assert (mono_thread_info_get_tid (info) == mono_native_thread_id_get ()); - result = mono_thread_info_remove (info); - g_assert (result); -} - MonoThreadInfo* mono_thread_info_current_unchecked (void) { @@ -1661,15 +1647,3 @@ mono_thread_info_duplicate_handle (MonoThreadInfo *info) g_assert (mono_thread_info_is_current (info)); return mono_threads_platform_duplicate_handle (info); } - -void -mono_thread_info_own_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - mono_threads_platform_own_mutex (info, mutex_handle); -} - -void -mono_thread_info_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - mono_threads_platform_disown_mutex (info, mutex_handle); -} diff --git a/mono/utils/mono-threads.h b/mono/utils/mono-threads.h index 3091b1a17c9..db4bdab73b7 100644 --- a/mono/utils/mono-threads.h +++ b/mono/utils/mono-threads.h @@ -241,9 +241,6 @@ typedef struct { /* Stack mark for targets that explicitly require one */ gpointer stack_mark; - - /* FIXME: move to MonoInternalThread */ - GPtrArray *owned_mutexes; } MonoThreadInfo; typedef struct { @@ -526,8 +523,6 @@ void mono_threads_platform_exit (int exit_code); HANDLE mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid); void mono_threads_platform_close_thread_handle (HANDLE handle); void mono_threads_platform_set_exited (THREAD_INFO_TYPE *info); -void mono_threads_platform_own_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle); -void mono_threads_platform_disown_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle); gpointer mono_threads_platform_duplicate_handle (THREAD_INFO_TYPE *info); void mono_threads_coop_begin_global_suspend (void); @@ -646,10 +641,4 @@ mono_thread_info_is_current (THREAD_INFO_TYPE *info); gpointer mono_thread_info_duplicate_handle (THREAD_INFO_TYPE *info); -void -mono_thread_info_own_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle); - -void -mono_thread_info_disown_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle); - #endif /* __MONO_THREADS_H__ */ diff --git a/mono/utils/w32handle.c b/mono/utils/w32handle.c index fc3d1a33f36..d9957cef896 100644 --- a/mono/utils/w32handle.c +++ b/mono/utils/w32handle.c @@ -659,8 +659,11 @@ mono_w32handle_ref_core (gpointer handle, MonoW32HandleBase *handle_data) static gboolean mono_w32handle_unref_core (gpointer handle, MonoW32HandleBase *handle_data, guint minimum) { + MonoW32HandleType type; guint old, new; + type = handle_data->type; + do { old = handle_data->ref; if (!(old >= minimum)) @@ -669,8 +672,11 @@ mono_w32handle_unref_core (gpointer handle, MonoW32HandleBase *handle_data, guin new = old - 1; } while (InterlockedCompareExchange ((gint32*) &handle_data->ref, new, old) != old); + /* handle_data might contain invalid data from now on, if + * another thread is unref'ing this handle at the same time */ + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unref %s handle %p, ref: %d -> %d destroy: %s", - __func__, mono_w32handle_ops_typename (handle_data->type), handle, old, new, new == 0 ? "true" : "false"); + __func__, mono_w32handle_ops_typename (type), handle, old, new, new == 0 ? "true" : "false"); return new == 0; } diff --git a/msvc/mono.def b/msvc/mono.def index 2251543e666..f5a0e9ab98a 100644 --- a/msvc/mono.def +++ b/msvc/mono.def @@ -241,6 +241,7 @@ mono_disasm_code mono_disasm_code_one mono_dl_fallback_register mono_dl_fallback_unregister +mono_dl_open mono_dllmap_insert mono_domain_add_class_static_data mono_domain_assembly_open @@ -495,6 +496,7 @@ mono_ldstr mono_ldtoken mono_load_remote_field mono_load_remote_field_new +mono_loader_register_module mono_lock_free_alloc mono_lock_free_allocator_check_consistency mono_lock_free_allocator_init_allocator diff --git a/msvc/monosgen.def b/msvc/monosgen.def index 1f82284e7c2..1722591c2f3 100644 --- a/msvc/monosgen.def +++ b/msvc/monosgen.def @@ -241,6 +241,7 @@ mono_disasm_code mono_disasm_code_one mono_dl_fallback_register mono_dl_fallback_unregister +mono_dl_open mono_dllmap_insert mono_domain_add_class_static_data mono_domain_assembly_open @@ -497,6 +498,7 @@ mono_ldstr mono_ldtoken mono_load_remote_field mono_load_remote_field_new +mono_loader_register_module mono_lock_free_alloc mono_lock_free_allocator_check_consistency mono_lock_free_allocator_init_allocator diff --git a/msvc/scripts/order.xml b/msvc/scripts/order.xml index d2424feca65..e958929f8e2 100644 --- a/msvc/scripts/order.xml +++ b/msvc/scripts/order.xml @@ -1859,28 +1859,6 @@ System.Web.Http.WebHost.Properties.CommonWebApiResources,../../../external/aspnetwebstack/src/Common/CommonWebApiResources.resx System.Web.Http.WebHost.Properties.SRResources,../../../external/aspnetwebstack/src/System.Web.Http.WebHost/Properties/SRResources.resx System.Web.Http.WebHost.dll.sources - - false - /codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:SECURITY_DEP -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:MONO -d:FEATURE_PAL -d:MONO_FEATURE_NEW_TLS -d:MONO_FEATURE_NEW_SYSTEM_SOURCE -d:DISABLE_CAS_USE -d:MONO_SECURITY_ALIAS -r:./../../class/lib/net_4_x/System.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll - Mono.Security.Providers.NewSystemSource.dll - - ./../../class/lib/net_4_x/Mono.Security.Providers.NewSystemSource.dll - 4.5 - net_4_x - - Mono.Security.Providers.NewSystemSource.dll.sources - - - false - /codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:NewSystemSource=./../../class/lib/net_4_x/Mono.Security.Providers.NewSystemSource.dll - Mono.Security.Providers.NewTls.dll - - ./../../class/lib/net_4_x/Mono.Security.Providers.NewTls.dll - 4.5 - net_4_x - - Mono.Security.Providers.NewTls.dll.sources - false /codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll @@ -2684,28 +2662,6 @@ System.Xml.Serialization.dll.sources - - false - /codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll - Mono.Security.Providers.DotNet.dll - - ./../../class/lib/net_4_x/Mono.Security.Providers.DotNet.dll - 4.5 - net_4_x - - Mono.Security.Providers.DotNet.dll.sources - - - false - /codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll - Mono.Security.Providers.OldTls.dll - - ./../../class/lib/net_4_x/Mono.Security.Providers.OldTls.dll - 4.5 - net_4_x - - Mono.Security.Providers.OldTls.dll.sources - false /codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.Xml.dll diff --git a/net_4_x.sln b/net_4_x.sln index ba17c5e4e21..97642ca158a 100644 --- a/net_4_x.sln +++ b/net_4_x.sln @@ -181,10 +181,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Http.SelfHost-ne EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Http.WebHost-net_4_x", "mcs/class/System.Web.Http.WebHost/System.Web.Http.WebHost-net_4_x.csproj", "{2AF7E697-07BA-439E-89BF-076AEE4AE04C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.NewSystemSource-net_4_x", "mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj", "{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.NewTls-net_4_x", "mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj", "{C8B8E524-BB3A-44E2-8C22-E3313E9F477C}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Build.Framework-net_4_x", "mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-net_4_x.csproj", "{5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Build.Utilities-net_4_x", "mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities-net_4_x.csproj", "{8E5728E0-CEAF-431F-963E-EB1DEE15C506}" @@ -287,10 +283,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows-net_4_x", "m EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Xml.Serialization-net_4_x", "mcs/class/System.Xml.Serialization/System.Xml.Serialization-net_4_x.csproj", "{2210873E-99FC-48A2-A261-D650BAE33A1C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.DotNet-net_4_x", "mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj", "{391EDD2B-85AC-4FCA-B607-AAD6C51E6799}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.OldTls-net_4_x", "mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj", "{E485E885-59B1-4081-BC66-56AAAFD8771A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.DirectoryServices.Protocols-net_4_x", "mcs/class/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols-net_4_x.csproj", "{EF08F249-31A1-4E62-8391-ECBA5227B686}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualC-net_4_x", "mcs/class/Microsoft.VisualC/Microsoft.VisualC-net_4_x.csproj", "{ACA2694D-9F07-4AE2-9171-9AB5DD1A8C18}" @@ -1041,14 +1033,6 @@ Global {2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Debug|Any CPU.Build.0 = Debug|Any CPU {2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Release|Any CPU.ActiveCfg = Release|Any CPU {2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Release|Any CPU.Build.0 = Release|Any CPU - {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Release|Any CPU.Build.0 = Release|Any CPU - {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Release|Any CPU.Build.0 = Release|Any CPU {5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -1253,14 +1237,6 @@ Global {2210873E-99FC-48A2-A261-D650BAE33A1C}.Debug|Any CPU.Build.0 = Debug|Any CPU {2210873E-99FC-48A2-A261-D650BAE33A1C}.Release|Any CPU.ActiveCfg = Release|Any CPU {2210873E-99FC-48A2-A261-D650BAE33A1C}.Release|Any CPU.Build.0 = Release|Any CPU - {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Debug|Any CPU.Build.0 = Debug|Any CPU - {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Release|Any CPU.ActiveCfg = Release|Any CPU - {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Release|Any CPU.Build.0 = Release|Any CPU - {E485E885-59B1-4081-BC66-56AAAFD8771A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E485E885-59B1-4081-BC66-56AAAFD8771A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E485E885-59B1-4081-BC66-56AAAFD8771A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E485E885-59B1-4081-BC66-56AAAFD8771A}.Release|Any CPU.Build.0 = Release|Any CPU {EF08F249-31A1-4E62-8391-ECBA5227B686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EF08F249-31A1-4E62-8391-ECBA5227B686}.Debug|Any CPU.Build.0 = Debug|Any CPU {EF08F249-31A1-4E62-8391-ECBA5227B686}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/scripts/ci/run-jenkins.sh b/scripts/ci/run-jenkins.sh index 74f0d1bbf38..059ae97cff2 100755 --- a/scripts/ci/run-jenkins.sh +++ b/scripts/ci/run-jenkins.sh @@ -10,7 +10,10 @@ else export CFLAGS="-ggdb3 -O2" fi -if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-cooperative-gc=yes"; export MONO_CHECK_MODE=gc,thread; fi +if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-cooperative-gc=yes"; fi + +if [[ ${CI_TAGS} == *'checked-coop'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=gc,thread"; export MONO_CHECK_MODE=gc,thread; fi +if [[ ${CI_TAGS} == *'checked-all'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=all"; export MONO_CHECK_MODE=all; fi if [[ ${label} == 'osx-i386' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --build=i386-apple-darwin11.2.0"; fi if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib "; fi