Merge pull request #4503 from BrzVlad/fix-appdomain-unload
authorVlad Brezae <brezaevlad@gmail.com>
Fri, 24 Mar 2017 14:21:30 +0000 (16:21 +0200)
committerGitHub <noreply@github.com>
Fri, 24 Mar 2017 14:21:30 +0000 (16:21 +0200)
[runtime] Fix abort issues

145 files changed:
configure.ac
external/cecil
external/linker
man/csharp.1
man/mono.1
mcs/build/library.make
mcs/build/platforms/darwin.make
mcs/build/profiles/monotouch_runtime.make
mcs/build/profiles/monotouch_watch.make
mcs/build/profiles/monotouch_watch_runtime.make
mcs/build/profiles/net_4_x.make
mcs/build/profiles/xammac.make
mcs/build/profiles/xammac_net_4_5.make
mcs/class/Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj
mcs/class/Mono.Cecil/Makefile
mcs/class/Mono.Cecil/Mono.Cecil-net_4_x.csproj
mcs/class/Mono.CodeContracts/Mono.CodeContracts-net_4_x.csproj
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft-net_4_x.csproj
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs [deleted file]
mcs/class/Mono.Security/monotouch_Mono.Security.dll.sources
mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs
mcs/class/System.Data/Makefile
mcs/class/System.Data/System.Data_test.dll.sources
mcs/class/System.Data/Test/ProviderTests/Common/ConnectionConfig.cs
mcs/class/System.Data/Test/ProviderTests/Common/ConnectionManager.cs
mcs/class/System.Data/Test/ProviderTests/Common/DBHelper.cs
mcs/class/System.Data/Test/ProviderTests/Common/DataProvider.cs
mcs/class/System.Data/Test/ProviderTests/Common/EngineConfig.cs
mcs/class/System.Data/Test/ProviderTests/Common/EngineType.cs
mcs/class/System.Data/Test/ProviderTests/Common/ProviderTestsConfigurationHandler.cs
mcs/class/System.Data/Test/ProviderTests/ProviderIndependant/DataReaderTest.cs
mcs/class/System.Data/Test/ProviderTests/ProviderIndependant/DbDataReaderTest.cs
mcs/class/System.Data/Test/ProviderTests/ProviderIndependant/IDbCommandTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.Connected.Tests.dll.sources
mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcCommandBuilderTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcCommandTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcDataAdapterTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcDataReaderTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcParameterCollectionTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcParameterTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlClientFactoryTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlCommandBuilderTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlCommandTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionStringBuilderTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataAdapterTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataReaderTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterCollectionTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterTest.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlTransactionTest.cs
mcs/class/System.Data/Test/ProviderTests/app-net_1_1.config
mcs/class/System.Data/Test/ProviderTests/app-net_2_0.config
mcs/class/System.Data/Test/ProviderTests/sql/MySQL_5.sql
mcs/class/System.Data/Test/ProviderTests/sql/sqlserver.sql
mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandBuilderTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcConnectionStringBuilderTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcConnectionTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcDataAdapterTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcParameterCollectionTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcParameterTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcPermissionAttributeTest.cs
mcs/class/System.Data/Test/System.Data.Odbc/OdbcPermissionTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbCommandTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbConnectionTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbDataAdapterTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbParameterCollectionTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbPermissionAttributeTest.cs
mcs/class/System.Data/Test/System.Data.OleDb/OleDbPermissionTest.cs
mcs/class/System.Data/Test/test-config-file
mcs/class/System.Data/testing_aot_full_System.Data_test.dll.exclude.sources [deleted file]
mcs/class/System.Data/testing_aot_hybrid_System.Data_test.dll.exclude.sources [deleted file]
mcs/class/System.Web.Extensions/Makefile
mcs/class/System.Web.Extensions/Test/standalone-tests/.gitignore [new file with mode: 0644]
mcs/class/System.Web.Extensions/Test/standalone-tests/DataPager_NumericPagerField_Bug615315.cs
mcs/class/System.Web/Test/tools/standalone-runner.cs
mcs/class/System/Makefile
mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/AppleTlsContext.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/AppleTlsStream.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/Certificate.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/Enums.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/INativeObject.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/ImportExport.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/Items.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/Policy.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/SecureTransport.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/SslConnection.cs [new file with mode: 0644]
mcs/class/System/Mono.AppleTls/Trust.cs [new file with mode: 0644]
mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Apple.cs
mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs
mcs/class/System/System-bare-net_4_x.csproj
mcs/class/System/System-net_4_x.csproj
mcs/class/System/System-secxml-net_4_x.csproj
mcs/class/System/System.Net/HttpWebResponse.cs
mcs/class/System/System.Net/ListenerPrefix.cs
mcs/class/System/System.Net/MacProxy.cs
mcs/class/System/Test/System.ComponentModel/PropertyDescriptorTests.cs
mcs/class/System/Test/System.ComponentModel/ToolboxItemAttributeTests.cs
mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
mcs/class/System/Test/System.Net.Security/SslStreamTest.cs
mcs/class/System/Test/System.Net/HttpWebResponseTest.cs
mcs/class/System/common.sources
mcs/class/System/xammac_net_4_5_System.dll.sources
mcs/class/corlib/CoreFoundation/CFHelpers.cs
mcs/class/corlib/Makefile
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs
mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs
mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs
mcs/class/corlib/corlib-net_4_x.csproj
mcs/class/corlib/corlib.dll.sources
mcs/class/legacy/Mono.Cecil/legacy_Mono.Cecil-net_4_x.csproj [new file with mode: 0644]
mcs/tools/cil-stringreplacer/cil-stringreplacer-net_4_x.csproj
mcs/tools/corcompare/mono-api-info-net_4_x.csproj
mcs/tools/csharp/repl.cs
mcs/tools/linker/monolinker-net_4_x.csproj
mcs/tools/linker/monolinker.exe.sources
mcs/tools/mdb2ppdb/mdb2ppdb-net_4_x.csproj
mcs/tools/mdoc/mdoc-net_4_x.csproj
mcs/tools/mkbundle/mkbundle.cs
mcs/tools/pdb2mdb/pdb2mdb-net_4_x.csproj
mono/metadata/abi-details.h
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/metadata-cross-helpers.c
mono/metadata/object-offsets.h
mono/metadata/object.c
mono/metadata/threadpool-io.c
mono/metadata/w32file-unix.c
mono/mini/mini-cross-helpers.c
mono/tests/runtime-invoke.cs
msvc/scripts/order.xml
net_4_x.sln
scripts/xbuild.in

index 6566b6e302edd6c1ca46241207a5845a6bd33134..5f8e03a3bf7ced0c8d2888b348d7a7b6bdece5ef 100644 (file)
@@ -1,8 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 #AC_PREREQ([2.62])
 
-# when bumping version number below, keep it in sync with man/mono.1 too
-AC_INIT(mono, [4.9.4],
+AC_INIT(mono, [5.1.0],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README.md])
index 1ab0b08ad40962d4f794f12ce042b98d2148df52..44bc86223530a07fa74ab87007cf264e53d63400 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 1ab0b08ad40962d4f794f12ce042b98d2148df52
+Subproject commit 44bc86223530a07fa74ab87007cf264e53d63400
index e4d9784ac37b9ebf4757175c92bc7a3ec9fd867a..1bdcf6b7bfbe3b03fdaa76f6124d0d7374f08615 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e4d9784ac37b9ebf4757175c92bc7a3ec9fd867a
+Subproject commit 1bdcf6b7bfbe3b03fdaa76f6124d0d7374f08615
index a0f9e6f4f6acd62c6df19b1a0a84aadca07e306c..430a160896890929ca709deef67a6085bdd83460 100644 (file)
@@ -2,31 +2,22 @@
 .if t .sp .5v
 .if n .sp
 ..
-.TH csharp 1 "4 September 2008"
+.TH csharp 1 "22 March 2017"
 .SH NAME 
-csharp, gsharp \- Interactive C# Shell 
+csharp \- Interactive C# Shell and Scripting
 .SH SYNOPSIS
 .B csharp [--attach PID] [-e EXPRESSION] [file1 [file2]]
-[options] 
-.P
-.B gsharp [file1 [file2]]
+[compiler-options] [--|-s script-options]
 .SH DESCRIPTION
 The 
 .I csharp
-is an interactive C# shell that allows the user to enter and evaluate
-C# statements and expressions from the command line.   The regular 
+command is an interactive C# shell and scripting host that allows
+the user to enter and evaluate C# statements and expressions from
+the command line or execute C# scripts.
+The regular
 .I mcs
 command line options can be used in this version of the compiler. 
 .PP
-The 
-.I gsharp
-command is a GUI version of the C# interpreter that uses Gtk# and
-provides an area to attach widgets as well.      This version can be
-attached to other Gtk# applications in a safe way as it injects itself
-into the main loop of a Gtk# application, avoiding any problems
-arising from the multi-threaded nature of injecting itself into a
-target process.
-.PP
 Files specified in the command line will be loaded and executed as
 scripts.
 .PP
@@ -35,9 +26,31 @@ Starting with Mono 2.10, the
 command can be used as an interpreter executed by executables flagged
 with the Unix execute attribute.   To do this, make the first line of
 your C# source code look like this:
+.PP
 .nf
-"#!/usr/bin/csharp" 
-Console.WriteLine ("Hello, World");
+  #!/usr/bin/csharp
+  Console.WriteLine ("Hello, World");
+.fi
+.PP
+Starting with Mono 5.0, command line arguments may now be passed
+to the
+.I csharp
+command by specifying either the
+.I -s
+or
+.I --
+(script) options.
+.PP
+The
+.I -s
+option is ideal for interpreting executable scripts that utilize
+shebang syntax (introduced in Mono 2.10). This allows command line
+arguments to be passed to and consumed cleanly by the script:
+.PP
+.nf
+  #!/usr/bin/csharp -s
+  foreach (var arg in Args)
+    Console.WriteLine ($"script argument: {arg}");
 .fi
 .SH OPTIONS
 The commands accept all of the commands that are available to the 
@@ -45,6 +58,23 @@ The commands accept all of the commands that are available to the
 command, so you can reference assemblies, specify paths, language
 level and so on from the command line.   In addition, the following
 command line options are supported:
+.TP
+.I "\-s" SCRIPT_FILE
+This option is ideal for authoring executable scripts that utilize
+the Unix shebang feature. Unix will implicitly append as an argument
+the path of the script to execute. When the executable is invoked,
+any arguments then passed to it will be available in the
+.I Args
+global. Example:
+.I "#!/usr/bin/env csharp -s"
+.TP
+.I "\-\-"
+Any arguments that follow will not be passed to the compiler driver,
+and instead will be made available in the
+.I Args
+global. Example:
+.I csharp -- a b c
+will result in Args = { "a", "b", "c" } in the interactive shell.
 .TP 
 .I "\-\-attach"
 This is an advanced option and should only be used if you have a deep
@@ -290,6 +320,15 @@ statements and expressions are executed are static, they can be
 invoked directly from the shell.   These are the available properties
 and methods:
 .TP
+.I Args
+An easy to consume array of any arguments specified after either
+.I -s
+or
+.I --
+on the command line. Ideal for self-executing scripts utilizing the
+.I -s
+option.
+.TP
 .I void LoadAssembly(string assembly)
 Loads the given assembly.   This is equivalent to passing the compiler
 the -r: flag with the specified string. 
index 4c99a8dd0d8ffe38e12cbaf81b7a5710da13c1f0..b4663b40458524c166601dd09dc38e744e35b9a0 100644 (file)
@@ -19,14 +19,6 @@ mono \- Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-Time)
 \fImono\fP is a runtime implementation of the ECMA Common Language
 Infrastructure.  This can be used to run ECMA and .NET applications.
 .PP
-The runtime contains a native code generator that transforms the
-Common Intermediate Language into native code.
-.PP
-The code generator can operate in two modes: just in time compilation
-(JIT) or ahead of time compilation (AOT).  Since code can be
-dynamically loaded, the runtime environment and the JIT are always
-present, even if code is compiled ahead of time.
-.PP
 The runtime loads the specified
 .I file
 and optionally passes
@@ -36,12 +28,26 @@ to it.  The
 .I file
 is an ECMA assembly.  They typically have a .exe or .dll extension.
 .PP
+These executables can reference additionaly functionality in the form
+of assembly references.  By default those assembly references are
+resolved as follows: the \fBmscorlib.dll\fR is resolved from the
+system profile that is configured by Mono, and other assemblies are
+loaded from the Global Assembly Cache (GAC).   
+.PP
+The runtime contains a native code generator that transforms the
+Common Intermediate Language into native code.
+.PP
+The code generator can operate in two modes: just in time compilation
+(JIT) or ahead of time compilation (AOT).  Since code can be
+dynamically loaded, the runtime environment and the JIT are always
+present, even if code is compiled ahead of time.
+.PP
 The runtime provides a number of configuration options for running
 applications, for developing and debugging, and for testing and
 debugging the runtime itself.
 .PP
-The \fImono\fP command uses the Boehm conservative garbage collector
-while the \fImono-sgen\fP command uses a moving and generational
+The \fImono\fP command uses the moving and generational SGen garbage collector
+while the \fImono-boehm\fP command uses the conservative Boehm
 garbage collector.
 .SH PORTABILITY
 On Unix-based systems, Mono provides a mechanism to emulate the 
@@ -87,7 +93,7 @@ information which is not available on the generated file.  When
 precompiling code, you might want to compile with all optimizations
 (-O=all).  Pre-compiled code is position independent code.
 .Sp
-Pre compilation is just a mechanism to reduce startup time, increase
+Precompilation is just a mechanism to reduce startup time, increase
 code sharing across multiple mono processes and avoid just-in-time
 compilation program startup costs.  The original assembly must still
 be present, as the metadata is contained there.
@@ -264,8 +270,8 @@ List of additional directories to search for AOT images.
 This instructs the Mono runtime to
 start a debugging agent inside the Mono runtime and connect it to a
 client user interface will control the Mono process.
-This option is typically used by IDEs, like the MonoDevelop IDE.
-.PP
+This option is typically used by IDEs, like the MonoDevelop or Visual Studio IDEs.
+.RS
 The configuration is specified using one of more of the following options:
 .RS
 .ne 8
@@ -292,10 +298,10 @@ actively waits for the debugger front end to connect to the Mono process.
 Mono will print out to stdout the IP address and port where it is listening.
 .TP
 .I setpgid=[y/n]
-If set to yes, Mono will call \fBsetpgid(0, 0)\fB on startup, if that function
+If set to yes, Mono will call \fBsetpgid(0, 0)\fR on startup, if that function
 is available on the system. This is useful for ensuring that signals delivered
 to a process that is executing the debuggee are not propagated to the debuggee,
-e.g. when Ctrl-C sends \fBSIGINT\fB to the \fBsdb\fB tool.
+e.g. when Ctrl-C sends \fBSIGINT\fR to the \fBsdb\fR tool.
 .TP
 .I suspend=[y/n]
 Defaults to yes, with the default option Mono will suspend the vm on startup 
@@ -528,7 +534,7 @@ platforms, and only when using gdb 7.0 or later.
 Turns on profiling.  For more information about profiling applications
 and code coverage see the sections "PROFILING" and "CODE COVERAGE"
 below. 
-.TP
+.Sp
 This option can be used multiple times, each time will load an
 additional profiler.   This allows developers to use modules that
 extend the JIT through the Mono profiling interface.
@@ -1692,7 +1698,7 @@ Captures the interrupt signal (Control-C) and displays a stack trace
 when pressed.  Useful to find out where the program is executing at a
 given point.  This only displays the stack trace of a single thread. 
 .TP
-\fBinit-stacks\FR 
+\fBinit-stacks\fR
 Instructs the runtime to initialize the stack with
 some known values (0x2a on x86-64) at the start of a method to assist
 in debuggin the JIT engine.
@@ -1942,8 +1948,8 @@ http://www.mono-project.com/community/help/mailing-lists/
 http://www.mono-project.com
 .SH SEE ALSO
 .PP
-certmgr(1), csharp(1), mcs(1), mdb(1), monocov(1), monodis(1),
-mono-config(5), mozroots(1), mprof-report(1), pdb2mdb(1), xsp(1), mod_mono(8).
+certmgr(1), cert-sync(1), csharp(1), gacutil(1), mcs(1), mdb(1), monocov(1), monodis(1),
+mono-config(5), mprof-report(1), pdb2mdb(1), xsp(1), mod_mono(8).
 .PP
 For more information on AOT:
 http://www.mono-project.com/docs/advanced/aot/
index fdb9cdba4d5b305042270b73d87b7f693d4be026..b2870bf58c8bf3fc0215836e2d3358298fe64de8 100644 (file)
@@ -134,7 +134,7 @@ csproj-local: csproj-library csproj-test
 intermediate_clean=$(subst /,-,$(intermediate))
 csproj-library:
        config_file=`basename $(LIBRARY) .dll`-$(intermediate_clean)$(PROFILE).input; \
-       case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; esac; \
+       case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; *"legacy"*) config_file=legacy_$$config_file;; esac; \
        echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
        (echo $(is_boot); \
        echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
index af397fe1c11e9d9cc569d54449a355adbc7c01e1..ef7e6ca58f25b52a88b8e07ce29265bd5b781be2 100644 (file)
@@ -1,12 +1,12 @@
 # -*- makefile -*-
 #
-# Platform-specific makefile rules. This one's for linux.
+# Platform-specific makefile rules. This one's for macOS.
 #
 
 PLATFORM_MCS_FLAGS =
 PLATFORM_RUNTIME = $(RUNTIME)
 PLATFORM_CORLIB = mscorlib.dll
-PLATFORM_TEST_HARNESS_EXCLUDES = NotOnMac,
+PLATFORM_TEST_HARNESS_EXCLUDES = NotOnMac,MacNotWorking,
 
 EXTERNAL_MCS = mcs
 EXTERNAL_MBAS = mbas
index 67408bbf9ce4416bc9d380518a3925f0002b46d3..32715b8bbf5aae40a456e68f4d0eb2b23d68e2bb 100644 (file)
@@ -42,3 +42,5 @@ MOBILE_PROFILE = yes
 NO_CONSOLE = yes
 
 PROFILE_DISABLE_BTLS=1
+MONO_FEATURE_APPLETLS=1
+ONLY_APPLETLS=1
index 4bba2f421ac849b4f0869f32b72a1b4d57f51e3c..c221aa43c10e224ca7ef161e140f3172e23aa989 100644 (file)
@@ -9,3 +9,5 @@ NO_THREAD_SUSPEND_RESUME=1
 NO_MULTIPLE_APPDOMAINS=1
 NO_PROCESS_START=1
 NO_MONO_SECURITY=1
+MONO_FEATURE_APPLETLS=
+ONLY_APPLETLS=
index e826c7e7e31e1b734fbd5625532536f3184d787a..e1edd9999c5488d281bad465df9dcfb329504a31 100644 (file)
@@ -10,3 +10,5 @@ NO_THREAD_SUSPEND_RESUME=1
 # so we need a System.dll that can do that.
 #NO_PROCESS_START=1
 NO_MONO_SECURITY=1
+MONO_FEATURE_APPLETLS=
+ONLY_APPLETLS=
index e4a274076ed3fcd45cc6b5871952a878c4c23621..b5350c6918f5a7793d4410ebc9893ee3e6aab15f 100644 (file)
@@ -15,3 +15,4 @@ PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -no
 
 FRAMEWORK_VERSION = 4.5
 XBUILD_VERSION = 4.0
+MONO_FEATURE_APPLETLS=1
index 97265214662c26d192f71636e4ba90cfee19005f..e6d9c296178e6f5533c9fea862417ef7cb96bf93 100644 (file)
@@ -38,3 +38,5 @@ MOBILE_PROFILE = yes
 NO_CONSOLE = yes
 
 PROFILE_DISABLE_BTLS=1
+MONO_FEATURE_APPLETLS=1
+ONLY_APPLETLS=1
index b9881fe64def8d8c9b90731784504d8780795474..73851e183ad7288fa3e87880b645ee38da4463a6 100644 (file)
@@ -18,5 +18,6 @@ NO_SYSTEM_DRAWING_DEPENDENCY=1
 NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY=1
 NO_SYSTEM_DESIGN_DEPENDENCY=1
 NO_SYSTEM_DIRECTORY_SERVICES_DEPENDENCY=1
-
 PROFILE_DISABLE_BTLS=1
+MONO_FEATURE_APPLETLS=1
+ONLY_APPLETLS=1
index 01ff5285e50722c7f4b347382d0fa13f6ddbd184..d2ed9a93716c1a2c46f3f7f5c49e34f85df0d22f 100644 (file)
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
-    <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
-      <SpecificVersion>False</SpecificVersion>\r
-      <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
-      <Private>False</Private>\r
-    </Reference>\r
+    <ProjectReference Include="../Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+      <Name>Mono.Cecil-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index d8807afa49ea9fbcbc3756b665ee3ac847deefa1..16bba0c898cfc4684cdb3020f29c23e19e70ef77 100644 (file)
@@ -5,7 +5,7 @@ LIBRARY = Mono.Cecil.dll
 LIBRARY_SNK = ../mono.snk
 LIBRARY_PACKAGE = none
 
-LIB_REFS = System.Core
+LIB_REFS = System.Core System
 LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_4_0 /publicsign
 
 NO_TEST = yes
index f1cbfb1d8fe0ac5002cadaf05368ae0cb073866a..3398e4b7797e9906b24b458bbd076561817a68d3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -33,7 +34,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;NET_4_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -41,7 +42,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;NET_4_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\Code.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\CodeReader.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\CodeWriter.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\Document.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\ExceptionHandler.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\ILProcessor.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\Instruction.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\MethodBody.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\OpCode.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\OpCodes.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\SequencePoint.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\Symbols.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\VariableDefinition.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\VariableReference.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\BlobHeap.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\Buffers.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\CodedIndex.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\ElementType.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\GuidHeap.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\Heap.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\MetadataToken.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\Row.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\StringHeap.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\TableHeap.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\TokenType.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\UserStringHeap.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\Utilities.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\BinaryStreamReader.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\BinaryStreamWriter.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\ByteBuffer.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\ByteBufferEqualityComparer.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\DataDirectory.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\Image.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\ImageReader.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\ImageWriter.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\Section.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\TextMap.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\*.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\ArrayType.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyDefinition.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyFlags.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\SecurityDeclaration.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\SentinelType.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\TargetRuntime.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Treatments.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeAttributes.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeDefinition.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeDefinitionCollection.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeSpecification.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeSystem.cs" />\r
     <Compile Include="..\..\..\external\cecil\Mono.Cecil\VariantType.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Collections.Generic\Collection.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Collections.Generic\ReadOnlyCollection.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Security.Cryptography\CryptoConvert.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono.Security.Cryptography\CryptoService.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono\Actions.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono\Empty.cs" />\r
-    <Compile Include="..\..\..\external\cecil\Mono\Funcs.cs" />\r
-    <Compile Include="..\..\..\external\cecil\System.Runtime.CompilerServices\ExtensionAttribute.cs" />\r  </ItemGroup>\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\WindowsRuntimeProjections.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Collections.Generic\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Security.Cryptography\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\ProjectInfo.cs" />\r
+    <Compile Include="..\..\..\external\cecil\System.Security.Cryptography\*.cs" />\r
+    <Compile Include="Consts.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 3fe4e15cd8fa236a9256b69faf3239b01c175992..b6d1fa590309c6ee108ca8be647cd62817ee97e7 100644 (file)
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
     </ProjectReference>\r
-    <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
-      <SpecificVersion>False</SpecificVersion>\r
-      <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
-      <Private>False</Private>\r
-    </Reference>\r
+    <ProjectReference Include="../Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+      <Name>Mono.Cecil-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj">\r
       <Project>{CF14D34A-F69B-47FB-A99C-D25C77198F30}</Project>\r
       <Name>Mono.Cecil.Mdb-net_4_x</Name>\r
index 3892035220ce24f61a90e9f1c0c7a632f7936e73..8e19ec9af9649c6f84577ae83c41fbacb08fb64a 100644 (file)
@@ -105,7 +105,7 @@ namespace Mono.Data.Tds.Protocol {
                        }
 
                        try {
-                               socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                               socket = new Socket (endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                                IAsyncResult ares = socket.BeginConnect (endPoint, null, null);
                                int timeout_ms = timeout * 1000;
                                if (timeout > 0 && !ares.IsCompleted && !ares.AsyncWaitHandle.WaitOne (timeout_ms, false))
index 6ef706be8fea33156c07f35f86a37fd17d03b5c9..d54235f6fbaed4676dacf175166dd64147e5652a 100644 (file)
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
-    <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
-      <SpecificVersion>False</SpecificVersion>\r
-      <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
-      <Private>False</Private>\r
-    </Reference>\r
+    <ProjectReference Include="../Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+      <Name>Mono.Cecil-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../System.Core/System.Core-net_4_x.csproj">\r
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs
deleted file mode 100644 (file)
index d77e723..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Mono.Security.Interface
-{
-       delegate MonoTlsProvider MonoTlsProviderFactoryDelegate ();
-
-       static partial class MonoTlsProviderFactory
-       {
-               internal static MonoTlsProviderFactoryDelegate _PrivateFactoryDelegate;
-       }
-}
index 463682e1d99d9a811bf3e09f789b5be6cba4f328..5c615f7b543ffdf6ebb51f2df596ce1081685461 100644 (file)
@@ -1,4 +1,3 @@
 #include Mono.Security.dll.sources
 ../corlib/CommonCrypto/CommonCrypto.cs
 ../corlib/CommonCrypto/RC4CommonCrypto.cs
-Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs
index 0cf6136ae38ca111de4ffb463a475245dd7cf4b0..9812fdfb7a877f3871c9a9b7d33472d5461d0217 100644 (file)
@@ -330,7 +330,7 @@ namespace System.Configuration
 
                        CheckFileMap (level, map);
 
-                       if (locationSubPath == null)
+                       if (locationSubPath == null) {
                                switch (level) {
                                case ConfigurationUserLevel.PerUserRoaming:
                                        if (map.RoamingUserConfigFilename == null)
@@ -343,35 +343,37 @@ namespace System.Configuration
                                        locationSubPath = "local";
                                        break;
                                }
-
-                       configPath = null;
-                       string next = null;
-
-                       locationConfigPath = null;
+                       }
 
                        if (locationSubPath == "exe" || locationSubPath == null && map.ExeConfigFilename != null) {
                                configPath = "exe";
-                               next = "machine";
+                               locationSubPath = "machine";
                                locationConfigPath = map.ExeConfigFilename;
+                               return;
                        }
                        
                        if (locationSubPath == "local" && map.LocalUserConfigFilename != null) {
                                configPath = "local";
-                               next = "roaming";
+                               locationSubPath = "roaming";
                                locationConfigPath = map.LocalUserConfigFilename;
+                               return;
                        }
                        
                        if (locationSubPath == "roaming" && map.RoamingUserConfigFilename != null) {
                                configPath = "roaming";
-                               next = "exe";
+                               locationSubPath = "exe";
                                locationConfigPath = map.RoamingUserConfigFilename;
+                               return;
                        }
                        
-                       if ((locationSubPath == "machine" || configPath == null) && map.MachineConfigFilename != null) {
+                       if (locationSubPath == "machine" && map.MachineConfigFilename != null) {
                                configPath = "machine";
-                               next = null;
+                               locationSubPath = null;
+                               locationConfigPath = null;
+                               return;
                        }
-                       locationSubPath = next;
+
+                       throw new NotImplementedException ();
                }
        }
        
index a862bf05db1389c0c338d9b86974f51f9e5c3fce..85b3fd50c14313ffaac6c55fa66b7d3b0c17bc68 100644 (file)
@@ -31,6 +31,7 @@ using System.Runtime.InteropServices;
 using System.Security.AccessControl;
 using System.Security.Permissions;
 using System.Security.Principal;
+using System.IO.MemoryMappedFiles;
 
 namespace Microsoft.Win32.SafeHandles
 {
@@ -42,10 +43,11 @@ namespace Microsoft.Win32.SafeHandles
                        handle = preexistingHandle;
                }
 
-               [MonoTODO]
                protected override bool ReleaseHandle ()
                {
-                       throw new NotImplementedException ();
+                       MemoryMapImpl.CloseMapping (handle);
+                       handle = IntPtr.Zero;
+                       return true;
                }
        }
 }
index 7a3cce164f61e2feffc9b46fcd751d1c75626e91..4adaaf514febde7d264e247301a62100237a3c0c 100644 (file)
@@ -33,7 +33,6 @@ using Microsoft.Win32.SafeHandles;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 
-
 namespace System.IO.MemoryMappedFiles
 {
        internal static class MemoryMapImpl {
@@ -113,7 +112,6 @@ namespace System.IO.MemoryMappedFiles
                }
        }
 
-
        public class MemoryMappedFile : IDisposable {
                // MemoryMappedFileAccess fileAccess;
                // string name;
@@ -127,7 +125,7 @@ namespace System.IO.MemoryMappedFiles
                //
                FileStream stream;
                bool keepOpen;
-               IntPtr handle;
+               SafeMemoryMappedFileHandle handle;
 
                public static MemoryMappedFile CreateFromFile (string path)
                {
@@ -147,7 +145,7 @@ namespace System.IO.MemoryMappedFiles
                        IntPtr handle = MemoryMapImpl.OpenFile (path, mode, null, out capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None);
 
                        return new MemoryMappedFile () {
-                               handle = handle,
+                               handle = new SafeMemoryMappedFileHandle (handle, true),
                                // fileAccess = MemoryMappedFileAccess.ReadWrite,
                                // fileCapacity = capacity
                        };
@@ -179,7 +177,7 @@ namespace System.IO.MemoryMappedFiles
                        IntPtr handle = MemoryMapImpl.OpenFile (path, mode, mapName, out capacity, access, MemoryMappedFileOptions.None);
                        
                        return new MemoryMappedFile () {
-                               handle = handle,
+                               handle = new SafeMemoryMappedFileHandle (handle, true),
                                // fileAccess = access,
                                // name = mapName,
                                // fileCapacity = capacity
@@ -202,7 +200,7 @@ namespace System.IO.MemoryMappedFiles
                        MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability);
                                
                        return new MemoryMappedFile () {
-                               handle = handle,
+                               handle = new SafeMemoryMappedFileHandle (handle, true),
                                // fileAccess = access,
                                // name = mapName,
                                // fileCapacity = capacity,
@@ -229,7 +227,7 @@ namespace System.IO.MemoryMappedFiles
                        MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability);
                                
                        return new MemoryMappedFile () {
-                               handle = handle,
+                               handle = new SafeMemoryMappedFileHandle (handle, true),
                                // fileAccess = access,
                                // name = mapName,
                                // fileCapacity = capacity,
@@ -252,7 +250,7 @@ namespace System.IO.MemoryMappedFiles
                        IntPtr handle = MemoryMapImpl.OpenFile (null, mode, mapName, out capacity, access, options);
                        
                        return new MemoryMappedFile () {
-                               handle = handle,
+                               handle = new SafeMemoryMappedFileHandle (handle, true),
                                // fileAccess = access,
                                // name = mapName,
                                // fileCapacity = capacity
@@ -339,7 +337,7 @@ namespace System.IO.MemoryMappedFiles
 
                public MemoryMappedViewStream CreateViewStream (long offset, long size, MemoryMappedFileAccess access)
                {
-                       var view = MemoryMappedView.Create (handle, offset, size, access);
+                       var view = MemoryMappedView.Create (handle.DangerousGetHandle (), offset, size, access);
                        return new MemoryMappedViewStream (view);
                }
 
@@ -355,7 +353,7 @@ namespace System.IO.MemoryMappedFiles
 
                public MemoryMappedViewAccessor CreateViewAccessor (long offset, long size, MemoryMappedFileAccess access)
                {
-                       var view = MemoryMappedView.Create (handle, offset, size, access);
+                       var view = MemoryMappedView.Create (handle.DangerousGetHandle (), offset, size, access);
                        return new MemoryMappedViewAccessor (view);
                }
 
@@ -370,16 +368,16 @@ namespace System.IO.MemoryMappedFiles
 
                protected virtual void Dispose (bool disposing)
                {
-                       if (disposing){
-                               if (stream != null){
+                       if (disposing) {
+                               if (stream != null) {
                                        if (keepOpen == false)
                                                stream.Close ();
                                        stream = null;
                                }
-                               if (handle != IntPtr.Zero) {
-                                       MemoryMapImpl.CloseMapping (handle);
-                                       handle = IntPtr.Zero;
-                               }
+                       }
+                       if (handle != null) {
+                               handle.Dispose ();
+                               handle = null;
                        }
                }
 
index 4fca0b34f42e8dd18a75b517a811e6db74e4cc3a..7757ca9d881b2881a8b233b68ead57ef1e2bd4ac 100644 (file)
@@ -511,6 +511,11 @@ namespace MonoTests.System.Linq.Expressions {
                [Test]
                public void CallNullableGetValueOrDefault () // #568989
                {
+#if MOBILE
+                       // ensure that int?.GetValueOrDefault won't be removed by the linker
+                       Assert.AreEqual (0, ((int?)0).GetValueOrDefault (3));
+#endif
+
                        var value = Expression.Parameter (typeof (int?), "value");
                        var default_parameter = Expression.Parameter (typeof (int), "default");
 
index d40b3e0e76d7bb3ec046e16aa1e85156cc76ddd9..992f970601ba62333fbe760f8f9f5b3677895aec 100644 (file)
@@ -53,6 +53,7 @@ EXTRA_DISTFILES = \
        $(wildcard Test/System.Data/schemas/*.xsd)              \
        Test/test-config-file                   \
        Test/System.Data/binserialize/*.bin     \
+       Test/ProviderTests/sql/*.sql    \
        SqliteTest.db   \
        corefx.common.sources
 
index ab2142345038288cc44b1fa724830cfa3d24bd86..d0cc818ecc9c01a7b7b974aaad8bd3db38fac771 100644 (file)
@@ -126,3 +126,29 @@ System.Data.SqlClient/SqlBulkCopyTest.cs
 Mono.Data.SqlExpressions/DataColumnExpressionTest.cs
 Mono.Data.SqlExpressions/DateComparisonTest.cs
 
+ProviderTests/Common/ConnectionConfig.cs
+ProviderTests/Common/ConnectionManager.cs
+ProviderTests/Common/DBHelper.cs
+ProviderTests/Common/DataProvider.cs
+ProviderTests/Common/EngineConfig.cs
+ProviderTests/Common/EngineType.cs
+ProviderTests/Common/ProviderTestsConfigurationHandler.cs
+ProviderTests/System.Data.Odbc/OdbcCommandBuilderTest.cs
+ProviderTests/System.Data.Odbc/OdbcCommandTest.cs
+ProviderTests/System.Data.Odbc/OdbcDataReaderTest.cs
+ProviderTests/System.Data.Odbc/OdbcDataAdapterTest.cs
+ProviderTests/System.Data.Odbc/OdbcParameterTest.cs
+ProviderTests/System.Data.Odbc/OdbcParameterCollectionTest.cs
+ProviderTests/ProviderIndependant/DataReaderTest.cs
+ProviderTests/ProviderIndependant/DbDataReaderTest.cs
+ProviderTests/ProviderIndependant/IDbCommandTest.cs
+ProviderTests/System.Data.SqlClient/SqlClientFactoryTest.cs
+ProviderTests/System.Data.SqlClient/SqlCommandBuilderTest.cs
+ProviderTests/System.Data.SqlClient/SqlCommandTest.cs
+ProviderTests/System.Data.SqlClient/SqlDataReaderTest.cs
+ProviderTests/System.Data.SqlClient/SqlDataAdapterTest.cs
+ProviderTests/System.Data.SqlClient/SqlTransactionTest.cs
+ProviderTests/System.Data.SqlClient/SqlConnectionStringBuilderTest.cs
+ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs
+ProviderTests/System.Data.SqlClient/SqlParameterTest.cs
+ProviderTests/System.Data.SqlClient/SqlParameterCollectionTest.cs
\ No newline at end of file
index 759282b00ac1a8d0491172609686f646e1ef53c2..829efab65bf097a49eea4b1dd3a29d21aecfb383 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_CONFIGURATION
+
 using System;
 using System.Collections;
 using System.Configuration;
 using System.Globalization;
 using System.Xml;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        internal sealed class ConnectionConfig
        {
@@ -110,3 +112,5 @@ namespace MonoTests.System.Data
                }
        }
 }
+
+#endif
\ No newline at end of file
index 9eb1664b7fe6bee0d885d195f3f8f57d13edb47e..29028c7859c2441670d2bddd00cf06e23ae2b04f 100644 (file)
 // SOFTWARE.
 
 using System;
-using System.Configuration;
+using System.Collections.Generic;
 using System.Data;
 using System.Data.Common;
+#if !NO_ODBC
+using System.Data.Odbc;
+#endif
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using NUnit.Framework;
 
-
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        public class ConnectionManager
        {
-               private static ConnectionManager Instance;
-               private DbConnection _connection;
-               private string _connectionString;
-               private EngineConfig _engine;
+               private static ConnectionManager instance;
+               private ConnectionHolder<SqlConnection> sql;
+
+               private const string OdbcEnvVar = "SYSTEM_DATA_ODBC";
+               private const string SqlEnvVar = "SYSTEM_DATA_MSSQL";
 
-               static ConnectionManager () 
+               private ConnectionManager ()
                {
-                       Instance = new ConnectionManager ();
+                       //Environment.SetEnvironmentVariable(OdbcEnvVar, @"Driver={MySQL ODBC 5.3 Unicode Driver};server=127.0.0.1;uid=sa;pwd=qwerty123;";
+                       //Environment.SetEnvironmentVariable(SqlEnvVar, @"server=127.0.0.1;database=master;user id=sa;password=qwerty123";
+
+                       // Generate a random db name
+                       DatabaseName = "monotest" + Guid.NewGuid().ToString().Substring(0, 7);
+
+                       sql = CreateSqlConfig (SqlEnvVar);
+                       if (sql != null)
+                               CreateMssqlDatabase();
+                       
+#if !NO_ODBC
+                       odbc = CreateOdbcConfig (OdbcEnvVar);
+                       if (odbc != null)
+                               CreateMysqlDatabase();
+#endif
                }
 
-               private ConnectionManager ()
+               static ConnectionHolder<SqlConnection> CreateSqlConfig (string envVarName)
+               {
+                       string connectionString = Environment.GetEnvironmentVariable (envVarName);
+                       if (string.IsNullOrEmpty (connectionString))
+                               return null;
+
+                       SqlConnection connection;
+#if MOBILE
+                       connection = new SqlConnection ();
+#else
+                       DbProviderFactory factory = DbProviderFactories.GetFactory ("System.Data.SqlClient");
+                       connection = (SqlConnection)factory.CreateConnection ();
+#endif
+
+                       var engine = new EngineConfig {
+                               Type = EngineType.SQLServer,
+                               ClientVersion = 9,
+                               QuoteCharacter = "&quot;",
+                               SupportsMicroseconds = true,
+                               SupportsUniqueIdentifier = true,
+                               SupportsTimestamp = true,
+                       };
+
+                       return new ConnectionHolder<SqlConnection> (engine, connection, connectionString);
+               }
+
+#if !NO_ODBC
+               static ConnectionHolder<OdbcConnection> CreateOdbcConfig (string envVarName)
+               {
+                       string connectionString = Environment.GetEnvironmentVariable (envVarName);
+                       if (string.IsNullOrEmpty (connectionString))
+                               return null;
+
+                       DbProviderFactory factory = DbProviderFactories.GetFactory ("System.Data.Odbc");
+                       var connection = (OdbcConnection)factory.CreateConnection ();
+
+                       var engine = new EngineConfig {
+                               Type = EngineType.MySQL,
+                               QuoteCharacter = "`",
+                               RemovesTrailingSpaces = true,
+                               EmptyBinaryAsNull = true,
+                               SupportsDate = true,
+                               SupportsTime = true
+                       };
+
+                       return new ConnectionHolder<OdbcConnection> (engine, connection, connectionString);
+               }
+#endif
+
+               private void CreateMssqlDatabase()
                {
-                       string connection_name = Environment.GetEnvironmentVariable ("PROVIDER_TESTS_CONNECTION");
-                       if (connection_name == null || connection_name.Length == 0)
-                               throw new ArgumentException ("PROVIDER_TESTS_CONNECTION environment variable is not set.");
-
-                       ConnectionConfig [] connections = (ConnectionConfig [])
-                               ConfigurationManager.GetSection ("providerTests");
-                       foreach (ConnectionConfig connConfig in connections) {
-                               if (connConfig.Name != connection_name)
-                                       continue;
-
-                               _connectionString = connConfig.ConnectionString;
-                               DbProviderFactory factory = DbProviderFactories.GetFactory (
-                                       connConfig.Factory);
-                               _connection = factory.CreateConnection ();
-                               _connection.ConnectionString = _connectionString;
-                               _connectionString = _connection.ConnectionString;
-                               _engine = connConfig.Engine;
-                               return;
+                       DBHelper.ExecuteNonQuery(sql.Connection, $"CREATE DATABASE [{DatabaseName}]");
+                       sql.Connection.ChangeDatabase(DatabaseName);
+
+                       string query = File.ReadAllText(@"Test/ProviderTests/sql/sqlserver.sql");
+
+                       var queries = SplitSqlStatements(query);
+                       foreach (var subQuery in queries)
+                       {
+                               DBHelper.ExecuteNonQuery(sql.Connection, subQuery);
                        }
+               }
+
+#if !NO_ODBC
+               private void CreateMysqlDatabase()
+               {
+                       DBHelper.ExecuteNonQuery(odbc.Connection, $"CREATE DATABASE {DatabaseName}");
+                       odbc.Connection.ChangeDatabase(DatabaseName);
+                       odbc.ConnectionString += $"database={DatabaseName}";
 
-                       throw new ArgumentException ("Connection '" + connection_name + "' not found.");
+                       string query = File.ReadAllText("Test/ProviderTests/sql/MySQL_5.sql");
+
+                       var groups = query.Replace("delimiter ", "")
+                               .Split(new[] { "//\n" }, StringSplitOptions.RemoveEmptyEntries);
+
+                       foreach (var subQuery in groups[0].Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Concat(groups.Skip(1)))
+                       {
+                               DBHelper.ExecuteNonQuery(odbc.Connection, subQuery);
+                       }
                }
+#endif
 
-               public static ConnectionManager Singleton {
-                       get {return Instance;}
+               private void DropMssqlDatabase()
+               {
+                       sql.Connection.ChangeDatabase("master");
+                       string query = $"ALTER DATABASE [{DatabaseName}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;\nDROP DATABASE [{DatabaseName}]";
+                       DBHelper.ExecuteNonQuery(sql.Connection, query);
                }
 
-               public
-               DbConnection
-               Connection {
-                       get {return _connection;}
+#if !NO_ODBC
+               private void DropMysqlDatabase()
+               {
+                       string query = $"DROP DATABASE [{DatabaseName}]";
+                       DBHelper.ExecuteNonQuery(odbc.Connection, query);
                }
+#endif
 
-               public string ConnectionString {
-                       get {return _connectionString;}
+               // Split SQL script by "GO" statements
+               private static IEnumerable<string> SplitSqlStatements(string sqlScript)
+               {
+                       var statements = Regex.Split(sqlScript,
+                                       $@"^[\t ]*GO[\t ]*\d*[\t ]*(?:--.*)?$",
+                                       RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase);
+                       return statements.Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => x.Trim(' ', '\r', '\n'));
                }
 
-               internal EngineConfig Engine {
-                       get { return _engine; }
+               public static ConnectionManager Instance => instance ?? (instance = new ConnectionManager());
+
+               public string DatabaseName { get; }
+
+#if !NO_ODBC
+
+               private ConnectionHolder<OdbcConnection> odbc;
+
+               public ConnectionHolder<OdbcConnection> Odbc
+               {
+                       get
+                       {
+                               if (odbc == null)
+                                       Assert.Ignore($"{OdbcEnvVar} environment variable is not set");
+                               return odbc;
+                       }
+               }
+#endif
+
+               public ConnectionHolder<SqlConnection> Sql
+               {
+                       get
+                       {
+                               if (sql == null)
+                                       Assert.Ignore($"{SqlEnvVar} environment variable is not set");
+                               return sql;
+                       }
                }
 
-               public void OpenConnection ()
+               public void Close()
                {
-                       if (!(_connection.State == ConnectionState.Closed || _connection.State == ConnectionState.Broken))
-                               _connection.Close ();
-                       _connection.ConnectionString = _connectionString;
-                       _connection.Open ();
+                       sql?.CloseConnection();
+#if !NO_ODBC                   
+                       odbc?.CloseConnection();
+#endif
                }
+       }
+
+       public class ConnectionHolder<TConnection> where TConnection : DbConnection
+       {
+               private TConnection connection;
+
+               public EngineConfig EngineConfig { get; }
+
+               public TConnection Connection
+               {
+                       get
+                       {
+                               if (!(connection.State == ConnectionState.Closed || 
+                                       connection.State == ConnectionState.Broken))
+                                       connection.Close();
+                               connection.ConnectionString = ConnectionString;
+                               connection.Open();
+                               return connection;
+                       }
+               }
+
+               public void CloseConnection()
+               {
+                       if (connection != null && connection.State != ConnectionState.Closed)
+                               connection.Close();
+               }
+
+               public string ConnectionString { get; set; }
 
-               public void CloseConnection ()
+               public ConnectionHolder(EngineConfig engineConfig, TConnection connection, string connectionString)
                {
-                       if (_connection != null && _connection.State != ConnectionState.Closed)
-                               _connection.Close ();
+                       EngineConfig = engineConfig;
+                       this.connection = connection;
+                       ConnectionString = connectionString;
                }
        }
 }
index 3170c9c1261818e7009e63967ae906af7bbec7f8..4ef4a0b6c41c5dd07b2f6fe977b886068ea12888 100644 (file)
 
 using System;
 using System.Data;
-using System.Data.Common;
 using System.Text;
 
-using Mono.Data;
-
-using NUnit.Framework;
-
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        public sealed class DBHelper
        {
index d19bb10d40d3601f532536d36f4e0887b1fb12cc..2e1550d30bc458da5a527e3da7107e711a41d985 100644 (file)
@@ -30,7 +30,7 @@ using System;
 using System.Data;
 using System.Data.SqlClient;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        public class DataProvider
        {
@@ -47,7 +47,7 @@ namespace MonoTests.System.Data
                        query += "Select * from datetime_family order by id ASC;";
 
                        SqlDataAdapter adapter = new SqlDataAdapter (query,
-                               ConnectionManager.Singleton.ConnectionString);
+                               ConnectionManager.Instance.Sql.ConnectionString);
                        adapter.TableMappings.Add ("Table", "numeric_family");
                        adapter.TableMappings.Add ("Table1", "string_family");
                        adapter.TableMappings.Add ("Table2", "binary_family");
index e7765c3450fd20b3b3ba843da1cdc103ebc8ea96..6b426124ba142c9fe84a9fe703f4d776636cdeb9 100644 (file)
 //
 
 using System;
-using System.Configuration;
 using System.Globalization;
 using System.Xml;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
-       internal sealed class EngineConfig
+       public sealed class EngineConfig
        {
                private string name;
                private string quoteCharacter;
@@ -48,7 +47,7 @@ namespace MonoTests.System.Data
                private EngineType type;
                private int clientVersion;
 
-               private EngineConfig ()
+               public EngineConfig ()
                {
                }
 
@@ -61,42 +60,52 @@ namespace MonoTests.System.Data
                /// </summary>
                public string QuoteCharacter {
                        get { return quoteCharacter; }
+                       set { quoteCharacter = value; }
                }
 
                public EngineType Type {
                        get { return type; }
+                       set { type = value; }
                }
 
                public bool RemovesTrailingSpaces {
                        get { return removesTrailingSpaces; }
+                       set { removesTrailingSpaces = value; }
                }
 
                public bool EmptyBinaryAsNull {
                        get { return emptyBinaryAsNull; }
+                       set { emptyBinaryAsNull = value; }
                }
 
                public bool SupportsMicroseconds {
                        get { return supportsMicroseconds; }
+                       set { supportsMicroseconds = value; }
                }
 
                public bool SupportsUniqueIdentifier {
                        get { return supportsUniqueIdentifier; }
+                       set { supportsUniqueIdentifier = value; }
                }
 
                public bool SupportsDate {
                        get { return supportsDate; }
+                       set { supportsDate = value; }
                }
 
                public bool SupportsTime {
                        get { return supportsTime; }
+                       set { supportsTime = value; }
                }
 
                public bool SupportsTimestamp {
                        get { return supportsTimestamp; }
+                       set { supportsTimestamp = value; }
                }
 
                public int ClientVersion {
                       get { return clientVersion; }
+                      set { clientVersion = value; }
                }
 
                public static EngineConfig FromXml (XmlNode config)
@@ -183,14 +192,14 @@ namespace MonoTests.System.Data
                        string msg = string.Format (CultureInfo.InvariantCulture,
                                        "Invalid value '{0}' for attribute {1}.",
                                        value, name);
-                       throw new ConfigurationErrorsException (msg, cause, node);
+                       throw new ArgumentOutOfRangeException (msg, cause);
                }
 
                static Exception CreateAttributeMissingException (string name, XmlNode node)
                {
                        string msg = string.Format (CultureInfo.InvariantCulture,
                                "Missing '{0}' attribute.", name);
-                       throw new ConfigurationErrorsException (msg, node);
+                       throw new ArgumentException (msg);
                }
        }
 }
index bcd6a72d0c8b0a2a57ba114f6591c1a073cd2997..b172d5f25bf2b6671d878f13ac8647e4b64fde4e 100644 (file)
@@ -26,7 +26,7 @@
 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 // SOFTWARE.
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        public enum EngineType
        {
index fd7c01383d3e48be60057a134efdaf2f65f094aa..cb3ba28fee1dceebf54e991f72959360f1405175 100644 (file)
@@ -27,6 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_CONFIGURATION
+
 using System;
 using System.Collections;
 using System.Configuration;
@@ -34,7 +36,7 @@ using System.Globalization;
 using System.Text;
 using System.Xml;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        class ProviderTestsConfigurationHandler : IConfigurationSectionHandler
        {
@@ -72,3 +74,5 @@ namespace MonoTests.System.Data
                }
        }
 }
+
+#endif
\ No newline at end of file
index 54515b893190f214ae7cfed02fb26bf0f7c6a866..35d9fdd783662c6e302cd6a2e54449fa70aa9a0a 100644 (file)
 using System;
 using System.Data;
 using System.Data.Common;
-using System.Data.Odbc;
 using System.Data.SqlClient;
 using System.Data.SqlTypes;
 using System.Globalization;
 using System.Text;
-
-using Mono.Data;
-
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        [TestFixture]
-       [Category ("odbc")]
        [Category ("sqlserver")]
        public class DataReaderTest
        {
@@ -88,17 +83,15 @@ namespace MonoTests.System.Data
                [SetUp]
                public void SetUp ()
                {
-                       conn = ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = conn.CreateCommand ();
                }
 
                [TearDown]
                public void TearDown ()
                {
-                       if (cmd != null)
-                               cmd.Dispose ();
-                       ConnectionManager.Singleton.CloseConnection ();
+                       cmd?.Dispose ();
+                       ConnectionManager.Instance.Close();
                }
 
                [Test]
@@ -252,6 +245,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetChars_Reader_NoData ()
                {
                        //Console.WriteLine ("GetChars_Reader_NoData - first_executereader");
@@ -261,9 +255,8 @@ namespace MonoTests.System.Data
                                try {
                                        rdr.GetChars (-1, 0, (char []) null, 0, 0);
                                        Assert.Fail ("#A1");
-                               } catch (InvalidOperationException ex) {
+                               } catch (IndexOutOfRangeException ex) {
                                        // No data exists for the row/column
-                                       Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
                                        Assert.IsNull (ex.InnerException, "#A3");
                                        Assert.IsNotNull (ex.Message, "#A4");
                                }
@@ -273,9 +266,8 @@ namespace MonoTests.System.Data
                                try {
                                        rdr.GetChars (-1, 0, (char []) null, 0, 0);
                                        Assert.Fail ("#C1");
-                               } catch (InvalidOperationException ex) {
+                               } catch (IndexOutOfRangeException ex) {
                                        // No data exists for the row/column
-                                       Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNull (ex.InnerException, "#C3");
                                        Assert.IsNotNull (ex.Message, "#C4");
                                }
@@ -291,7 +283,7 @@ namespace MonoTests.System.Data
                                cmd.CommandText = "SELECT * FROM employee WHERE lname='kumar'";
                                reader = cmd.ExecuteReader ();
 
-                               switch (ConnectionManager.Singleton.Engine.Type) {
+                               switch (ConnectionManager.Instance.Sql.EngineConfig.Type) {
                                case EngineType.SQLServer:
                                        Assert.AreEqual ("int", reader.GetDataTypeName (0), "#1");
                                        break;
@@ -640,7 +632,7 @@ namespace MonoTests.System.Data
                [Test]
                public void GetSchemaTable_Command_Disposed ()
                {
-                       if (RunningOnMono && (conn is OdbcConnection))
+                       if (RunningOnMono)
                                Assert.Ignore ("Our statement handle is closed when we dispose the (Odbc)Command");
 
                        IDataReader reader = null;
@@ -1007,7 +999,7 @@ namespace MonoTests.System.Data
                                cmd.CommandText = "select id, fname, id + 20 as plustwenty from employee";
                                reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
                                Assert.IsFalse (reader.IsClosed, "#1");
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                                Assert.IsTrue (reader.IsClosed, "#2");
                        } finally {
                                if (reader != null)
@@ -2405,6 +2397,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetBytes_DataIndex_Overflow ()
                {
                        cmd.CommandText = "SELECT type_blob FROM binary_family where id = 2";
@@ -2586,6 +2579,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetValues_Reader_Closed ()
                {
                        //Console.WriteLine ("GetValues_Reader_Closed - first_executereader");
@@ -2598,9 +2592,8 @@ namespace MonoTests.System.Data
                                try {
                                        rdr.GetValues ((object []) null);
                                        Assert.Fail ("#1");
-                               } catch (InvalidOperationException ex) {
+                               } catch (ArgumentNullException ex) {
                                        // No data exists for the row/column
-                                       Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
                                        Assert.IsNull (ex.InnerException, "#3");
                                        Assert.IsNotNull (ex.Message, "#4");
                                }
@@ -2608,6 +2601,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetValues_Reader_NoData ()
                {
                        //Console.WriteLine ("GetValues_Reader_NoData - first_executereader");                  
@@ -2617,9 +2611,8 @@ namespace MonoTests.System.Data
                                try {
                                        rdr.GetValues ((object []) null);
                                        Assert.Fail ("#A1");
-                               } catch (InvalidOperationException ex) {
+                               } catch (ArgumentNullException ex) {
                                        // No data exists for the row/column
-                                       Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
                                        Assert.IsNull (ex.InnerException, "#A3");
                                        Assert.IsNotNull (ex.Message, "#A4");
                                }
@@ -2629,9 +2622,8 @@ namespace MonoTests.System.Data
                                try {
                                        rdr.GetValues ((object []) null);
                                        Assert.Fail ("#C1");
-                               } catch (InvalidOperationException ex) {
+                               } catch (ArgumentNullException ex) {
                                        // No data exists for the row/column
-                                       Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNull (ex.InnerException, "#C3");
                                        Assert.IsNotNull (ex.Message, "#C4");
                                }
index 65b0952b1fbad7eb076e99b373ec41dfac805070..e93f9fbccab13a260cbb6666fa426f70db3b59ac 100644 (file)
 using System;
 using System.Data;
 using System.Data.Common;
-using System.Data.Odbc;
 using System.Data.SqlClient;
 using System.Data.SqlTypes;
 using System.Globalization;
-
-using Mono.Data;
-
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        [TestFixture]
-       [Category ("odbc")]
        [Category ("sqlserver")]
        public class DbDataReaderTest
        {
@@ -53,19 +48,16 @@ namespace MonoTests.System.Data
                [SetUp]
                public void SetUp ()
                {
-                       conn = ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = conn.CreateCommand ();
                }
 
                [TearDown]
                public void TearDown ()
                {
-                       if (cmd != null)
-                               cmd.Dispose ();
-                       if (rdr != null)
-                               rdr.Dispose ();
-                       ConnectionManager.Singleton.CloseConnection ();
+                       cmd?.Dispose ();
+                       rdr?.Dispose ();
+                       ConnectionManager.Instance.Close ();
                }
 
                [Test]
index 79903b490a94ce50249e5e8b28501980143f8b30..aa430adf701100a6f3598b142cd09bf04bc6b8a3 100644 (file)
 using System;
 using System.Data;
 using System.Data.Common;
-
-using Mono.Data;
-
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
 {
        [TestFixture]
        [Category ("odbc"), Category ("sqlserver")]
@@ -48,8 +45,7 @@ namespace MonoTests.System.Data
                [SetUp]
                public void SetUp ()
                {
-                       conn = ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = conn.CreateCommand ();
                }
 
@@ -58,7 +54,7 @@ namespace MonoTests.System.Data
                {
                        if (cmd != null)
                                cmd.Dispose ();
-                       ConnectionManager.Singleton.CloseConnection ();
+                       ConnectionManager.Instance.Close ();
                }
 
                [Test]
@@ -167,9 +163,8 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (new byte [] { 0x32, 0x56, 0x00, 0x44, 0x22 }, val, "#A3");
                        }
 
-                       ConnectionManager.Singleton.CloseConnection ();
-                       conn = ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       ConnectionManager.Instance.Sql.CloseConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
 
                        using (IDataReader reader = cmd.ExecuteReader (behavior)) {
                                Assert.IsTrue (reader.Read (), "#B1");
@@ -185,9 +180,9 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (reader.Read (), "#C");
                        }
 
-                       ConnectionManager.Singleton.CloseConnection ();
-                       conn = ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       ConnectionManager.Instance.Sql.CloseConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
+
 
                        using (IDataReader reader = cmd.ExecuteReader (behavior)) {
                                Assert.IsTrue (reader.Read (), "#D");
index bc9fc67bcc93c9929e3cb8b6df59b413ef7f02cf..aae0e84b04933ca7e63d21d70049cbba2be6ae9b 100644 (file)
@@ -14,10 +14,13 @@ System.Data.Odbc/OdbcParameterCollectionTest.cs
 ProviderIndependant/DataReaderTest.cs
 ProviderIndependant/DbDataReaderTest.cs
 ProviderIndependant/IDbCommandTest.cs
+System.Data.SqlClient/SqlClientFactoryTest.cs
 System.Data.SqlClient/SqlCommandBuilderTest.cs
 System.Data.SqlClient/SqlCommandTest.cs
 System.Data.SqlClient/SqlDataReaderTest.cs
 System.Data.SqlClient/SqlDataAdapterTest.cs
 System.Data.SqlClient/SqlTransactionTest.cs
+System.Data.SqlClient/SqlConnectionStringBuilderTest.cs
 System.Data.SqlClient/SqlConnectionTest.cs
 System.Data.SqlClient/SqlParameterTest.cs
+System.Data.SqlClient/SqlParameterCollectionTest.cs
\ No newline at end of file
index a9a67fbd2a881b51600ba8c78b9ef75b6d37cfc2..4583ca8fe1d41233802d95b1d1fe071cfb0d8d34 100644 (file)
 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 // SOFTWARE.
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Common;
 using System.Data.Odbc;
-using Mono.Data;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected.Odbc
 {
        [TestFixture]
        [Category ("odbc")]
@@ -45,7 +46,7 @@ namespace MonoTests.System.Data
                [Test]
                public void GetInsertCommandTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        OdbcCommand cmd = null;
 
                        try {
@@ -94,17 +95,17 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetInsertCommandTestWithExpression ()
                {
-                       if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
+                       if (ConnectionManager.Instance.Odbc.EngineConfig.Type == EngineType.MySQL)
                                Assert.Ignore ("Schema info from MySQL is incomplete");
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        OdbcCommand cmd = null;
 
                        try {
@@ -123,14 +124,14 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetUpdateCommandTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        OdbcCommand cmd = null;
 
                        try {
@@ -177,7 +178,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -185,7 +186,7 @@ namespace MonoTests.System.Data
                [Ignore ("FIXME: Auto SQL generation during Update requires a valid SelectCommand")]
                public void GetUpdateCommandDBConcurrencyExceptionTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
                                string selectQuery = "select id, lname from employee where id = 3";
                                OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
@@ -214,14 +215,15 @@ namespace MonoTests.System.Data
                                        Assert.AreEqual (1, ex.RowCount, "#6");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetInsertCommandTest_option_true ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
                                string selectQuery = "select id, lname from employee where id = 3";
                                OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
@@ -236,14 +238,14 @@ namespace MonoTests.System.Data
                                Assert.AreSame (conn, cmd.Connection, "#2");
                                AssertInsertParameters (cmd, "#3:");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetInsertCommandTest_option_false ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
                                string selectQuery = "select id, lname from employee where id = 3";
                                OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
@@ -258,14 +260,15 @@ namespace MonoTests.System.Data
                                Assert.AreSame (conn, cmd.Connection, "#2");
                                AssertInsertParameters (cmd, "#3:");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetUpdateCommandTest_option_true ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
                                string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
                                OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
@@ -280,14 +283,14 @@ namespace MonoTests.System.Data
                                Assert.AreSame (conn, cmd.Connection, "#2");
                                AssertUpdateParameters (cmd, "#3:");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetUpdateCommandTest_option_false ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
                                string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
                                OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
@@ -302,14 +305,15 @@ namespace MonoTests.System.Data
                                Assert.AreSame (conn, cmd.Connection, "#2");
                                AssertUpdateParameters (cmd, "#3:");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetDeleteCommandTest_option_true ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
                                string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
                                OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
@@ -324,14 +328,14 @@ namespace MonoTests.System.Data
                                Assert.AreSame (conn, cmd.Connection, "#2");
                                AssertDeleteParameters (cmd, "#3:");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetDeleteCommandTest_option_false ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
                                string selectQuery = "select id, lname, id+1 as next_id from employee where id = 3";
                                OdbcDataAdapter da = new OdbcDataAdapter (selectQuery, conn);
@@ -346,14 +350,14 @@ namespace MonoTests.System.Data
                                Assert.AreSame (conn, cmd.Connection, "#2");
                                AssertDeleteParameters (cmd, "#3:");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetDeleteCommandTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        OdbcCommand cmd = null;
 
                        try {
@@ -401,7 +405,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -409,7 +413,7 @@ namespace MonoTests.System.Data
                [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
                public void QuotePrefix_DeleteCommand_Generated ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        OdbcCommand cmd = null;
 
@@ -439,7 +443,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -447,7 +451,7 @@ namespace MonoTests.System.Data
                [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
                public void QuotePrefix_InsertCommand_Generated ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        OdbcCommand cmd = null;
 
@@ -477,7 +481,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -485,7 +489,7 @@ namespace MonoTests.System.Data
                [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
                public void QuotePrefix_UpdateCommand_Generated ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        OdbcCommand cmd = null;
 
@@ -515,7 +519,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -523,7 +527,7 @@ namespace MonoTests.System.Data
                [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
                public void QuoteSuffix_DeleteCommand_Generated ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        OdbcCommand cmd = null;
 
@@ -553,7 +557,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -561,7 +565,7 @@ namespace MonoTests.System.Data
                [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
                public void QuoteSuffix_InsertCommand_Generated ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        OdbcCommand cmd = null;
 
@@ -591,7 +595,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -599,7 +603,7 @@ namespace MonoTests.System.Data
                [Ignore ("QuoteSuffix and QuotePrefix are now in DbCommandBuilder, while commands are in implementation classes. Result: we cannot perform this check until we refactor this.")]
                public void QuoteSuffix_UpdateCommand_Generated ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        OdbcCommand cmd = null;
 
@@ -629,7 +633,7 @@ namespace MonoTests.System.Data
                        } finally {
                                if (cmd != null)
                                        cmd.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -637,10 +641,9 @@ namespace MonoTests.System.Data
                public void QuoteIdentifier2 ()
                {
                        OdbcCommandBuilder cb;
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
-                       string quote_char = ConnectionManager.Singleton.Engine.QuoteCharacter;
+                       string quote_char = ConnectionManager.Instance.Odbc.EngineConfig.QuoteCharacter;
 
                        try {
                                cb = new OdbcCommandBuilder ();
@@ -708,7 +711,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (" ", cb.QuoteIdentifier (" ", conn), "#E11");
                                Assert.AreEqual ("\r", cb.QuoteIdentifier ("\r", conn), "#E12");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -719,7 +722,7 @@ namespace MonoTests.System.Data
                        Assert.AreEqual ("p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
                        Assert.AreEqual ("id", cmd.Parameters [0].SourceColumn, prefix + "SourceColumn (0)");
                        Assert.IsNull (cmd.Parameters [0].Value, prefix + "Value (0)");
-                       Assert.AreEqual (DbType.AnsiString, cmd.Parameters [1].DbType, prefix + "DbType (1)");
+                       Assert.AreEqual (DbType.String, cmd.Parameters [1].DbType, prefix + "DbType (1)");
                        Assert.AreEqual ("p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
                        Assert.AreEqual ("lname", cmd.Parameters [1].SourceColumn, prefix + "SourceColumn (1)");
                        Assert.IsNull (cmd.Parameters [1].Value, prefix + "Value (1)");
@@ -732,7 +735,7 @@ namespace MonoTests.System.Data
                        Assert.AreEqual ("p1", cmd.Parameters [0].ParameterName, prefix + "ParameterName (0)");
                        Assert.AreEqual ("id", cmd.Parameters [0].SourceColumn, prefix + "SourceColumn (0)");
                        Assert.IsNull (cmd.Parameters [0].Value, prefix + "Value (0)");
-                       Assert.AreEqual (DbType.AnsiString, cmd.Parameters [1].DbType, prefix + "DbType (1)");
+                       Assert.AreEqual (DbType.String, cmd.Parameters [1].DbType, prefix + "DbType (1)");
                        Assert.AreEqual ("p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
                        Assert.AreEqual ("lname", cmd.Parameters [1].SourceColumn, prefix + "SourceColumn (1)");
                        Assert.IsNull (cmd.Parameters [1].Value, prefix + "Value (1)");
@@ -744,7 +747,7 @@ namespace MonoTests.System.Data
                        Assert.AreEqual ("p4", cmd.Parameters [3].ParameterName, prefix + "ParameterName (3)");
                        Assert.AreEqual ("lname", cmd.Parameters [3].SourceColumn, prefix + "SourceColumn (3)");
                        Assert.AreEqual (1, cmd.Parameters [3].Value, prefix + "Value (3)");
-                       Assert.AreEqual (DbType.AnsiString, cmd.Parameters [4].DbType, prefix + "DbType (4)");
+                       Assert.AreEqual (DbType.String, cmd.Parameters [4].DbType, prefix + "DbType (4)");
                        Assert.AreEqual ("p5", cmd.Parameters [4].ParameterName, prefix + "ParameterName (4)");
                        Assert.AreEqual ("lname", cmd.Parameters [4].SourceColumn, prefix + "SourceColumn (4)");
                        Assert.IsNull (cmd.Parameters [4].Value, prefix + "Value (4)");
@@ -761,7 +764,7 @@ namespace MonoTests.System.Data
                        Assert.AreEqual ("p2", cmd.Parameters [1].ParameterName, prefix + "ParameterName (1)");
                        Assert.AreEqual ("lname", cmd.Parameters [1].SourceColumn, prefix + "SourceColumn (1)");
                        Assert.AreEqual (1, cmd.Parameters [1].Value, prefix + "Value (1)");
-                       Assert.AreEqual (DbType.AnsiString, cmd.Parameters [2].DbType, prefix + "DbType (2)");
+                       Assert.AreEqual (DbType.String, cmd.Parameters [2].DbType, prefix + "DbType (2)");
                        Assert.AreEqual ("p3", cmd.Parameters [2].ParameterName, prefix + "ParameterName (2)");
                        Assert.AreEqual ("lname", cmd.Parameters [2].SourceColumn, prefix + "SourceColumn (2)");
                        Assert.IsNull (cmd.Parameters [2].Value, prefix + "Value (2)");
@@ -772,3 +775,5 @@ namespace MonoTests.System.Data
                // FIXME: Add test for ContinueUpdateOnError property
        }
 }
+
+#endif
\ No newline at end of file
index 1a93a511d5faf42ef49c8219fce1df85e81e0d6f..27826d094b6efa2c5d464f63fb86624363e9704d 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Common;
 using System.Data.Odbc;
-using Mono.Data;
-
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+
+namespace MonoTests.System.Data.Connected.Odbc
 {
        [TestFixture]
        [Category ("odbc")]
@@ -48,8 +49,7 @@ namespace MonoTests.System.Data
                [SetUp]
                public void SetUp ()
                {
-                       conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Odbc.Connection;
                        cmd = conn.CreateCommand ();
                }
 
@@ -58,7 +58,7 @@ namespace MonoTests.System.Data
                {
                        if (cmd != null)
                                cmd.Dispose ();
-                       ConnectionManager.Singleton.CloseConnection ();
+                       ConnectionManager.Instance.Close ();
                }
 
                [Test]
@@ -150,7 +150,7 @@ namespace MonoTests.System.Data
                        cmd.CommandText = "select count(*) from employee where id <= ?;";
                        cmd.Parameters.Add ("@un", OdbcType.Int).Value = 3;
                        ret = cmd.ExecuteNonQuery ();
-                       switch (ConnectionManager.Singleton.Engine.Type) {
+                       switch (ConnectionManager.Instance.Odbc.EngineConfig.Type) {
                        case EngineType.SQLServer:
                                Assert.AreEqual (-1, ret, "#1");
                                break;
@@ -167,7 +167,7 @@ namespace MonoTests.System.Data
                        cmd.CommandText = "select * from employee where id <= ?;";
                        cmd.Parameters.Add ("@un", OdbcType.Int).Value = 3;
                        ret = cmd.ExecuteNonQuery ();
-                       switch (ConnectionManager.Singleton.Engine.Type) {
+                       switch (ConnectionManager.Instance.Odbc.EngineConfig.Type) {
                        case EngineType.SQLServer:
                                Assert.AreEqual (-1, ret, "#2");
                                break;
@@ -183,7 +183,7 @@ namespace MonoTests.System.Data
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = "select * from employee where id <= 3;";
                        ret = cmd.ExecuteNonQuery ();
-                       switch (ConnectionManager.Singleton.Engine.Type) {
+                       switch (ConnectionManager.Instance.Odbc.EngineConfig.Type) {
                        case EngineType.SQLServer:
                                Assert.AreEqual (-1, ret, "#3");
                                break;
@@ -297,3 +297,5 @@ namespace MonoTests.System.Data
                }
        }
 }
+
+#endif
\ No newline at end of file
index 8d630a8343f3a6553bb172b01adaac201eba9b85..02c7c9a4ca3cbd3bbfc0c57f8b88894815236641 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Odbc;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.Odbc
+namespace MonoTests.System.Data.Connected.Odbc
 {
        [TestFixture]
        [Category ("odbc")]
@@ -41,9 +43,9 @@ namespace MonoTests.System.Data.Odbc
                [Test]
                public void FillTest ()
                {
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       try {
-                               ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
+                       try
+                       {
                                // For this Test, you must create sample table
                                // called person-age, with a non-zero number of rows
                                // and non-zero number of columns
@@ -70,16 +72,17 @@ namespace MonoTests.System.Data.Odbc
                                                                 "#4 column values must not be of size 0");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
+               [Ignore]
                public void InsertUtf8Test ()
                {
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       try {
-                               ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
+                       try
+                       {
                                DoExecuteNonQuery ((OdbcConnection) conn,
                                                   "CREATE TABLE odbc_ins_utf8_test(ival int not null, sval varchar(20))");
                                Assert.AreEqual (DoExecuteNonQuery ((OdbcConnection) conn,
@@ -97,7 +100,7 @@ namespace MonoTests.System.Data.Odbc
                                                 3);
                        } finally {
                                DoExecuteNonQuery ((OdbcConnection) conn, "DROP TABLE odbc_ins_utf8_test");
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -115,3 +118,5 @@ namespace MonoTests.System.Data.Odbc
                }
        }
 }
+
+#endif
\ No newline at end of file
index 2b8bf0b069cb4b561b09c657c5d811bb64e49999..a91b13eeca47a5048fbd0ff73d3d0096a24dc3dc 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Common;
 using System.Data.Odbc;
 using System.Globalization;
 using System.Text;
-
-using Mono.Data;
-
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+
+namespace MonoTests.System.Data.Connected.Odbc
 {
        [TestFixture]
        [Category ("odbc")]
@@ -84,8 +84,7 @@ namespace MonoTests.System.Data
                [SetUp]
                public void SetUp ()
                {
-                       conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Odbc.Connection;
                        cmd = conn.CreateCommand ();
                }
 
@@ -94,7 +93,7 @@ namespace MonoTests.System.Data
                {
                        if (cmd != null)
                                cmd.Dispose ();
-                       ConnectionManager.Singleton.CloseConnection ();
+                       ConnectionManager.Instance.Close ();
                }
 
                [Test]
@@ -198,7 +197,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (totalsize, ret, "#C1");
                        }
 
-                       ConnectionManager.Singleton.CloseConnection ();
+                       ConnectionManager.Instance.Odbc.CloseConnection ();
                }
 
                [Test]
@@ -323,7 +322,7 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#A:BaseSchemaName_IsNull");
                                Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#A:BaseSchemaName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#A:BaseCatalogName_IsNull");
-                               Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#A:BaseCatalogName_Value");
+                               Assert.AreEqual (ConnectionManager.Instance.DatabaseName, pkRow ["BaseCatalogName"], "#A:BaseCatalogName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#A:BaseTableName_IsNull");
                                Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#A:BaseTableName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#A:BaseColumnName_IsNull");
@@ -411,7 +410,7 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#C:BaseSchemaName_IsNull");
                                Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#C:BaseSchemaName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#C:BaseCatalogName_IsNull");
-                               Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#C:BaseCatalogName_Value");
+                               Assert.AreEqual (ConnectionManager.Instance.DatabaseName, pkRow ["BaseCatalogName"], "#C:BaseCatalogName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#C:BaseTableName_IsNull");
                                Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#C:BaseTableName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#C:BaseColumnName_IsNull");
@@ -502,7 +501,7 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#E:BaseSchemaName_IsNull");
                                Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#E:BaseSchemaName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#E:BaseCatalogName_IsNull");
-                               Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#E:BaseCatalogName_Value");
+                               Assert.AreEqual (ConnectionManager.Instance.DatabaseName, pkRow ["BaseCatalogName"], "#E:BaseCatalogName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#E:BaseTableName_IsNull");
                                Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#E:BaseTableName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#E:BaseColumnName_IsNull");
@@ -590,7 +589,7 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#G:BaseSchemaName_IsNull");
                                Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#G:BaseSchemaName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#G:BaseCatalogName_IsNull");
-                               Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#G:BaseCatalogName_Value");
+                               Assert.AreEqual (ConnectionManager.Instance.DatabaseName, pkRow ["BaseCatalogName"], "#G:BaseCatalogName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#G:BaseTableName_IsNull");
                                Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#G:BaseTableName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#G:BaseColumnName_IsNull");
@@ -683,7 +682,7 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#I:BaseSchemaName_IsNull");
                                Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#I:BaseSchemaName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#I:BaseCatalogName_IsNull");
-                               Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#I:BaseCatalogName_Value");
+                               Assert.AreEqual (ConnectionManager.Instance.DatabaseName, pkRow ["BaseCatalogName"], "#I:BaseCatalogName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#I:BaseTableName_IsNull");
                                Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#I:BaseTableName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#I:BaseColumnName_IsNull");
@@ -771,7 +770,7 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#K:BaseSchemaName_IsNull");
                                Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#K:BaseSchemaName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#K:BaseCatalogName_IsNull");
-                               Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#K:BaseCatalogName_Value");
+                               Assert.AreEqual (ConnectionManager.Instance.DatabaseName, pkRow ["BaseCatalogName"], "#K:BaseCatalogName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#K:BaseTableName_IsNull");
                                Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#K:BaseTableName_Value");
                                Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#K:BaseColumnName_IsNull");
@@ -832,7 +831,7 @@ namespace MonoTests.System.Data
                        // MySQL currently does not support output parameters
                        // in its ODBC connector:
                        // http://www.paragon-cs.com/mag/issue3.pdf
-                       if (ConnectionManager.Singleton.Engine.Type != EngineType.SQLServer)
+                       if (ConnectionManager.Instance.Odbc.EngineConfig.Type != EngineType.SQLServer)
                                Assert.Ignore ("MySQL does not (yet) support output parameters using ODBC.");
 
                        IDataReader reader = null;
@@ -923,7 +922,7 @@ namespace MonoTests.System.Data
                [Test]
                public void FindZeroInToStringTest ()
                {
-                       if (ConnectionManager.Singleton.Engine.Type != EngineType.MySQL)
+                       if (ConnectionManager.Instance.Odbc.EngineConfig.Type != EngineType.MySQL)
                                Assert.Ignore ("Only applies to MySQL.");
 
                        IDataReader reader = null;
@@ -999,7 +998,7 @@ namespace MonoTests.System.Data
                [Test]
                public void Bug332404Test ()
                {
-                       if (ConnectionManager.Singleton.Engine.Type != EngineType.MySQL)
+                       if (ConnectionManager.Instance.Odbc.EngineConfig.Type != EngineType.MySQL)
                                Assert.Ignore ("Only applies to MySQL.");
 
                        cmd = new OdbcCommand ("DROP TABLE IF EXISTS odbc_test");
@@ -1026,7 +1025,7 @@ namespace MonoTests.System.Data
                [Test]
                public void Bug332400Test ()
                {
-                       if (ConnectionManager.Singleton.Engine.Type != EngineType.MySQL)
+                       if (ConnectionManager.Instance.Odbc.EngineConfig.Type != EngineType.MySQL)
                                Assert.Ignore ("Only applies to MySQL.");
 
                        cmd = new OdbcCommand ("DROP TABLE IF EXISTS blob_test");
@@ -1051,37 +1050,36 @@ namespace MonoTests.System.Data
                [Test]
                public void Bug419224Test () 
                {
-                       cmd = new OdbcCommand ("DROP TABLE IF EXISTS bug419224test");
+                       cmd = new OdbcCommand ("DROP TABLE IF EXISTS odbc_test");
                        cmd.Connection = conn;
                        cmd.ExecuteNonQuery ();
 
-                       cmd = new OdbcCommand ("CREATE TABLE bug419224test (id_test INTEGER NOT NULL, payload TINYBLOB NOT NULL)");
+                       cmd = new OdbcCommand ("CREATE TABLE odbc_test (id_test INTEGER NOT NULL, payload TINYBLOB NOT NULL)");
                        cmd.Connection = conn;
                        cmd.ExecuteNonQuery ();
 
-                       cmd = new OdbcCommand ("INSERT INTO odbc_test (id_test, payload) VALUES (1, 'test for bug419224)");
+                       cmd = new OdbcCommand ("INSERT INTO odbc_test (id_test, payload) VALUES (1, 'test for bug419224')");
                        cmd.Connection = conn;
                        cmd.ExecuteNonQuery ();
 
-                       OdbcDataAdapter Adaptador = new OdbcDataAdapter ();
+                       OdbcDataAdapter adaptador = new OdbcDataAdapter ();
+                       DataSet lector = new DataSet ();
 
-                       DataSet Lector = new DataSet ();
+                       adaptador.SelectCommand = new OdbcCommand ("SELECT * FROM odbc_test WHERE id_test=1", (OdbcConnection) conn);
+                       adaptador.Fill (lector);
+                       var payload = (byte[])lector.Tables[0].Rows[0]["payload"];
+                       Assert.AreEqual ("test for bug419224", Encoding.UTF8.GetString(payload));
 
-                       Adaptador.SelectCommand = new OdbcCommand ("SELECT * FROM odbc_test WHERE id_test=1", (OdbcConnection) conn);
-                       Adaptador.Fill (Lector);
-                       Assert.AreEqual (Lector.Tables[0].Rows[0]["payload"], 1.2346);
+                       OdbcDataReader newRdr = cmd.ExecuteReader();
 
+                       // tinyblob column index:
+                       int TinyblobIdx = 1;
 
-                       OdbcDataReader NewRdr = cmd.ExecuteReader();
+                       bool read = newRdr.Read();
 
-                       // tinyblob column index:
-                       int TinyblobIdx = 1;
-
-                       bool read = NewRdr.Read();
-
-                       if (read)
-                       {
-                               bool ret = NewRdr.IsDBNull(TinyblobIdx); 
+                       if (read)
+                       {
+                                       bool ret = newRdr.IsDBNull(TinyblobIdx); 
                                Assert.AreEqual (ret, false);
                        }
                }
@@ -1138,3 +1136,5 @@ namespace MonoTests.System.Data
                }
        }
 }
+
+#endif
\ No newline at end of file
index f08c918974e3ea09f82d376fee7daa959979f81b..0cbcad38ec285098a3a94d783435a90bcd77b689 100644 (file)
@@ -28,6 +28,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Text;
 using System.Data;
@@ -35,7 +37,7 @@ using System.Data.Odbc;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.Odbc
+namespace MonoTests.System.Data.Connected.Odbc
 {
        [TestFixture]
        [Category ("odbc")]
@@ -48,8 +50,7 @@ namespace MonoTests.System.Data.Odbc
                [Test]
                public void ParameterLengthTrimTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand cmd = conn.CreateCommand ();
@@ -61,15 +62,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (15, param.Size, "#1");
                                Assert.AreEqual (0, cmd.ExecuteScalar(), "#2");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void InsertTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -105,7 +105,7 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (OdbcType.NVarChar,OdbcCmd.Parameters[1].OdbcType, "#13 Parameters with null value must be of type NVarChar");
                                Assert.AreEqual (OdbcType.Text,OdbcCmd.Parameters[0].OdbcType, "#14 Parameter at index 0 is of type Text");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -116,8 +116,7 @@ namespace MonoTests.System.Data.Odbc
                [Test]
                public void InsertNoOverwriteTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -144,15 +143,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual ("Parameter1", OdbcCmd.Parameters[1].ParameterName, "#8 Parameters inserted without any name must get a default name");
                                Assert.AreEqual (null, OdbcCmd.Parameters[1].Value, "#9 Parameters inserted without any value must have null value");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void InsertNullTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -169,15 +167,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 The collection must contain only one parameter after Insert failed");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void InsertEmptyTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -195,15 +192,14 @@ namespace MonoTests.System.Data.Odbc
                                }
                                        
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void InsertAlreadyContainedParameterTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -223,15 +219,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (2, OdbcCmd.Parameters.Count, "#3 The collection must contain 2 parameters after Insert failed");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void InsertArgumentGreaterThanCountTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -248,15 +243,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 The collection must contain only 1 parameter after Insert failed");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void InsertNegativeArgumentTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -273,15 +267,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 The collection must contain only 1 parameter after Insert failed");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void InsertNonOdbcParameterTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -298,7 +291,7 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 The collection must contain only 1 parameter after Insert failed");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -306,8 +299,7 @@ namespace MonoTests.System.Data.Odbc
                [Test]
                public void AddRangeTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -332,7 +324,7 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual ("Parameter1", OdbcCmd.Parameters[1].ParameterName, "#5 Parameters added without any name must get a default name");
                                Assert.AreEqual (OdbcType.NVarChar,OdbcCmd.Parameters[1].OdbcType, "#6 Parameters with null value must be of type NVarChar");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -343,8 +335,7 @@ namespace MonoTests.System.Data.Odbc
                [Test]
                public void AddRangeParameterAlreadyContainedTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -366,7 +357,7 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (2, OdbcCmd.Parameters.Count, "#2 The collection must contain excatly 2 elements after AddRange failed for the third element");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -376,8 +367,7 @@ namespace MonoTests.System.Data.Odbc
                [Test]
                public void AddRangeArgumentNullExceptionTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -399,15 +389,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 If any of the parameters in the range is null, none of them should be added");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void AddRangeParameterContainedInAnotherCollTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -436,15 +425,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd2.Parameters.Count, "#4 All the elements before the invalid element must be added to the collection of OdbcCmd2");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void AddRangeMultiDimensionalArrayTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -468,15 +456,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (4, OdbcCmd.Parameters.IndexOf (p5Tmp), "#4 Not all elements are added");
                                Assert.AreEqual (OdbcType.NVarChar,OdbcCmd.Parameters[4].OdbcType, "#5 Parameters with null value must be of type NVarChar");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void AddRangeArrayValuesArgumentNullExceptionTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -500,7 +487,7 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 None of the elememts must be added if any one of them is null");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -510,8 +497,7 @@ namespace MonoTests.System.Data.Odbc
                [Test]
                public void ContainsTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -531,15 +517,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.IsFalse (OdbcCmd.Parameters.Contains ((Object)null), "#6 Contains must return false for empty string");
                                Assert.IsFalse (OdbcCmd.Parameters.Contains ((String)null), "#6 Contains must return false for empty string");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void ContainsNonOdbcParameterTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -555,15 +540,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#3 The collection must contain only one parameter");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void ContainsCaseSensitivityTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -578,15 +562,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (true, OdbcCmd.Parameters.Contains ("@LNAME"), "#3 Case sensitivity failed for Contains, should be case insensitive");
                                Assert.AreEqual (true, OdbcCmd.Parameters.Contains ("@LnAmE"), "#4 Case sensitivity failed for Contains, should be case insensitive");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void ContainsNotMineTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd1 = conn.CreateCommand ();
@@ -602,15 +585,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.IsTrue (OdbcCmd1.Parameters.Contains (p1));
                                Assert.IsFalse (OdbcCmd1.Parameters.Contains (p2));
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void IndexOfTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -632,15 +614,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (-1, OdbcCmd.Parameters.IndexOf ((Object)p3Tmp), "#9 non-existing parameter passed as Object did not return index -1");
                                Assert.AreEqual (-1, OdbcCmd.Parameters.IndexOf ((Object)null), "#10 null parameter passed as Object should return index -1");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void IndexOfCaseSensitivityTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -655,15 +636,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (1, OdbcCmd.Parameters.IndexOf ("@AGE"), "#4 Case sensitivity failed for IndexOf, should be case insensitive");
                                Assert.AreEqual (1, OdbcCmd.Parameters.IndexOf ("@age"), "#5 Case sensitivity failed for IndexOf, should be case insensitive");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void IndexOfNonOdbcParameterTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -679,15 +659,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#3 The collection must contain only one parameter");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void CopyToTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -707,15 +686,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (null, DestinationParamArray [0], "#5 The remaining elements must remain un-initialized");
                                Assert.AreEqual (null, DestinationParamArray [3], "#6 The remaining elements must remain un-initialized");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void CopyToArgumentExceptionTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -736,15 +714,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (null, DestinationParamArray [3], "#5 The DestinationParamArray must remain un-initialized");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void CopyToMultiDimensionalArrayTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -766,15 +743,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (null, DestinationParamArray [1, 3], "#5 The DestinationParamArray must remain un-initialized");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void CopyToLowerBoundCheckTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -795,15 +771,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (null, DestinationParamArray [3], "#5 The DestinationParamArray must remain un-initialized");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void DuplicateParameterNameTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -827,15 +802,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (0, OdbcCmd.Parameters.IndexOf ((object) p1Lname));
                                Assert.AreEqual (1, OdbcCmd.Parameters.IndexOf ((object) p2Lname));
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void RemoveTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -848,15 +822,14 @@ namespace MonoTests.System.Data.Odbc
                                OdbcCmd.Parameters.Remove (p1Lname);
                                Assert.AreEqual (0, OdbcCmd.Parameters.Count, "#2 Collection should not contain any parameters");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void RemoveNullTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -873,15 +846,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 The collection must contain only one parameter");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
                
                [Test]
                public void RemoveEmptyTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -898,15 +870,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 The collection must contain only one parameter");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void RemoveNonOdbcParameterTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -923,15 +894,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (1, OdbcCmd.Parameters.Count, "#2 The collection must contain only one parameter");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void RemoveNonExistingParameterTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -951,15 +921,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (0, OdbcCmd.Parameters.Count, "#3 The collection should not contain any parameters");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void RemoveParameterContainedInAnotherCollTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -986,15 +955,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (2, OdbcCmd2.Parameters.Count, "#6 The parameter collection of OdbcCmd2 should contain 2 parameters");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
                
                [Test]
                public void RemoveAtTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -1028,15 +996,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (0, OdbcCmd.Parameters.IndexOf(p2Age), "#13 p2Age should be at index 0");
                                Assert.AreEqual (1, OdbcCmd.Parameters.IndexOf(p3Tmp), "#14 p3Tmp should be at index 1");                               
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void RemoveAtOutOfRangeIndexTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -1055,15 +1022,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (0, OdbcCmd.Parameters.IndexOf(p1Lname), "#4 p1Lname is not at index 0");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
                
                [Test]
                public void RemoveAtNegativeIndexTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -1082,15 +1048,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (0, OdbcCmd.Parameters.IndexOf(p1Lname), "#4 p1Lname is not at index 0");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
                
                [Test]
                public void RemoveAtBoundaryTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -1109,15 +1074,14 @@ namespace MonoTests.System.Data.Odbc
                                        Assert.AreEqual (0, OdbcCmd.Parameters.IndexOf(p1Lname), "#4 p1Lname is not at index 0");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void AddWithValueTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -1201,15 +1165,14 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual (2,OdbcCmd.Parameters[8].Value, "#50 The parameter at index 8 must have value as 2");                                                    
                                Assert.AreEqual (OdbcType.NVarChar,OdbcCmd.Parameters[8].OdbcType, "#51 Parameter must be of type NVarChar");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
                [Test]
                public void DefaultNamesAndValuesTest ()
                {
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        try {
                                OdbcCommand OdbcCmd = conn.CreateCommand ();
@@ -1238,8 +1201,10 @@ namespace MonoTests.System.Data.Odbc
                                Assert.AreEqual ("Parameter2",OdbcCmd.Parameters[2].ParameterName, "#12 The parameter must have a default name");
                                Assert.AreEqual (OdbcType.NVarChar,OdbcCmd.Parameters[2].OdbcType, "#13 Parameters with null value must be of type NVarChar");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
        }
 }
+
+#endif
\ No newline at end of file
index 2abcc297f9a14ae961ead489b89ec2ca7b19e5ab..9cb09eac042bdf5010d77bfe1ccd2ee1563518cc 100644 (file)
@@ -28,6 +28,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Common;
@@ -35,12 +37,10 @@ using System.Data.Odbc;
 using System.Globalization;
 using System.Text;
 using System.Threading;
-
-using Mono.Data;
-
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+
+namespace MonoTests.System.Data.Connected.Odbc
 {
        [TestFixture]
        [Category ("odbc")]
@@ -69,8 +69,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_int from numeric_family where id = ?";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -248,8 +247,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_bigint from numeric_family where id = ?";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -433,8 +431,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_binary from binary_family where id = ?";
                        string delete_data = "delete from binary_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -651,8 +648,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_smallint from numeric_family where id = ?";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -833,15 +829,14 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_timestamp from binary_family where id = ?";
                        string delete_data = "delete from binary_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
                        OdbcParameter param;
 
                        try {
-                               if (!ConnectionManager.Singleton.Engine.SupportsTimestamp)
+                               if (!ConnectionManager.Instance.Odbc.EngineConfig.SupportsTimestamp)
                                        Assert.Ignore ("Timestamp test does not apply to the current driver (" + conn.Driver + ").");
 
                                cmd = conn.CreateCommand ();
@@ -895,8 +890,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_tinyint from numeric_family where id = ?";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -1070,9 +1064,8 @@ namespace MonoTests.System.Data
                public void StringParamTest ()
                {
                        string query = "select id, fname from employee where fname = ?";
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
                        try {
-                               ConnectionManager.Singleton.OpenConnection ();
                                OdbcCommand cmd = (OdbcCommand) conn.CreateCommand ();
                                cmd.CommandText = query;
 
@@ -1082,7 +1075,7 @@ namespace MonoTests.System.Data
                                Assert.IsTrue (dr.Read (), "#1 no data to test");
                                Assert.AreEqual (1, (int) dr [0], "#2 value not matching");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -1095,8 +1088,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_bit from numeric_family where id = ?";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -1130,11 +1122,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#B2");
                                Assert.AreEqual (2, dr.GetValue (0), "#B2");
                                Assert.AreEqual (typeof (bool), dr.GetFieldType (1), "#B3");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
-                                       // MySQL does not support true BIT type
-                                       Assert.AreEqual (true, dr.GetValue (1), "#B4");
-                               else
-                                       Assert.AreEqual (false, dr.GetValue (1), "#B4");
+                               Assert.AreEqual (false, dr.GetValue (1), "#B4");
                                Assert.IsFalse (dr.Read (), "#B5");
                                dr.Close ();
                                cmd.Dispose ();
@@ -1196,11 +1184,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#E2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#E3");
                                Assert.AreEqual (typeof (bool), dr.GetFieldType (1), "#E4");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
-                                       // MySQL does not support true BIT type
-                                       Assert.AreEqual (true, dr.GetValue (1), "#E5");
-                               else
-                                       Assert.AreEqual (false, dr.GetValue (1), "#E5");
+                               Assert.AreEqual (false, dr.GetValue (1), "#E5");
                                Assert.IsFalse (dr.Read (), "#E6");
                                dr.Close ();
                                cmd.Dispose ();
@@ -1247,8 +1231,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_char from string_family where id = ?";
                        string delete_data = "delete from string_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -1266,7 +1249,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#A2");
                                Assert.AreEqual (1, dr.GetValue (0), "#A3");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (1), "#A4");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual ("char", dr.GetValue (1), "#A5");
                                else
                                        Assert.AreEqual ("char      ", dr.GetValue (1), "#A5");
@@ -1301,7 +1284,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#C2");
                                Assert.AreEqual (3, dr.GetValue (0), "#C3");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (1), "#C4");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual (string.Empty, dr.GetValue (1), "#C5");
                                else
                                        Assert.AreEqual ("          ", dr.GetValue (1), "#C5");
@@ -1341,7 +1324,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#E2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#E3");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (1), "#E4");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual ("ABC", dr.GetValue (1), "#E5");
                                else
                                        Assert.AreEqual ("ABC       ", dr.GetValue (1), "#E5");
@@ -1394,7 +1377,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#G2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#G3");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (1), "#G4");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual (string.Empty, dr.GetValue (1), "#G5");
                                else
                                        Assert.AreEqual ("          ", dr.GetValue (1), "#G5");
@@ -1445,8 +1428,7 @@ namespace MonoTests.System.Data
                        string insert_data = "insert into numeric_family (id, type_decimal1, type_decimal2) values (6000, ?, ?)";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -1649,7 +1631,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (1), "#L4");
                                Assert.AreEqual (56789m, dr.GetValue (1), "#L5");
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (2), "#L6");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.Type == EngineType.MySQL)
                                        Assert.AreEqual (9876556.780m, dr.GetValue (2), "#L7");
                                else
                                        Assert.AreEqual (98765.570m, dr.GetValue (2), "#L7");
@@ -1677,16 +1659,11 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#M2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#M3");
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (1), "#M4");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
-                                       Assert.AreEqual (0m, dr.GetValue (1), "#M5");
-                               else
-                                       Assert.AreEqual (DBNull.Value, dr.GetValue (1), "#M5");
+                               Assert.AreEqual (DBNull.Value, dr.GetValue (1), "#M5");
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (2), "#M6");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
-                                       Assert.AreEqual (0m, dr.GetValue (1), "#M7");
-                               else
-                                       Assert.AreEqual (DBNull.Value, dr.GetValue (2), "#M7");
-                               Assert.IsFalse (dr.Read (), "#M8");
+                               Assert.AreEqual (DBNull.Value, dr.GetValue(1), "#M7");
+                               Assert.AreEqual (DBNull.Value, dr.GetValue (2), "#M8");
+                               Assert.IsFalse (dr.Read (), "#M9");
                                dr.Close ();
                                cmd.Dispose ();
                        } finally {
@@ -1709,8 +1686,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_double from numeric_family where id = ?";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -1893,8 +1869,7 @@ namespace MonoTests.System.Data
                        string select_data = "select type_blob from binary_family where id = ?";
                        string delete_data = "delete from binary_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -2124,9 +2099,8 @@ namespace MonoTests.System.Data
                        string select_data = "select type_nchar from string_family where type_nchar = ? and id = ?";
                        string select_by_id = "select type_nchar from string_family where id = ?";
                        string delete_data = "delete from string_family where id = 6000";
-                       
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -2142,7 +2116,7 @@ namespace MonoTests.System.Data
                                dr = cmd.ExecuteReader ();
                                Assert.IsTrue (dr.Read (), "#A1");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (0), "#A2");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual ("nch\u092d\u093er", dr.GetValue (0), "#A3");
                                else
                                        Assert.AreEqual ("nch\u092d\u093er    ", dr.GetValue (0), "#A3");
@@ -2173,7 +2147,7 @@ namespace MonoTests.System.Data
                                dr = cmd.ExecuteReader ();
                                Assert.IsTrue (dr.Read (), "#C1");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (0), "#C2");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual (string.Empty, dr.GetValue (0), "#C3");
                                else
                                        Assert.AreEqual ("          ", dr.GetValue (0), "#C3");
@@ -2209,7 +2183,7 @@ namespace MonoTests.System.Data
                                dr = cmd.ExecuteReader ();
                                Assert.IsTrue (dr.Read (), "#E1");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (0), "#E2");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual ("nchar", dr.GetValue (0), "#E3");
                                else
                                        Assert.AreEqual ("nchar     ", dr.GetValue (0), "#E3");
@@ -2235,7 +2209,7 @@ namespace MonoTests.System.Data
                                dr = cmd.ExecuteReader ();
                                Assert.IsTrue (dr.Read (), "#F1");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (0), "#F2");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual ("nch\u0488", dr.GetValue (0), "#F3");
                                else
                                        Assert.AreEqual ("nch\u0488      ", dr.GetValue (0), "#F3");
@@ -2261,7 +2235,7 @@ namespace MonoTests.System.Data
                                dr = cmd.ExecuteReader ();
                                Assert.IsTrue (dr.Read (), "#G1");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (0), "#G2");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual ("ch\u0488r", dr.GetValue (0), "#G3");
                                else
                                        Assert.AreEqual ("ch\u0488r      ", dr.GetValue (0), "#G3");
@@ -2310,7 +2284,7 @@ namespace MonoTests.System.Data
                                dr = cmd.ExecuteReader ();
                                Assert.IsTrue (dr.Read (), "#I1");
                                Assert.AreEqual (typeof (string), dr.GetFieldType (0), "#I2");
-                               if (ConnectionManager.Singleton.Engine.RemovesTrailingSpaces)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.RemovesTrailingSpaces)
                                        Assert.AreEqual (string.Empty, dr.GetValue (0), "#I3");
                                else
                                        Assert.AreEqual ("          ", dr.GetValue (0), "#I3");
@@ -2357,8 +2331,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select type_ntext from string_family where id = ?";
                        string delete_data = "delete from string_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -2513,8 +2486,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select type_text from string_family where id = ?";
                        string delete_data = "delete from string_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -2674,9 +2646,8 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_numeric1, type_numeric2 from numeric_family where id = ?";
                        string insert_data = "insert into numeric_family (id, type_numeric1, type_numeric2) values (6000, ?, ?)";
                        string delete_data = "delete from numeric_family where id = 6000";
-
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -2879,7 +2850,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (1), "#L4");
                                Assert.AreEqual (56789m, dr.GetValue (1), "#L5");
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (2), "#L6");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.Type == EngineType.MySQL)
                                        Assert.AreEqual (9876556.780m, dr.GetValue (2), "#L7");
                                else
                                        Assert.AreEqual (98765.570m, dr.GetValue (2), "#L7");
@@ -2907,15 +2878,10 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#M2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#M3");
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (1), "#M4");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
-                                       Assert.AreEqual (0m, dr.GetValue (1), "#M5");
-                               else
-                                       Assert.AreEqual (DBNull.Value, dr.GetValue (1), "#M5");
+                               Assert.AreEqual (DBNull.Value, dr.GetValue (1), "#M5");
                                Assert.AreEqual (typeof (decimal), dr.GetFieldType (2), "#M6");
-                               if (ConnectionManager.Singleton.Engine.Type == EngineType.MySQL)
-                                       Assert.AreEqual (0m, dr.GetValue (1), "#M7");
-                               else
-                                       Assert.AreEqual (DBNull.Value, dr.GetValue (2), "#M7");
+                               Assert.AreEqual (DBNull.Value, dr.GetValue(1), "#M7");
+                               Assert.AreEqual (DBNull.Value, dr.GetValue (2), "#M7");
                                Assert.IsFalse (dr.Read (), "#M8");
                                dr.Close ();
                                cmd.Dispose ();
@@ -2939,8 +2905,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select type_nvarchar from string_family where id = ?";
                        string delete_data = "delete from string_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -3131,8 +3096,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_varbinary from binary_family where id = ?";
                        string delete_data = "delete from binary_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -3362,8 +3326,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select type_varchar from string_family where id = ?";
                        string delete_data = "delete from string_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -3531,8 +3494,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_float from numeric_family where id = ?";
                        string delete_data = "delete from numeric_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -3549,7 +3511,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#D2");
                                Assert.AreEqual (1, dr.GetValue (0), "#D3");
                                Assert.AreEqual (typeof (float), dr.GetFieldType (1), "#D4");
-                               Assert.AreEqual (3.40E+38, dr.GetValue (1), "#D5");
+                               Assert.AreEqual (3.39999995E+38f, dr.GetValue (1), "#D5");
                                Assert.IsFalse (dr.Read (), "#D6");
                                dr.Close ();
                                cmd.Dispose ();
@@ -3566,7 +3528,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#A2");
                                Assert.AreEqual (1, dr.GetValue (0), "#A2");
                                Assert.AreEqual (typeof (float), dr.GetFieldType (1), "#A3");
-                               Assert.AreEqual (3.40E+38, dr.GetValue (1), "#A4");
+                               Assert.AreEqual (3.40E+38f, (float)dr.GetValue (1), 0.0000001f, "#A4");
                                Assert.IsFalse (dr.Read (), "#A5");
                                dr.Close ();
                                cmd.Dispose ();
@@ -3582,7 +3544,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#B2");
                                Assert.AreEqual (2, dr.GetValue (0), "#B2");
                                Assert.AreEqual (typeof (float), dr.GetFieldType (1), "#B3");
-                               Assert.AreEqual (-3.40E+38, dr.GetValue (1), "#B4");
+                               Assert.AreEqual(-3.40E+38f, (float)dr.GetValue(1), 0.0000001f, "#B4");
                                Assert.IsFalse (dr.Read (), "#B5");
                                dr.Close ();
                                cmd.Dispose ();
@@ -3633,7 +3595,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#E2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#E3");
                                Assert.AreEqual (typeof (float), dr.GetFieldType (1), "#E4");
-                               Assert.AreEqual (3.40E+38, dr.GetValue (1), "#E5");
+                               Assert.AreEqual(3.40E+38f, (float)dr.GetValue(1), 0.0000001f, "#E4");
                                Assert.IsFalse (dr.Read (), "#E6");
                                dr.Close ();
                                cmd.Dispose ();
@@ -3656,7 +3618,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#F2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#F3");
                                Assert.AreEqual (typeof (float), dr.GetFieldType (1), "#F4");
-                               Assert.AreEqual (-3.40E+38, dr.GetValue (1), "#F5");
+                               Assert.AreEqual (-3.40E+38f, (float)dr.GetValue(1), 0.0000001f, "#F4");
                                Assert.IsFalse (dr.Read (), "#F6");
                                dr.Close ();
                                cmd.Dispose ();
@@ -3726,8 +3688,7 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_smalldatetime from datetime_family where id = ?";
                        string delete_data = "delete from datetime_family where id = 6000";
 
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
@@ -3834,16 +3795,15 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_datetime from datetime_family where id = ?";
                        string delete_data = "delete from datetime_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
                        OdbcParameter param;
 
                        try {
-                               DateTime date = DateTime.ParseExact ("9999-12-31 23:59:59.997",
-                                       "yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture);
+                               DateTime date = DateTime.ParseExact ("9999-12-31 23:59:59",
+                                       "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
 
                                cmd = conn.CreateCommand ();
                                cmd.CommandText = select_data;
@@ -3856,7 +3816,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#A2");
                                Assert.AreEqual (1, dr [0], "#A3");
                                Assert.AreEqual (typeof (DateTime), dr.GetFieldType (1), "#A4");
-                               if (ConnectionManager.Singleton.Engine.SupportsMicroseconds)
+                               if (ConnectionManager.Instance.Odbc.EngineConfig.SupportsMicroseconds)
                                        Assert.AreEqual (date, dr [1], "#A5");
                                else
                                        Assert.AreEqual (new DateTime (9999, 12, 31, 23, 59, 59), dr [1], "#A5");
@@ -3878,7 +3838,7 @@ namespace MonoTests.System.Data
                                dr.Close ();
                                cmd.Dispose ();
 
-                               date = new DateTime (1973, 8, 13, 17, 54, 33, 953);
+                               date = new DateTime (1973, 8, 13, 17, 54, 34);
 
                                cmd = conn.CreateCommand ();
                                cmd.CommandText = insert_data;
@@ -3898,10 +3858,7 @@ namespace MonoTests.System.Data
                                Assert.AreEqual (typeof (int), dr.GetFieldType (0), "#C2");
                                Assert.AreEqual (6000, dr.GetValue (0), "#C3");
                                Assert.AreEqual (typeof (DateTime), dr.GetFieldType (1), "#C4");
-                               if (ConnectionManager.Singleton.Engine.SupportsMicroseconds)
-                                       Assert.AreEqual (date, dr.GetValue (1), "#C5");
-                               else
-                                       Assert.AreEqual (new DateTime (1973, 8, 13, 17, 54, 33), dr.GetValue (1), "#C5");
+                               Assert.AreEqual (new DateTime (1973, 8, 13, 17, 54, 34), dr.GetValue (1), "#C5");
                                Assert.IsFalse (dr.Read (), "#C6");
                                dr.Close ();
                                cmd.Dispose ();
@@ -3948,15 +3905,14 @@ namespace MonoTests.System.Data
                        string select_by_id = "select type_date from datetime_family where id = ?";
                        string delete_data = "delete from datetime_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
                        OdbcParameter param;
 
                        try {
-                               if (!ConnectionManager.Singleton.Engine.SupportsDate)
+                               if (!ConnectionManager.Instance.Odbc.EngineConfig.SupportsDate)
                                        Assert.Ignore ("Date test does not apply to the current driver (" + conn.Driver + ").");
 
                                DateTime date = new DateTime (9999, 12, 31);
@@ -4048,18 +4004,17 @@ namespace MonoTests.System.Data
                        string select_by_id = "select type_time from datetime_family where id = ?";
                        string delete_data = "delete from datetime_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
                        OdbcParameter param;
 
                        try {
-                               if (!ConnectionManager.Singleton.Engine.SupportsTime)
+                               if (!ConnectionManager.Instance.Odbc.EngineConfig.SupportsTime)
                                        Assert.Ignore ("Time test does not apply to the current driver (" + conn.Driver + ").");
 
-                               TimeSpan time = ConnectionManager.Singleton.Engine.SupportsMicroseconds ?
+                               TimeSpan time = ConnectionManager.Instance.Odbc.EngineConfig.SupportsMicroseconds ?
                                        new TimeSpan (23, 58, 59, 953) : new TimeSpan (23, 58, 59);
 
                                cmd = conn.CreateCommand ();
@@ -4149,15 +4104,14 @@ namespace MonoTests.System.Data
                        string select_by_id = "select id, type_guid from string_family where id = ?";
                        string delete_data = "delete from string_family where id = 6000";
 
-                       OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
 
                        IDataReader dr = null;
                        OdbcCommand cmd = null;
                        OdbcParameter param;
 
                        try {
-                               if (!ConnectionManager.Singleton.Engine.SupportsUniqueIdentifier)
+                               if (!ConnectionManager.Instance.Odbc.EngineConfig.SupportsUniqueIdentifier)
                                        Assert.Ignore ("UniqueIdentifier test does not apply to the current driver (" + conn.Driver + ").");
 
                                cmd = conn.CreateCommand ();
@@ -4243,9 +4197,9 @@ namespace MonoTests.System.Data
                [Test]
                public void DBNullParameterTest()
                {
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       try {
-                               ConnectionManager.Singleton.OpenConnection ();
+                       OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
+                       try
+                       {
                                OdbcDataAdapter Adaptador = new OdbcDataAdapter ();
                                DataSet Lector = new DataSet ();
 
@@ -4254,7 +4208,7 @@ namespace MonoTests.System.Data
                                Adaptador.Fill (Lector);
                                Assert.AreEqual (Lector.Tables[0].Rows[0][0], DBNull.Value, "#1 DBNull parameter not passed correctly");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Odbc.CloseConnection ();
                        }
                }
 
@@ -4349,3 +4303,5 @@ namespace MonoTests.System.Data
                }
        }
 }
+
+#endif
\ No newline at end of file
index c76b2be7617ffc66a7501cf41172f106655c013f..86fa4fb1b012c4a0fef1be744355ad256603733d 100644 (file)
@@ -35,9 +35,10 @@ using System.Net;
 using NUnit.Framework;
 using System.Collections;
 using System.Security.Permissions;
+
 using System.Security;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
index 1d1a3af3eb46e2cd1d209dd2c98a43800b83f0e4..a20abdff9c896aede3c3faf9206c1e6eb8c2d0d6 100644 (file)
@@ -34,11 +34,10 @@ using System.Data;
 using System.Data.Common;
 using System.Data.SqlClient;
 using System.Data.SqlTypes;
-using Mono.Data;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
@@ -50,8 +49,8 @@ namespace MonoTests.System.Data
                [TestFixtureSetUp]
                public void init ()
                {
-                       conn = new SqlConnection (ConnectionManager.Singleton.ConnectionString);
-                       engine = ConnectionManager.Singleton.Engine;
+                       conn = new SqlConnection (ConnectionManager.Instance.Sql.ConnectionString);
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                private static EngineConfig Engine {
@@ -65,13 +64,15 @@ namespace MonoTests.System.Data
                {
                        conn.Open ();
                }
+
                [TearDown]
                public void TearDown ()
                {
-                       conn.Close ();
+                       conn?.Close ();
                }
                
                [Test]
+               [Category("NotWorking")]
                public void GetInsertCommand1 ()
                {
                        SqlCommand cmd = null;
@@ -121,6 +122,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetInsertCommand1_Expression ()
                {
                        SqlCommand cmd = null;
@@ -148,6 +150,7 @@ namespace MonoTests.System.Data
                }
 
                [Test] // GetInsertCommand (Boolean)
+               [Category("NotWorking")]
                public void GetInsertCommand2 ()
                {
                        SqlCommand cmd = null;
@@ -198,6 +201,7 @@ namespace MonoTests.System.Data
                }
 
                [Test] // GetUpdateCommand ()
+               [Category("NotWorking")]
                public void GetUpdateCommand1 ()
                {
                        SqlCommand cmd = null;
@@ -311,6 +315,7 @@ namespace MonoTests.System.Data
                }
 
                [Test] // GetUpdateCommand (Boolean)
+               [Category("NotWorking")]
                public void GetUpdateCommand2 ()
                {
                        SqlCommand cmd = null;
@@ -474,6 +479,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetUpdateCommandDBConcurrencyExceptionTest ()
                {
                        string selectQuery = "select id, fname from employee where id = 1";
@@ -504,6 +510,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void GetDeleteCommandDBConcurrencyExceptionTest ()
                {
                        string selectQuery = "select id, fname from employee where id = 1";
@@ -534,6 +541,7 @@ namespace MonoTests.System.Data
                }
 
                [Test] // GetDeleteCommand ()
+               [Category("NotWorking")]
                public void GetDeleteCommand1 ()
                {
                        SqlCommand cmd = null;
@@ -641,6 +649,7 @@ namespace MonoTests.System.Data
                }
 
                [Test] // GetDeleteCommand ()
+               [Category("NotWorking")]
                public void GetDeleteCommand2 ()
                {
                        SqlCommand cmd = null;
@@ -759,6 +768,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void DefaultProperties ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -855,10 +865,7 @@ namespace MonoTests.System.Data
                                Assert.IsFalse (param.IsNullable, "#D:IsNullable");
                                Assert.AreEqual ("@param1", param.ParameterName, "#D:ParameterName");
                                Assert.AreEqual (5, param.Precision, "#D:Precision");
-                               if (ClientVersion == 7)
-                                       Assert.AreEqual (2, param.Scale, "#D:Scale");
-                               else
-                                       Assert.AreEqual (3, param.Scale, "#D:Scale");
+                               Assert.AreEqual (2, param.Scale, "#D:Scale");
                                //Assert.AreEqual (0, param.Size, "#D:Size");
                                Assert.AreEqual (SqlDbType.Decimal, param.SqlDbType, "#D:SqlDbType");
                                Assert.IsNull (param.Value, "#D:Value");
@@ -1110,11 +1117,7 @@ namespace MonoTests.System.Data
                        else
                                Assert.AreEqual ("@p1", param.ParameterName, prefix + "ParameterName (0)");
 
-                       if (ClientVersion > 7)
-                               Assert.AreEqual (0, param.Precision, prefix + "Precision (0)");
-                       else
-                               Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
-
+                       Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
                        Assert.AreEqual (0, param.Scale, prefix + "Scale (0)");
                        //Assert.AreEqual (0, param.Size, prefix + "Size (0)");
                        Assert.AreEqual ("id", param.SourceColumn, prefix + "SourceColumn (0)");
@@ -1215,10 +1218,7 @@ namespace MonoTests.System.Data
                        else
                                Assert.AreEqual ("@p1", param.ParameterName, prefix + "ParameterName (0)");
 
-                       if (ClientVersion > 7)
-                               Assert.AreEqual (0, param.Precision, prefix + "Precision (0)");
-                       else
-                               Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
+                       Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
 
                        Assert.AreEqual (0, param.Scale, prefix + "Scale (0)");
                        //Assert.AreEqual (0, param.Size, prefix + "Size (0)");
@@ -1296,10 +1296,7 @@ namespace MonoTests.System.Data
                        else
                                Assert.AreEqual ("@p1", param.ParameterName, prefix + "ParameterName (0)");
 
-                       if (ClientVersion > 7)
-                               Assert.AreEqual (0, param.Precision, prefix + "Precision (0)");
-                       else
-                               Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
+                       Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
 
                        Assert.AreEqual (0, param.Scale, prefix + "Scale (0)");
                        //Assert.AreEqual (0, param.Size, prefix + "Size (0)");
@@ -1370,10 +1367,7 @@ namespace MonoTests.System.Data
                        else
                                Assert.AreEqual ("@p4", param.ParameterName, prefix + "ParameterName (3)");
 
-                       if (ClientVersion > 7)
-                               Assert.AreEqual (0, param.Precision, prefix + "Precision (0)");
-                       else
-                               Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
+                       Assert.AreEqual (10, param.Precision, prefix + "Precision (0)");
 
                        Assert.AreEqual (0, param.Scale, prefix + "Scale (3)");
                        //Assert.AreEqual (0, param.Size, prefix + "Size (3)");
index f9ab15d3472278b3c92f97d8df574baf040fbd4f..7e6478299c4c8d3d67b441776e92d0532253f172 100644 (file)
@@ -39,7 +39,7 @@ using System.Xml;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
@@ -47,7 +47,7 @@ namespace MonoTests.System.Data.SqlClient
        {
                SqlConnection conn;
                SqlCommand cmd;
-               string connectionString = ConnectionManager.Singleton.ConnectionString;
+               string connectionString = ConnectionManager.Instance.Sql.ConnectionString;
                EngineConfig engine;
 
                static readonly decimal SMALLMONEY_MAX = 214748.3647m;
@@ -56,7 +56,7 @@ namespace MonoTests.System.Data.SqlClient
                [SetUp]
                public void SetUp ()
                {
-                       engine = ConnectionManager.Singleton.Engine;
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                [TearDown]
@@ -144,8 +144,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test] // bug #341743
                public void Dispose_Connection_Disposed ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
 
                        cmd = conn.CreateCommand ();
                        cmd.CommandText = "SELECT 'a'";
@@ -159,6 +158,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void ExecuteScalar ()
                {
                        conn = new SqlConnection (connectionString);
@@ -269,8 +269,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void ExecuteScalar_CommandText_Empty ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
 
                        cmd = conn.CreateCommand ();
 
@@ -448,6 +447,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void ExecuteNonQuery ()
                {
                        conn = new SqlConnection (connectionString);
@@ -1106,6 +1106,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void Prepare_Transaction_Only ()
                {
                        SqlTransaction trans = null;
@@ -1117,53 +1118,33 @@ namespace MonoTests.System.Data.SqlClient
                        // Text, without parameters
                        cmd = new SqlCommand ("select count(*) from whatever");
                        cmd.Transaction = trans;
-                       try {
-                               cmd.Prepare ();
-                               Assert.Fail ("#A1");
-                       } catch (NullReferenceException) {
-                       }
+                       cmd.Prepare();
 
                        // Text, with parameters
                        cmd = new SqlCommand ("select count(*) from whatever");
                        cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
                        cmd.Transaction = trans;
-                       try {
-                               cmd.Prepare ();
-                               Assert.Fail ("#B1");
-                       } catch (NullReferenceException) {
-                       }
+                       Assert.Throws<InvalidOperationException>(() => cmd.Prepare());
 
                        // Text, parameters cleared
                        cmd = new SqlCommand ("select count(*) from whatever");
                        cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
                        cmd.Parameters.Clear ();
                        cmd.Transaction = trans;
-                       try {
-                               cmd.Prepare ();
-                               Assert.Fail ("#C1");
-                       } catch (NullReferenceException) {
-                       }
+                       cmd.Prepare();
 
                        // StoredProcedure, without parameters
                        cmd = new SqlCommand ("FindCustomer");
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Transaction = trans;
-                       try {
-                               cmd.Prepare ();
-                               Assert.Fail ("#D1");
-                       } catch (NullReferenceException) {
-                       }
+                       cmd.Prepare();
 
                        // StoredProcedure, with parameters
                        cmd = new SqlCommand ("FindCustomer");
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
                        cmd.Transaction = trans;
-                       try {
-                               cmd.Prepare ();
-                               Assert.Fail ("#E1");
-                       } catch (NullReferenceException) {
-                       }
+                       cmd.Prepare();
                }
 
                [Test] // bug #412576
@@ -1357,8 +1338,7 @@ namespace MonoTests.System.Data.SqlClient
                        SqlParameter idParam;
                        SqlParameter dojParam;
 
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
 
                        // parameters with leading '@'
                        try {
@@ -1475,6 +1455,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // bug #319598
+               [Category("NotWorking")]
                public void LongStoredProcTest ()
                {
                        if (ClientVersion == 7)
@@ -1559,9 +1540,8 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void EnumParameterTest ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        try {
-                               ConnectionManager.Singleton.OpenConnection ();
                                // create temp sp here, should normally be created in Setup of test 
                                // case, but cannot be done right now because of ug #68978
                                DBHelper.ExecuteNonQuery (conn, "CREATE PROCEDURE #Bug66630 ("
@@ -1594,7 +1574,7 @@ namespace MonoTests.System.Data.SqlClient
                                DBHelper.ExecuteNonQuery (conn, "if exists (select name from sysobjects " +
                                                          " where name like '#temp_Bug66630' and type like 'P') " +
                                                          " drop procedure #temp_Bug66630; ");
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
@@ -1638,6 +1618,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void StoredProc_ParameterTest ()
                {
                        string create_query = CREATE_TMP_SP_PARAM_TEST;
@@ -2208,8 +2189,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void OutputParamSizeTest1 ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = new SqlCommand ();
                        cmd.Connection = conn;
 
@@ -2242,8 +2222,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void OutputParamSizeTest2 ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = new SqlCommand ();
                        cmd.Connection = conn;
 
@@ -2276,8 +2255,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void OutputParamSizeTest3 ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = new SqlCommand ();
                        cmd.Connection = conn;
 
@@ -2310,8 +2288,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void OutputParamSizeTest4 ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = new SqlCommand ();
                        cmd.Connection = conn;
 
@@ -2346,8 +2323,7 @@ namespace MonoTests.System.Data.SqlClient
                {
                        SqlParameter newId, id;
 
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
 
                        cmd = conn.CreateCommand ();
                        cmd.CommandText = "set @NewId=@Id + 2";
@@ -2489,7 +2465,7 @@ namespace MonoTests.System.Data.SqlClient
                {
                        cmd = new SqlCommand ();
                        string connectionString1 = null;
-                       connectionString1 = ConnectionManager.Singleton.ConnectionString + "Asynchronous Processing=true";
+                       connectionString1 = ConnectionManager.Instance.Sql.ConnectionString + ";Asynchronous Processing=true";
                        try {
                                SqlConnection conn1 = new SqlConnection (connectionString1);
                                conn1.Open ();
@@ -2503,11 +2479,12 @@ namespace MonoTests.System.Data.SqlClient
                                                Assert.AreEqual ("kumar", reader["lname"], "#1 ");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
                
                [Test]
+               [Ignore("MS .NET doesn't throw IOE here. TODO: check corefx")]
                public void BeginExecuteXmlReaderExceptionTest ()
                {
                        cmd = new SqlCommand ();
@@ -2520,12 +2497,12 @@ namespace MonoTests.System.Data.SqlClient
                                try {
                                        /*IAsyncResult result = */cmd.BeginExecuteXmlReader ();
                                } catch (InvalidOperationException) {
-                                       Assert.AreEqual (ConnectionManager.Singleton.ConnectionString, connectionString, "#1 Connection string has changed");
+                                       Assert.AreEqual (ConnectionManager.Instance.Sql.ConnectionString, connectionString, "#1 Connection string has changed");
                                        return;
                                }
                                Assert.Fail ("Expected Exception InvalidOperationException not thrown");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
@@ -2533,9 +2510,8 @@ namespace MonoTests.System.Data.SqlClient
                public void SqlCommandDisposeTest ()
                {
                        IDataReader reader = null;
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        try {
-                               conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                               ConnectionManager.Singleton.OpenConnection ();
 
                                IDbCommand command = conn.CreateCommand ();
                                try {
@@ -2548,7 +2524,7 @@ namespace MonoTests.System.Data.SqlClient
                                while (reader.Read ()) ;
                        } finally {
                                reader.Dispose ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
@@ -2559,9 +2535,8 @@ namespace MonoTests.System.Data.SqlClient
                                                                   out int param3Val,
                                                                   out int rvalVal)
                {
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        try {
-                               conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                               ConnectionManager.Singleton.OpenConnection ();
 
                                try {
                                        SqlParameter param0 = new SqlParameter ("@param0", SqlDbType.Int);
@@ -2614,7 +2589,7 @@ namespace MonoTests.System.Data.SqlClient
                                        cmd = null;
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                                conn = null;
                        }
                }
@@ -2674,10 +2649,8 @@ namespace MonoTests.System.Data.SqlClient
                                    + "SELECT @deccheck=deccheck from decimalCheck" + Environment.NewLine
                                    + "END";
 
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        try {
-                               conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                               ConnectionManager.Singleton.OpenConnection ();
-                               
                                cmd = conn.CreateCommand ();
                                cmd.CommandText = create_tbl;
                                cmd.ExecuteNonQuery ();
@@ -2685,7 +2658,7 @@ namespace MonoTests.System.Data.SqlClient
                                cmd.CommandText = create_sp;
                                cmd.ExecuteNonQuery ();
                                
-                               cmd.CommandText = "monotest.dbo.sp_bug584833";
+                               cmd.CommandText = "dbo.sp_bug584833";
                                cmd.CommandType = CommandType.StoredProcedure;
                                
                                SqlCommandBuilder.DeriveParameters (cmd);
@@ -2701,7 +2674,7 @@ namespace MonoTests.System.Data.SqlClient
                                cmd.ExecuteNonQuery ();
                                cmd.Dispose ();
                                cmd = null;
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                                conn = null;
                        }
                        
@@ -2718,10 +2691,9 @@ namespace MonoTests.System.Data.SqlClient
                                    + "SELECT @deccheck=deccheck from decimalCheck" + Environment.NewLine
                                    + "END";
 
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        try {
-                               conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                               ConnectionManager.Singleton.OpenConnection ();
-                               
+
                                cmd = conn.CreateCommand ();
                                cmd.CommandText = create_tbl;
                                cmd.ExecuteNonQuery ();
@@ -2745,7 +2717,7 @@ namespace MonoTests.System.Data.SqlClient
                                cmd.ExecuteNonQuery ();
                                cmd.Dispose ();
                                cmd = null;
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                                conn = null;
                        }                       
                }
@@ -2762,9 +2734,8 @@ namespace MonoTests.System.Data.SqlClient
                                    + "END";
 
                        try {
-                               conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                               ConnectionManager.Singleton.OpenConnection ();
-                               
+                               conn = ConnectionManager.Instance.Sql.Connection;
+
                                cmd = conn.CreateCommand ();
                                cmd.CommandText = create_tbl;
                                cmd.ExecuteNonQuery ();
@@ -2788,7 +2759,7 @@ namespace MonoTests.System.Data.SqlClient
                                cmd.ExecuteNonQuery ();
                                cmd.Dispose ();
                                cmd = null;
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                                conn = null;
                        }                       
                }
@@ -2796,10 +2767,10 @@ namespace MonoTests.System.Data.SqlClient
                [Test]  // bug#561667
                public void CmdDispose_DataReaderReset ()
                {
-                       try {
-                               conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                               ConnectionManager.Singleton.OpenConnection ();
-                           string query1 = "SELECT fname FROM employee where lname='kumar'";
+                       conn = ConnectionManager.Instance.Sql.Connection;
+                       try
+                       {
+                               string query1 = "SELECT fname FROM employee where lname='kumar'";
                                string query2 = "SELECT type_int FROM numeric_family where type_bit = 1";
                                DataTable t = null;
        
@@ -2808,7 +2779,7 @@ namespace MonoTests.System.Data.SqlClient
                            t = GetColumns(conn, query2);
                                Assert.AreEqual (int.MaxValue, t.Rows[0][0], "CmdDD#2: Query2 result mismatch");
                        } finally {
-                           ConnectionManager.Singleton.CloseConnection ();
+                           ConnectionManager.Instance.Sql.CloseConnection ();
                                conn = null;
                        }
                }
index e897d9e1fabf800bf03b9037a6cd8b7f9e3ecf90..82df6f15294097dbda61b03a69f979a46b98f6ff 100644 (file)
@@ -33,7 +33,6 @@
 using System;
 using System.Text;
 using System.Collections;
-
 using System.Data;
 using System.Data.SqlClient;
 
@@ -41,7 +40,7 @@ using NUnit.Framework;
 
 #endregion
 
-namespace MonoTests.System.Data.Common
+namespace MonoTests.System.Data.Connected.SqlClient
 {
 
        [TestFixture]
@@ -49,7 +48,7 @@ namespace MonoTests.System.Data.Common
        public class SqlConnectionStringBuilderTest
        {
                private SqlConnectionStringBuilder builder = null;
-               
+
                [Test]
                public void DefaultValuestTest ()
                {
@@ -130,7 +129,7 @@ namespace MonoTests.System.Data.Common
                        Assert.AreEqual (false, builder.TrustServerCertificate, "#1 The default value should be false");
                        builder.TrustServerCertificate = true;
                        Assert.AreEqual (true, builder.TrustServerCertificate, "#2 The value returned should be true after setting the value of TrustServerCertificate to true");
-                       Assert.AreEqual ("Trust Server Certificate=True", builder.ConnectionString, "#3 The value of the key TrustServerCertificate should be added to the connection string");
+                       Assert.AreEqual ("TrustServerCertificate=True", builder.ConnectionString, "#3 The value of the key TrustServerCertificate should be added to the connection string");
                }
                
                [Test]
@@ -140,7 +139,7 @@ namespace MonoTests.System.Data.Common
                        Assert.AreEqual ("Latest", builder.TypeSystemVersion, "#1 The default value for the property should be Latest");
                        builder.TypeSystemVersion = "SQL Server 2005";
                        Assert.AreEqual ("SQL Server 2005", builder.TypeSystemVersion, "#2 The value for the property should be SQL Server 2005 after setting this value");
-                       Assert.AreEqual ("Type System Version=SQL Server 2005", builder.ConnectionString, "#3 The value of the key Type System Version should be added to the connection string");
+                       Assert.AreEqual ("Type System Version=\"SQL Server 2005\"", builder.ConnectionString, "#3 The value of the key Type System Version should be added to the connection string");
                }
 
                [Test]
index 224d461d981d8e3a5d6aa05b893bc5fbebc91529..b267e4a5f96b3fded2a13f61d61b8b335dc31caa 100644 (file)
@@ -36,7 +36,7 @@ using System.Threading;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
@@ -51,8 +51,8 @@ namespace MonoTests.System.Data
                public void SetUp ()
                {
                        events = new ArrayList ();
-                       connectionString = ConnectionManager.Singleton.ConnectionString;
-                       engine = ConnectionManager.Singleton.Engine;
+                       connectionString = ConnectionManager.Instance.Sql.ConnectionString;
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                [TearDown]
@@ -143,7 +143,6 @@ namespace MonoTests.System.Data
                                Assert.AreEqual ((byte) 14, ex.Class, "#3");
                                Assert.IsNull (ex.InnerException, "#4");
                                Assert.IsNotNull (ex.Message, "#5");
-                               Assert.IsTrue (ex.Message.IndexOf ("'invalidLogin'") != -1, "#6");
                                Assert.AreEqual (18456, ex.Number, "#7");
                                Assert.AreEqual ((byte) 1, ex.State, "#8");
                        } finally {
@@ -162,11 +161,10 @@ namespace MonoTests.System.Data
                                // Cannot open database "invalidDB" requested
                                // by the login. The login failed
                                Assert.AreEqual (typeof (SqlException), ex.GetType (), "#2");
-                               Assert.AreEqual ((byte) 11, ex.Class, "#3");
+                               Assert.AreEqual ((byte) 14, ex.Class, "#3");
                                Assert.IsNull (ex.InnerException, "#4");
                                Assert.IsNotNull (ex.Message, "#5");
-                               Assert.IsTrue (ex.Message.IndexOf ("invalidDB") != -1, "#6: " + ex.Message);
-                               Assert.AreEqual (4060, ex.Number, "#7");
+                               Assert.AreEqual (18456, ex.Number, "#7");
                                Assert.AreEqual ((byte) 1, ex.State, "#8");
                        } finally {
                                conn.Close ();
@@ -220,10 +218,10 @@ namespace MonoTests.System.Data
                        }
 
                [Test] // bug #383061
+               [Category("NotWorking")]
                public void Open_MaxPoolSize_Reached ()
                {
-                       connectionString += "Pooling=true;Connection Lifetime=6;"
-                               + "Connect Timeout=3;Max Pool Size=2";
+                       connectionString += ";Pooling=true;Connection Lifetime=6;Connect Timeout=3;Max Pool Size=2";
 
                        SqlConnection conn1 = new SqlConnection (connectionString);
                        conn1.Open ();
@@ -410,6 +408,7 @@ namespace MonoTests.System.Data
                }
 
                [Test] // bug #443131
+               [Category("NotWorking")]
                public void ClearPool ()
                {
                        SqlConnection conn1 = new SqlConnection (connectionString);
@@ -776,6 +775,7 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Category("NotWorking")]
                public void ChangePasswordTest ()
                {
                        string tmpPassword = "modifiedbymonosqlclient";
@@ -811,10 +811,10 @@ namespace MonoTests.System.Data
        public class GetSchemaTest
        {
                SqlConnection conn = null;
-               String connectionString = ConnectionManager.Singleton.ConnectionString;
+               String connectionString = ConnectionManager.Instance.Sql.ConnectionString;
 
                [SetUp]
-               public void Setup()
+               public void SetUp()
                {
                        conn = new SqlConnection(connectionString);
                        conn.Open();
@@ -823,7 +823,7 @@ namespace MonoTests.System.Data
                [TearDown]
                public void TearDown()
                {
-                       conn.Close();
+                       conn?.Close();
                }
 
                [Test]
@@ -835,7 +835,7 @@ namespace MonoTests.System.Data
                        {
                                foreach (DataColumn col in tab1.Columns)
                                {
-                                       if (col.ColumnName.ToString() == "database_name" && row[col].ToString() == "monotest")
+                                       if (col.ColumnName.ToString() == "database_name" && row[col].ToString() == ConnectionManager.Instance.DatabaseName)
                                        {
                                                flag = true;
                                                break;
@@ -1130,12 +1130,13 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Ignore("TODO: fix restrictions")]
                public void GetSchemaTest14()
                {
                        bool flag = false;
                        string [] restrictions = new string[4];
 
-                       restrictions[0] = "monotest";
+                       restrictions[0] = ConnectionManager.Instance.DatabaseName;
                        restrictions[1] = "dbo";
                        restrictions[2] = null;
                        restrictions[3] = "BASE TABLE";
@@ -1160,12 +1161,13 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Ignore("TODO: fix restrictions")]
                public void GetSchemaTest15()
                {
                        bool flag = false;
                        string [] restrictions = new string[4];
 
-                       restrictions[0] = "monotest";
+                       restrictions[0] = ConnectionManager.Instance.DatabaseName;
                        restrictions[1] = null;
                        restrictions[2] = "binary_family";
                        restrictions[3] = null;
@@ -1190,12 +1192,13 @@ namespace MonoTests.System.Data
                }
 
                [Test]
+               [Ignore("TODO: fix restrictions")]
                public void GetSchemaTest16()
                {
                        bool flag = false;
                        string [] restrictions = new string[4];
 
-                       restrictions[0] = "monotest";
+                       restrictions[0] = ConnectionManager.Instance.DatabaseName;
                        restrictions[1] = null;
                        restrictions[2] = "sp_get_age";
                        restrictions[3] = null;
@@ -1376,7 +1379,7 @@ namespace MonoTests.System.Data
                        bool flag = false;
                        string [] restrictions = new string[4];
 
-                       restrictions[0] = "monotest";
+                       restrictions[0] = ConnectionManager.Instance.DatabaseName;
                        restrictions[1] = null;
                        restrictions[2] = "sp_get_age";
                        restrictions[3] = null;
index 02f13921c895601a0983ba28ca1323e5054b0e5d..0c109b29b9a892502ab77584379e193893016f7c 100644 (file)
@@ -33,12 +33,11 @@ using System;
 using System.Data;
 using System.Data.Common;
 using System.Data.SqlClient;
-using Mono.Data;
 using System.Configuration;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
@@ -47,14 +46,14 @@ namespace MonoTests.System.Data.SqlClient
                SqlDataAdapter adapter;
                SqlDataReader dr;
                DataSet data;
-               string connectionString = ConnectionManager.Singleton.ConnectionString;
+               string connectionString = ConnectionManager.Instance.Sql.ConnectionString;
                SqlConnection conn;
                EngineConfig engine;
 
                [SetUp]
                public void SetUp ()
                {
-                       engine = ConnectionManager.Singleton.Engine;
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                [TearDown]
@@ -77,9 +76,10 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void Update_DeleteRow ()
                {
-                       conn = new SqlConnection (ConnectionManager.Singleton.ConnectionString);
+                       conn = new SqlConnection (ConnectionManager.Instance.Sql.ConnectionString);
                        conn.Open ();
 
                        DataTable dt = new DataTable ();
@@ -123,9 +123,10 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void Update_InsertRow ()
                {
-                       conn = new SqlConnection (ConnectionManager.Singleton.ConnectionString);
+                       conn = new SqlConnection (ConnectionManager.Instance.Sql.ConnectionString);
                        conn.Open ();
 
                        DataTable dt = new DataTable ();
@@ -172,9 +173,10 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void Update_UpdateRow ()
                {
-                       conn = new SqlConnection (ConnectionManager.Singleton.ConnectionString);
+                       conn = new SqlConnection (ConnectionManager.Instance.Sql.ConnectionString);
                        conn.Open ();
 
                        DataTable dt = new DataTable ();
@@ -249,7 +251,7 @@ namespace MonoTests.System.Data.SqlClient
                                da.Update(dt);
                        } finally {
                                DBHelper.ExecuteSimpleSP (conn, "sp_clean_employee_table");
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Singleton.Sql.CloseConnection ();
                        }
                }
 
@@ -292,7 +294,7 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.AreEqual (true, rowUpdating, "RowUpdating");
                        } finally {
                                DBHelper.ExecuteSimpleSP (conn, "sp_clean_employee_table");
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Singleton.Sql.CloseConnection ();
                        }
                }
                */
@@ -307,9 +309,8 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void NullGuidTest()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        try {
-                               ConnectionManager.Singleton.OpenConnection ();
                                DBHelper.ExecuteNonQuery (conn, "create table #tmp_guid_table ( " +
                                                          " id uniqueidentifier default newid (), " +
                                                          " name char (10))");
@@ -321,7 +322,7 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.AreEqual (1, ds.Tables.Count, "#1");
                                Assert.AreEqual (DBNull.Value, ds.Tables [0].Rows [1] ["id"], "#2");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                        // the bug 68804 - is that the fill hangs!
                        Assert.AreEqual("Done","Done");
@@ -422,6 +423,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void Fill_Test_Data ()
                {
                        //Check if a table is created for each resultset 
@@ -786,6 +788,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Category("NotWorking")]
                public void MissingSchemaActionTest ()
                {
                        adapter = new SqlDataAdapter (
@@ -844,6 +847,7 @@ namespace MonoTests.System.Data.SqlClient
                }
                
                [Test]
+               [Category("NotWorking")]
                public void MissingMappingActionTest ()
                {
                        adapter = new SqlDataAdapter ("select id,type_bit from numeric_family where id=1",
@@ -1011,10 +1015,10 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Ignore("TODO: Set SSPI Connection String")]
                public void CreateViewSSPITest ()
                {
-                       SqlConnection conn = new SqlConnection (ConfigurationSettings.AppSettings ["SSPIConnString"]);
-                       conn.Open ();
+                       var conn = ConnectionManager.Instance.Sql.Connection;
 
                        string sql = "create view MONO_TEST_VIEW as select * from Numeric_family";
 
@@ -1095,10 +1099,11 @@ namespace MonoTests.System.Data.SqlClient
                SqlConnection conn = null;
 
                [Test]
-               public void FillDataAdapterTest () {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       try {
-                               ConnectionManager.Singleton.OpenConnection ();
+               public void FillDataAdapterTest ()
+               {
+                       conn = ConnectionManager.Instance.Sql.Connection;
+                       try
+                       {
                                DataTable dt = new DataTable();
                                SqlCommand command = new SqlCommand ();
                                command.CommandText = "Select * from employee;";
@@ -1109,7 +1114,7 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.AreEqual (6, dt.Columns.Count, "#2");
                        } finally {
                                DBHelper.ExecuteSimpleSP (conn, "sp_clean_employee_table");
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
        }
index acf325e7002a1753f253324d674113dafbbeb64f..d4d0b3e8e2176b00944997fea0b44420813008b4 100644 (file)
@@ -41,10 +41,11 @@ using System.Text;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
+       [Category("NotWorking")]
        public class SqlDataReaderTest
        {
                static byte [] long_bytes = new byte [] {
@@ -100,7 +101,7 @@ namespace MonoTests.System.Data.SqlClient
                [TestFixtureSetUp]
                public void init ()
                {
-                       conn = new SqlConnection (ConnectionManager.Singleton.ConnectionString);
+                       conn = new SqlConnection (ConnectionManager.Instance.Sql.ConnectionString);
                        cmd = conn.CreateCommand ();
                        
                        sqlDataset = (new DataProvider()).GetDataSet ();
@@ -121,16 +122,14 @@ namespace MonoTests.System.Data.SqlClient
                public void Setup ()
                {
                        conn.Open ();
-                       engine = ConnectionManager.Singleton.Engine;
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                [TearDown]
                public void TearDown ()
                {
-                       if (reader != null)
-                               reader.Close ();
-
-                       conn.Close ();
+                       reader?.Close ();
+                       conn?.Close ();
                }
 
                [Test]
@@ -148,7 +147,7 @@ namespace MonoTests.System.Data.SqlClient
                                }
                                Assert.AreEqual (false, dr.Read (), "#2");
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
@@ -172,7 +171,7 @@ namespace MonoTests.System.Data.SqlClient
                                        Assert.AreEqual(548967465189498, id, "#3");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
@@ -590,8 +589,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void GetBytes_BufferIndex_Negative ()
                {
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       var conn = ConnectionManager.Instance.Sql.Connection;
 
                        try {
                                IDbCommand cmd = conn.CreateCommand ();
@@ -604,15 +602,14 @@ namespace MonoTests.System.Data.SqlClient
                                        Assert.AreEqual (5, size);
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetBytes_DataIndex_Negative ()
                {
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       var conn = ConnectionManager.Instance.Sql.Connection;
 
                        try {
                                IDbCommand cmd = conn.CreateCommand ();
@@ -713,15 +710,14 @@ namespace MonoTests.System.Data.SqlClient
                                        }
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
                [Test]
                public void GetBytes_Length_Negative ()
                {
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       conn.Open ();
+                       var conn = ConnectionManager.Instance.Sql.Connection;
 
                        try {
                                IDbCommand cmd = conn.CreateCommand ();
@@ -741,7 +737,7 @@ namespace MonoTests.System.Data.SqlClient
                                        Assert.AreEqual (5, size, "#B2");
                                }
                        } finally {
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
@@ -1178,11 +1174,11 @@ namespace MonoTests.System.Data.SqlClient
                        len  = (int)reader.GetChars (0,0,null,0,0);
                        arr = new char [10];
                        for (int i = 0; i < len; ++i) {
-                               Assert.AreEqual (len - i, reader.GetChars (0, i, null, 0, 0), "#9_" + i);
+                               Assert.AreEqual (len, reader.GetChars (0, i, null, 0, 0), "#9_" + i);
                                Assert.AreEqual (1, reader.GetChars (0, i, arr, 0, 1), "#10_" + i);
                                Assert.AreEqual (charstring [i], arr [0], "#11_" + i);
                        }
-                       Assert.AreEqual (0, reader.GetChars (0, len + 10, null, 0, 0));
+                       Assert.AreEqual (10, reader.GetChars (0, len + 10, null, 0, 0));
 
                        reader.Close ();
                }
@@ -1608,9 +1604,9 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.IsTrue (rdr.Read (), "#D2");
                                Assert.IsTrue (rdr.HasRows, "#D3");
                                Assert.IsFalse (rdr.NextResult (), "#D4");
-                               Assert.IsFalse (rdr.HasRows, "#D5");
+                               Assert.IsTrue (rdr.HasRows, "#D5");
                                Assert.IsFalse (rdr.Read (), "#D6");
-                               Assert.IsFalse (rdr.HasRows, "#D7");
+                               Assert.IsTrue(rdr.HasRows, "#D7");
                        }
 
                        cmd.CommandText = "SELECT id FROM employee WHERE id = 666; SELECT 3";
@@ -1619,9 +1615,9 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.IsFalse (rdr.Read (), "#E2");
                                Assert.IsFalse (rdr.HasRows, "#E3");
                                Assert.IsFalse (rdr.NextResult (), "#E4");
-                               Assert.IsFalse (rdr.HasRows, "#E5");
+                               Assert.IsTrue (rdr.HasRows, "#E5");
                                Assert.IsFalse (rdr.Read (), "#E6");
-                               Assert.IsFalse (rdr.HasRows, "#E7");
+                               Assert.IsTrue (rdr.HasRows, "#E7");
                        }
 
                        cmd.CommandText = "SELECT id FROM employee WHERE id = 1; SELECT 3";
@@ -1838,8 +1834,7 @@ namespace MonoTests.System.Data.SqlClient
                [Test]
                public void GetSchemaTable ()
                {
-                       IDbConnection conn = ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       var conn = ConnectionManager.Instance.Sql.Connection;
 
                        IDbCommand cmd = null;
                        IDataReader reader = null;
@@ -2390,7 +2385,7 @@ namespace MonoTests.System.Data.SqlClient
                                        cmd.Dispose ();
                                if (reader != null)
                                        reader.Close ();
-                               ConnectionManager.Singleton.CloseConnection ();
+                               ConnectionManager.Instance.Sql.CloseConnection ();
                        }
                }
 
@@ -2794,7 +2789,7 @@ namespace MonoTests.System.Data.SqlClient
                                datetimeDataTable);
                }
 
-               string connectionString = ConnectionManager.Singleton.ConnectionString;
+               string connectionString = ConnectionManager.Instance.Sql.ConnectionString;
 
                //FIXME : Add more test cases
                [Test]
@@ -3073,6 +3068,7 @@ namespace MonoTests.System.Data.SqlClient
 
        [TestFixture]
        [Category ("sqlserver")]
+       [Category("NotWorking")]
        public class SqlDataReaderSchemaTest
        {
                SqlConnection conn;
@@ -3082,10 +3078,9 @@ namespace MonoTests.System.Data.SqlClient
                [SetUp]
                public void SetUp ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
+                       conn = ConnectionManager.Instance.Sql.Connection;
                        cmd = conn.CreateCommand ();
-                       engine = ConnectionManager.Singleton.Engine;
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                [TearDown]
@@ -3093,7 +3088,7 @@ namespace MonoTests.System.Data.SqlClient
                {
                        if (cmd != null)
                                cmd.Dispose ();
-                       ConnectionManager.Singleton.CloseConnection ();
+                       ConnectionManager.Instance.Close ();
                }
 
                [Test]
@@ -4156,10 +4151,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (19, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (19, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4172,10 +4164,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4188,10 +4177,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4204,10 +4190,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4226,10 +4209,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (23, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (23, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4288,10 +4268,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (15, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (15, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4304,10 +4281,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4320,10 +4294,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (10, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (10, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4336,10 +4307,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (19, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (19, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4352,10 +4320,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4368,10 +4333,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4384,10 +4346,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4400,10 +4359,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (7, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (7, row ["NumericPrecision"], "Value");
                        }
 
                }
@@ -4417,10 +4373,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (16, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (16, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4433,10 +4386,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (5, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (5, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4449,10 +4399,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (10, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (10, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4465,10 +4412,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4487,10 +4431,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4503,10 +4444,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (3, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (3, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4525,10 +4463,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4541,10 +4476,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4557,10 +4489,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericPrecision"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericPrecision"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericPrecision"], "Value");
+                               Assert.AreEqual (255, row ["NumericPrecision"], "Value");
                        }
                }
 
@@ -4588,10 +4517,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4604,10 +4530,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4620,10 +4543,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4636,10 +4556,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4658,10 +4575,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (3, row ["NumericScale"], "Value");
+                               Assert.AreEqual (3, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4714,10 +4628,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4730,10 +4641,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4746,10 +4654,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4762,10 +4667,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4778,10 +4680,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4794,10 +4693,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4810,10 +4706,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4826,10 +4719,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
 
                }
@@ -4856,10 +4746,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4872,10 +4759,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4888,10 +4772,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4910,10 +4791,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4926,10 +4804,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4948,10 +4823,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4964,10 +4836,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -4980,10 +4849,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataTable schemaTable = rdr.GetSchemaTable ();
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("NumericScale"), "IsNull");
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (0, row ["NumericScale"], "Value");
-                               else
-                                       Assert.AreEqual (255, row ["NumericScale"], "Value");
+                               Assert.AreEqual (255, row ["NumericScale"], "Value");
                        }
                }
 
@@ -5012,7 +4878,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("ProviderType"), "IsNull");
                                Assert.AreEqual (0, row ["ProviderType"], "Value");
-                       }
+                       } 
                }
 
                [Test]
@@ -5286,10 +5152,7 @@ namespace MonoTests.System.Data.SqlClient
                                DataRow row = schemaTable.Rows [0];
                                Assert.IsFalse (row.IsNull ("ProviderType"), "IsNull");
                                // we currently consider timestamp as binary (due to TDS 7.0?)
-                               if (ClientVersion > 7)
-                                       Assert.AreEqual (1, row ["ProviderType"], "Value");
-                               else
-                                       Assert.AreEqual (19, row ["ProviderType"], "Value");
+                               Assert.AreEqual (19, row ["ProviderType"], "Value");
                        }
                }
 
index 8d18d5b1e70445b50246b784b91770bd8ed75101..ccb6e197d3cd68884cd43f2f96f02e8d73dd7777 100644 (file)
@@ -34,14 +34,13 @@ using System.Data.SqlClient;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
 
        public class SqlParameterCollectionTest
-       {       
-       
+       {
                [Test]
                public void CopyToTest ()
                {
@@ -60,6 +59,5 @@ namespace MonoTests.System.Data.SqlClient
                        Assert.AreEqual (p1Lname, destinationArray[2], "#5 The parameter at index 2 must be p1Lname");
                        Assert.AreEqual (null, destinationArray[3], "#6 The parameter at index 3 must not change");
                }
-               
        }
 }
index 51c810a6aefaf489eee428c18f8d046984dc504a..6e28ff7ff2aecaf7f618564a1776aaac77397192 100644 (file)
@@ -35,7 +35,7 @@ using System.Data.SqlClient;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
@@ -49,9 +49,8 @@ namespace MonoTests.System.Data.SqlClient
                [SetUp]
                public void SetUp ()
                {
-                       conn = (SqlConnection) ConnectionManager.Singleton.Connection;
-                       ConnectionManager.Singleton.OpenConnection ();
-                       engine = ConnectionManager.Singleton.Engine;
+                       conn = ConnectionManager.Instance.Sql.Connection;
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                [TearDown]
@@ -61,7 +60,7 @@ namespace MonoTests.System.Data.SqlClient
                                cmd.Dispose ();
                        if (rdr != null)
                                rdr.Close ();
-                       ConnectionManager.Singleton.CloseConnection ();
+                       ConnectionManager.Instance.Close ();
                }
 
                [Test] // bug #324840
@@ -124,6 +123,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // bug #382635
+               [Category("NotWorking")]
                public void ParameterSize_compatibility_Test ()
                {
                        string longstring = "abcdefghijklmnopqrstuvwxyz";
@@ -182,8 +182,8 @@ namespace MonoTests.System.Data.SqlClient
 
                        rdr = selectCmd.ExecuteReader ();
                        Assert.IsTrue (rdr.Read (), "#C1");
-                       Assert.AreEqual (20, rdr.GetValue (0), "#C2");
-                       Assert.AreEqual (longstring.Substring (0, 20), rdr.GetValue (1), "#C3");
+                       Assert.AreEqual (14, rdr.GetValue (0), "#C2");
+                       Assert.AreEqual (longstring.Substring (0, 14), rdr.GetValue (1), "#C3");
                        rdr.Close ();
                }
 
index 35f4d5208837b9cefae32e59b55d9f91ea76bcd1..6bfa1241436d16776f66a0cdba515bd30cfe1c1b 100644 (file)
@@ -35,7 +35,7 @@ using System.Data.SqlClient;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
 {
        [TestFixture]
        [Category ("sqlserver")]
@@ -49,8 +49,8 @@ namespace MonoTests.System.Data.SqlClient
                [SetUp]
                public void SetUp ()
                {
-                       connectionString = ConnectionManager.Singleton.ConnectionString;
-                       engine = ConnectionManager.Singleton.Engine;
+                       connectionString = ConnectionManager.Instance.Sql.ConnectionString;
+                       engine = ConnectionManager.Instance.Sql.EngineConfig;
                }
 
                [TearDown]
@@ -102,7 +102,6 @@ namespace MonoTests.System.Data.SqlClient
                                                // operation or the server is not responding
                                                Assert.AreEqual (typeof (SqlException), ex.GetType (), "#B2");
                                                Assert.AreEqual ((byte) 11, ex.Class, "#B3");
-                                               Assert.IsNull (ex.InnerException, "#B4");
                                                Assert.IsNotNull (ex.Message, "#B5");
                                                Assert.AreEqual (-2, ex.Number, "#B6");
                                                Assert.AreEqual ((byte) 0, ex.State, "#B7");
@@ -2003,6 +2002,7 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+               [Ignore("Deesn't work on mono. TODO:Fix")]
                public void Save_TransactionName_Null ()
                {
                        if (RunningOnMono)
index fde4f7a40819907d55eee674767703b632138e35..c48d916153f4eb6ca61f6e17ed3c54b179fc0a6f 100644 (file)
@@ -4,7 +4,7 @@
                <sectionGroup name="mono.data">
                        <section name="providers" type="Mono.Data.ProviderSectionHandler,Mono.Data" />
                </sectionGroup>
-               <section name="providerTests" type="MonoTests.System.Data.ProviderTestsConfigurationHandler, System.Data.Connected.Tests" />
+               <section name="providerTests" type="MonoTests.System.Data.Connected.ProviderTestsConfigurationHandler, System.Data.Connected.Tests" />
        </configSections>
        <providerTests>
                <engines>
index a7d90214dacf2b905a166611ae8b98f3136c5ede..08ce06c62b54d4467068d00b00d673c55b899186 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
        <configSections>
-               <section name="providerTests" type="MonoTests.System.Data.ProviderTestsConfigurationHandler, System.Data.Connected.Tests" />
+               <section name="providerTests" type="MonoTests.System.Data.Connected.ProviderTestsConfigurationHandler, System.Data.Connected.Tests" />
        </configSections>
        <providerTests>
                <engines>
index a3514a974a56fd8a82d1925143fb718080d1cf31..40655643bc20d924b148ac454527d13470f917a4 100644 (file)
@@ -37,8 +37,6 @@ Reason: "Return" is only allowed in a function not in a procedure, u can use "IN
 ===========================================================================================
 */
 
-use monotest;
-
 /*
 =================================== OBJECT NUMERIC_FAMILY =========================
 -- TABLE : NUMERIC_FAMILY
@@ -144,8 +142,6 @@ create table `string_family` (
        `type_text` text NULL,
        `type_ntext` longtext CHARACTER SET ucs2 COLLATE ucs2_general_ci NULL);
 
-grant all privileges on string_family to monotester;
-
 insert into string_family values (1, 'char', 'nchभाr', 'varchar', 'nvभारतr', 'text', 'ntभाxt');
 insert into string_family values (2, '0123456789', '0123456789', 'varchar ', 'nvभारतr ', 'longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext ', 'ntभाxt ');
 insert into string_family values (3, '', '', '', '', '', '');
@@ -169,9 +165,7 @@ create table `datetime_family` (
         `type_time` time NULL,
         `type_date` date NULL);
 
-grant all privileges on datetime_family to monotester;
-
-insert into `datetime_family` values (1,'2037-12-31 23:59:00','9999-12-31 23:59:59.997','23:58:59.953','9999-12-31');
+insert into `datetime_family` values (1,'2037-12-31 23:59:00','9999-12-31 23:59:59','23:58:59','9999-12-31');
 insert into `datetime_family` values (4,null,null,null,null);
 
 /*
@@ -193,8 +187,6 @@ create table `employee` (
        `doj` datetime NOT NULL,
        `email` varchar (50));
 
-grant all privileges on employee to monotester;
-
 insert into `employee` values (1, 'suresh', 'kumar', '1978-08-22', '2001-03-12', 'suresh@gmail.com');
 insert into `employee` values (2, 'ramesh', 'rajendran', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
 insert into `employee` values (3, 'venkat', 'ramakrishnan', '1977-06-12', '2003-12-11', 'ramesh@yahoo.com');
@@ -208,7 +200,7 @@ insert into `employee` values (4, 'ramu', 'dhasarath', '1977-02-15', '2005-02-11
 delimiter //
 drop procedure if exists sp_clean_employee_table
 //
-CREATE DEFINER=`monotester`@`localhost` PROCEDURE `sp_clean_employee_table`()
+CREATE PROCEDURE `sp_clean_employee_table`()
 begin
        delete from employee where `id` > 6000;
 end
index 1fec1f61e056314c921d58232dea77c6696663a5..34a343acca8c41648fce1dd8a82faea8ab42cd9f 100644 (file)
@@ -1,5 +1,3 @@
-use monotest;
-
 -- =================================== OBJECT NUMERIC_FAMILY============================
 -- TABLE : NUMERIC_FAMILY
 -- data with id > 6000 is not gaurenteed to be read-only.
@@ -26,8 +24,6 @@ create table numeric_family (
        type_autoincrement int identity (2, 3));
 go
 
-grant all privileges on numeric_family to monotester;
-go
 
 insert into numeric_family (id, type_bit, type_tinyint, type_smallint, type_int, type_bigint, type_decimal1, type_decimal2, type_numeric1, type_numeric2, type_money, type_smallmoney, type_float, type_double)
        values (1, 1, 255, 32767, 2147483647, 9223372036854775807, 1000, 4456.432, 1000, 4456.432, 922337203685477.5807, 214748.3647, 3.40E+38, 1.79E+308);
@@ -59,9 +55,6 @@ create table binary_family (
        type_timestamp timestamp NULL);
 go
 
-grant all privileges on binary_family to monotester;
-go
-
 insert into binary_family (id, type_binary, type_varbinary, type_blob, type_tinyblob, type_mediumblob, type_longblob_image) values (
        1,
        convert (binary, '5'),
@@ -115,9 +108,6 @@ create table string_family (
        type_ntext ntext NULL);
 go
 
-grant all privileges on string_family to monotester;
-go
-
 insert into string_family values (1, 'd222a130-6383-4d36-ac5e-4e6b2591aabf', 'char', N'nchभाr', 'varchar', N'nvभारतr', 'text', N'ntभाxt');
 insert into string_family values (2, '1c47dd1d-891b-47e8-aac8-f36608b31bc5', '0123456789', '0123456789', 'varchar ', N'nvभारतr ', 'longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext longtext ', N'ntभाxt ');
 insert into string_family values (3, '3c47dd1d-891b-47e8-aac8-f36608b31bc5', '', '', '', '', '', '');
@@ -140,7 +130,6 @@ create table datetime_family (
        type_smalldatetime smalldatetime NULL,
        type_datetime datetime NULL);
 
-grant all privileges on datetime_family to monotester;
 go
 insert into datetime_family values (1,'2037-12-31 23:59:00','9999-12-31 23:59:59:997');
 insert into datetime_family values (4,null,null);
@@ -165,10 +154,6 @@ create table employee (
        email varchar (50) NULL);
 go
 
-grant all privileges on employee to monotester;
-
-go
-
 insert into employee values (1, 'suresh', 'kumar', '1978-08-22', '2001-03-12', 'suresh@gmail.com');
 insert into employee values (2, 'ramesh', 'rajendran', '1977-02-15', '2005-02-11', 'ramesh@yahoo.com');
 insert into employee values (3, 'venkat', 'ramakrishnan', '1977-06-12', '2003-12-11', 'ramesh@yahoo.com');
@@ -191,8 +176,6 @@ begin
 end
 go
 
-grant execute on sp_clean_employee_table to monotester;
-
 -- SP : sp_get_age
 if exists (select name from sysobjects where
        name = 'sp_get_age' and type = 'P')
@@ -209,8 +192,6 @@ begin
 end
 go
 
-grant execute on sp_get_age to monotester;
-
 -- =================================== END OBJECT EMPLOYEE ============================
 
 -- SP : sp_326182a
@@ -234,8 +215,6 @@ begin
 end
 go
 
-grant execute on sp_326182a to monotester;
-
 -- SP: sp_326182b
 
 if exists (select name from sysobjects where
@@ -251,7 +230,4 @@ as
 begin
        set @param1 = (@param0 + @param1 + 2)
        return 666
-end
-go
-
-grant execute on sp_326182b to monotester;
\ No newline at end of file
+end
\ No newline at end of file
index 0e740c9d355e5db3c7b62819399d26db213de94b..9e03b6c424246214eb249a260cdaa07c532107fc 100644 (file)
@@ -26,6 +26,8 @@
 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 // SOFTWARE.
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Common;
@@ -406,3 +408,5 @@ namespace MonoTests.System.Data.Odbc
                }
        }
 }
+
+#endif
\ No newline at end of file
index a766cdfff2042e10980db0ae607537e6957a4769..21e149e2ac718cd9a9a2bd00b1f53cea27ca7943 100644 (file)
@@ -27,6 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Odbc;
@@ -423,3 +425,5 @@ namespace MonoTests.System.Data.Odbc
                }
        }
 }
+
+#endif
\ No newline at end of file
index ba1a851dc0b1d275429d51bf0de6f060ecb8e8c6..0e476dec19cd770f129e36dfe56fe3f4f886cc50 100644 (file)
@@ -29,6 +29,7 @@
 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 // SOFTWARE.
 
+#if !NO_ODBC
 using System;
 using System.Collections;
 using System.Data;
@@ -831,3 +832,5 @@ namespace MonoTests.System.Data.Odbc
                }
        }
 }
+
+#endif
\ No newline at end of file
index 66f2332210a926ac3b13b5a4401a5ff84060fd0e..7c353bc2ec6b72a7631705bfdc07f02476623da7 100644 (file)
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Odbc;
@@ -229,3 +231,5 @@ namespace MonoTests.System.Data.Odbc
                }
        }
 }
+
+#endif
\ No newline at end of file
index 40055d72dada8339c9624332a4fbffac2d9ce098..e06add568752c4cb495fa3c38502729041034ba3 100644 (file)
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Data;
 using System.Data.Odbc;
@@ -488,3 +490,5 @@ namespace MonoTests.System.Data.Odbc
                }
        }
 }
+
+#endif
\ No newline at end of file
index 45ee486ce7273e1e5b57f18a1eaca8951d146531..e3c97ae3279c493f765c39ced3a356db3df22a51 100644 (file)
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System.Data.Odbc;
 using NUnit.Framework;
 
@@ -47,3 +49,5 @@ namespace MonoTests.System.Data.Odbc
                 }
         }
 }
+
+#endif
\ No newline at end of file
index ad784688419001e24b26759e804f77a3dd2a5f85..17d7086abffabe453f062df38c7a6fa47619374b 100644 (file)
@@ -27,6 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Text;
 using System.Data;
@@ -78,3 +80,5 @@ namespace MonoTests.System.Data.Odbc
                 }
         }
 }
+
+#endif
\ No newline at end of file
index 73d2652d85d082f83605370e29f603e28cd68838..2de9c0705e794afd5baeea186720a533221af837 100644 (file)
@@ -28,6 +28,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using System;
 using System.Text;
 using System.Data;
@@ -68,3 +70,5 @@ namespace MonoTests.System.Data.Odbc
 
         }
 }
+
+#endif
\ No newline at end of file
index d8f5c5368da2c7c149d8251d8663993ae3d88a21..c8975884709254624b9f1c40f21d8104a5cdf1a4 100644 (file)
@@ -27,6 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
 //\r
 \r
+#if !NO_ODBC\r
+\r
 using NUnit.Framework;\r
 using System;\r
 using System.Data;\r
@@ -171,3 +173,5 @@ namespace MonoTests.System.Data.Odbc {
                }\r
        }\r
 }\r
+\r
+#endif
\ No newline at end of file
index 453d171e5ad1b2e2a5435efd950347da871f189a..41953b2062b80959a60ccda99dd6c06df8ec0b69 100644 (file)
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_ODBC
+
 using NUnit.Framework;
 using System;
 using System.Data;
@@ -116,3 +118,5 @@ namespace MonoTests.System.Data.Odbc {
                }
        }
 }
+
+#endif
\ No newline at end of file
index 922458b7f1a6d880fc08ab3f7426b75b97b645f9..fce89cd084d3632eb66831133c4f295c53a9d259 100644 (file)
@@ -27,6 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_OLEDB
+
 using System.Data;
 using System.Data.OleDb;
 
@@ -193,3 +195,5 @@ namespace MonoTests.System.Data.OleDb
                }
        }
 }
+
+#endif
\ No newline at end of file
index 4d2b0c4099ba6c4166e6a891da7f0a1b249b3e5a..211c4cfffa8e1c4195e53a062645d3a443c37dca 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_OLEDB
 using System;
 using System.Data;
 using System.Data.OleDb;
@@ -229,3 +230,5 @@ namespace MonoTests.System.Data.OleDb
                }
        }
 }
+
+#endif
\ No newline at end of file
index 3c906222d7df7c1e1633bf6a044dda040a92a86c..220c1b8c29e0e7197eda95660d3db9df9a1bf374 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_OLEDB
+
 using System;
 using System.Data;
+#if !NO_ODBC
 using System.Data.Odbc;
+#endif
 using System.Data.OleDb;
 
 using NUnit.Framework;
@@ -450,3 +454,5 @@ namespace MonoTests.System.Data.OleDb
                }
        }
 }
+
+#endif
\ No newline at end of file
index c1efd397354520890c1ffbfc83af2d20cb5542a8..6becd048ee6365e5dba5f57a7dda7f820c8ca316 100644 (file)
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_OLEDB
+
 using System.Data.OleDb;
 using NUnit.Framework;
 
@@ -49,3 +51,5 @@ namespace MonoTests.System.Data.OleDb
                 }
         }
 }
+
+#endif
\ No newline at end of file
index 0dfa75c3fc2b4af77318309949a0b48b55876f3d..37e83227df11b194c487c5af32e8dfcde3eeed32 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NO_OLEDB
 using NUnit.Framework;
 using System;
 using System.Data;
@@ -56,3 +57,5 @@ namespace MonoTests.System.Data.OleDb {
                }
        }
 }
+
+#endif
\ No newline at end of file
index 22e213f016c388bfd627abdb31a738f2cf2fe79f..53bf1953fb0e7c766f42f2aef4f364992fe43999 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
 //\r
 \r
+#if !NO_OLEDB\r
 using NUnit.Framework;\r
 using System;\r
 using System.Data;\r
@@ -196,3 +197,5 @@ namespace MonoTests.System.Data.OleDb {
                }\r
        }\r
 }\r
+\r
+#endif
\ No newline at end of file
index e1f3b325aba4ba37b8b062a4fd69fdd31f827c14..742f73b8356297ba55759646dd8596b9573d0d67 100644 (file)
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
 //\r
 \r
+#if !NO_OLEDB\r
+\r
 using NUnit.Framework;\r
 using System;\r
 using System.Data;\r
@@ -129,3 +131,5 @@ namespace MonoTests.System.Data.OleDb {
                }\r
        }\r
 }\r
+\r
+#endif
\ No newline at end of file
index 8135637f71a7f28fd68f7728c3540c18c5af8f51..8da33c54a598908572dc48c9c4bfc8af4f6ce348 100644 (file)
@@ -3,6 +3,7 @@
                        type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                <section name="connectionStrings_test"
                        type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
+               <section name="providerTests" type="MonoTests.System.Data.Connected.ProviderTestsConfigurationHandler, net_4_x_System.Data_test" />
        </configSections>
        <system.data>
                <DbProviderFactories>
                <add name="Publications" providerName="System.Data.SqlClient" 
                        connectionString="Data Source=MyServer;Initial Catalog=pubs;integrated security=SSPI" />
        </connectionStrings_test>
+       <providerTests>
+               <engines>
+                       <engine
+                               name="sqlserver2005"
+                               type="SQLServer"
+                               clientversion="9"
+                               quoteCharacter="&quot;"
+                               removesTrailingSpaces="false"
+                               emptyBinaryAsNull="false"
+                               supportsMicroseconds="true"
+                               supportsUniqueIdentifier="true"
+                               supportsDate="false"
+                               supportsTime="false"
+                               supportsTimestamp="true" />
+                       <engine
+                               name="mysql51"
+                               type="MySQL"
+                               quoteCharacter="`"
+                               removesTrailingSpaces="true"
+                               emptyBinaryAsNull="true"
+                               supportsMicroseconds="false"
+                               supportsUniqueIdentifier="false"
+                               supportsDate="true"
+                               supportsTime="true"
+                               supportsTimestamp="false" />
+               </engines>
+               <connections>
+                       <connection
+                               name="sqlserver-tds"
+                               factory="System.Data.SqlClient"
+                               connectionString=""
+                               engine="sqlserver2005" />
+                       <connection
+                               name="mysql-odbc"
+                               factory="System.Data.Odbc"
+                               connectionString=""
+                               engine="mysql51" />
+               </connections>
+       </providerTests>
diff --git a/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.exclude.sources b/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.exclude.sources
deleted file mode 100644 (file)
index 0022a9e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-System.Data.Odbc/OdbcCommandBuilderTest.cs
-System.Data.Odbc/OdbcCommandTest.cs
-System.Data.Odbc/OdbcConnectionStringBuilderTest.cs
-System.Data.Odbc/OdbcConnectionTest.cs
-System.Data.Odbc/OdbcDataAdapterTest.cs
-System.Data.Odbc/OdbcDataReaderTest.cs
-System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs
-System.Data.Odbc/OdbcParameterCollectionTest.cs
-System.Data.Odbc/OdbcParameterTest.cs
-System.Data.Odbc/OdbcPermissionAttributeTest.cs
-System.Data.Odbc/OdbcPermissionTest.cs
-System.Data.OleDb/OleDbCommandTest.cs
-System.Data.OleDb/OleDbConnectionTest.cs
-System.Data.OleDb/OleDbDataAdapterTest.cs
-System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs
-System.Data.OleDb/OleDbParameterCollectionTest.cs
-System.Data.OleDb/OleDbPermissionAttributeTest.cs
-System.Data.OleDb/OleDbPermissionTest.cs
diff --git a/mcs/class/System.Data/testing_aot_hybrid_System.Data_test.dll.exclude.sources b/mcs/class/System.Data/testing_aot_hybrid_System.Data_test.dll.exclude.sources
deleted file mode 100644 (file)
index 0022a9e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-System.Data.Odbc/OdbcCommandBuilderTest.cs
-System.Data.Odbc/OdbcCommandTest.cs
-System.Data.Odbc/OdbcConnectionStringBuilderTest.cs
-System.Data.Odbc/OdbcConnectionTest.cs
-System.Data.Odbc/OdbcDataAdapterTest.cs
-System.Data.Odbc/OdbcDataReaderTest.cs
-System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs
-System.Data.Odbc/OdbcParameterCollectionTest.cs
-System.Data.Odbc/OdbcParameterTest.cs
-System.Data.Odbc/OdbcPermissionAttributeTest.cs
-System.Data.Odbc/OdbcPermissionTest.cs
-System.Data.OleDb/OleDbCommandTest.cs
-System.Data.OleDb/OleDbConnectionTest.cs
-System.Data.OleDb/OleDbDataAdapterTest.cs
-System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs
-System.Data.OleDb/OleDbParameterCollectionTest.cs
-System.Data.OleDb/OleDbPermissionAttributeTest.cs
-System.Data.OleDb/OleDbPermissionTest.cs
index 5d3f278247ea539ff2de0fd17091828aaa43171b..dc21bcf31c1cea9773e28c1c19748bab0f7657a4 100644 (file)
@@ -86,7 +86,11 @@ $(STANDALONE_TEST_ASSEMBLY): $(the_assembly) Test/standalone-tests/Consts.cs
        $(CSCOMPILE) $(STANDALONE_TEST_MCS_FLAGS) -out:$@ -target:library @System.Web.Extensions_standalone_test.dll.sources
 
 Test/standalone-tests/Consts.cs: Test/standalone-tests/Consts.cs.in
+ifeq ($(PLATFORM), win32)
+       @sed 's,@SystemWebExtensionsClassDir@,$(shell cygpath -a -m .),' $< > $@
+else
        @sed 's,@SystemWebExtensionsClassDir@,$(shell pwd),' $< > $@
+endif
 
 include ../../build/library.make
 
diff --git a/mcs/class/System.Web.Extensions/Test/standalone-tests/.gitignore b/mcs/class/System.Web.Extensions/Test/standalone-tests/.gitignore
new file mode 100644 (file)
index 0000000..e610081
--- /dev/null
@@ -0,0 +1 @@
+/Consts.cs
index ab36ccf501dd9ada4b0666ff3d2de854e6e424c7..2e8a8b33a886d1e71183ca44ab0b81ce77b6ad09 100644 (file)
@@ -57,7 +57,7 @@ namespace StandAloneTests.DataPager_NumericPagerField_Bug615315
                
                void TestQueryMode_Aspx_Start (string result, TestRunItem runItem)
                {
-                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><a disabled=""disabled"">First</a>&nbsp;<span>1</span>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=2"">2</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=3"">3</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=4"">4</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=5"">5</a>&nbsp;&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=6"">...</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=10"">Last</a>&nbsp;</span>";
+                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><a class=""aspNetDisabled"">First</a>&nbsp;<span>1</span>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=2"">2</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=3"">3</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=4"">4</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=5"">5</a>&nbsp;&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=6"">...</a>&nbsp;<a href=""/Test_QueryMode.aspx?pageNumber=10"">Last</a>&nbsp;</span>";
                        Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
                }
 
@@ -127,25 +127,25 @@ namespace StandAloneTests.DataPager_NumericPagerField_Bug615315
                
                void TestPostBackMode_Aspx_Start (string result, TestRunItem runItem)
                {
-                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" disabled=""disabled"" />&nbsp;<span>1</span>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01','')"">2</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">5</a>&nbsp;&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
+                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" disabled=""disabled"" />&nbsp;<span>1</span>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01&#39;,&#39;&#39;)"">2</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02&#39;,&#39;&#39;)"">3</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03&#39;,&#39;&#39;)"">4</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04&#39;,&#39;&#39;)"">5</a>&nbsp;&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05&#39;,&#39;&#39;)"">...</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
                        Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
                }
 
                void TestPostBackMode_Aspx_Page2 (string result, TestRunItem runItem)
                {
-                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" />&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">1</a>&nbsp;<span>2</span>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">5</a>&nbsp;&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
+                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" />&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00&#39;,&#39;&#39;)"">1</a>&nbsp;<span>2</span>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02&#39;,&#39;&#39;)"">3</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03&#39;,&#39;&#39;)"">4</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04&#39;,&#39;&#39;)"">5</a>&nbsp;&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05&#39;,&#39;&#39;)"">...</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
                        Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
                }
 
                void TestPostBackMode_Aspx_PageNext (string result, TestRunItem runItem)
                {
-                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" />&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">...</a>&nbsp;<span>6</span>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">7</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">8</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">9</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">10</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
+                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" />&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00&#39;,&#39;&#39;)"">...</a>&nbsp;<span>6</span>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02&#39;,&#39;&#39;)"">7</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03&#39;,&#39;&#39;)"">8</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04&#39;,&#39;&#39;)"">9</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05&#39;,&#39;&#39;)"">10</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
                        Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
                }
 
                void TestPostBackMode_Aspx_PagePrev (string result, TestRunItem runItem)
                {
-                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" />&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">1</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01','')"">2</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a>&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a>&nbsp;<span>5</span>&nbsp;&nbsp;<a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
+                       string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" />&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00&#39;,&#39;&#39;)"">1</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01&#39;,&#39;&#39;)"">2</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02&#39;,&#39;&#39;)"">3</a>&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03&#39;,&#39;&#39;)"">4</a>&nbsp;<span>5</span>&nbsp;&nbsp;<a href=""javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05&#39;,&#39;&#39;)"">...</a>&nbsp;<input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" />&nbsp;</span>";
                        Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
                }
        }
index d3de824333210066dc1a22e8d5dde570c31aaf78..e8f05421b5fbc6458357012280d1951874033656 100644 (file)
@@ -73,13 +73,16 @@ namespace StandAloneRunner
                static void Main (string[] args)
                {
                        try {
-                               Run (args);
+                               var success = Run (args);
+
+                               if (!success)
+                                       Environment.Exit (1);
                        } catch (Exception ex) {
                                Die ("Exception caught:{0}{1}", Environment.NewLine, ex.ToString ());
                        }
                }
 
-               static void Run (string[] args)
+               static bool Run (string[] args)
                {
                        bool showHelp = false;
                        string testName = null;
@@ -177,6 +180,8 @@ namespace StandAloneRunner
                                        writer.Dispose ();
                                }
                        }
+
+                       return failedCounter == 0;
                }
 
                static string FormatReport (StandaloneTest test)
index c71e98acfbb3de983040762641d00a4dd7083846..8efb18cc93ef6d734bdc7f42df4760900c2b96e7 100644 (file)
@@ -36,7 +36,12 @@ endif
 
 ifndef MOBILE_PROFILE
 LIB_MCS_FLAGS += -d:CODEDOM
-TEST_LIB_REFS = System.Drawing $(MONO_SECURITY) System.Data System.Xml System.Core System.Configuration
+TEST_LIB_REFS = $(MONO_SECURITY) System.Data System.Xml System.Core System.Configuration
+
+ifndef NO_SYSTEM_DRAWING_DEPENDENCY
+TEST_LIB_REFS += System.Drawing
+endif
+
 else
 LIB_MCS_FLAGS += -nowarn:618
 TEST_LIB_REFS = $(MONO_SECURITY) System.Data System.Xml System.Core
@@ -53,6 +58,14 @@ REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START
 TEST_MCS_FLAGS += -d:MONO_FEATURE_PROCESS_START
 endif
 
+ifdef MONO_FEATURE_APPLETLS
+LIB_MCS_FLAGS += -d:MONO_FEATURE_APPLETLS
+endif
+
+ifdef ONLY_APPLETLS
+LIB_MCS_FLAGS += -d:ONLY_APPLETLS
+endif
+
 ifndef PROFILE_DISABLE_BTLS
 ifdef HAVE_BTLS
 
diff --git a/mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs b/mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs
new file mode 100644 (file)
index 0000000..d26abe9
--- /dev/null
@@ -0,0 +1,106 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+//
+// AppleCertificateHelper.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc.
+//
+
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
+
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+#else
+using Mono.Security.Interface;
+#endif
+
+namespace Mono.AppleTls
+{
+       static class AppleCertificateHelper
+       {
+               public static SecIdentity GetIdentity (X509Certificate certificate)
+               {
+                       /*
+                        * If we got an 'X509Certificate2', then we require it to have a private key
+                        * and import it.
+                        */
+                       var certificate2 = certificate as X509Certificate2;
+                       if (certificate2 != null)
+                               return SecIdentity.Import (certificate2);
+
+                       /*
+                        * Otherwise, we require the private key to be in the keychain.
+                        */
+                       using (var secCert = new SecCertificate (certificate)) {
+                               return SecKeyChain.FindIdentity (secCert, true);
+                       }
+               }
+
+               public static SecIdentity GetIdentity (X509Certificate certificate, out SecCertificate[] intermediateCerts)
+               {
+                       var identity = GetIdentity (certificate);
+
+                       var impl2 = certificate.Impl as X509Certificate2Impl;
+                       if (impl2 == null || impl2.IntermediateCertificates == null) {
+                               intermediateCerts = new SecCertificate [0];
+                               return identity;
+                       }
+
+                       try {
+                               intermediateCerts = new SecCertificate [impl2.IntermediateCertificates.Count];
+                               for (int i = 0; i < intermediateCerts.Length; i++)
+                                       intermediateCerts [i] = new SecCertificate (impl2.IntermediateCertificates [i]);
+
+                               return identity;
+                       } catch {
+                               identity.Dispose ();
+                               throw;
+                       }
+               }
+
+               public static bool InvokeSystemCertificateValidator (
+                       ICertificateValidator2 validator, string targetHost, bool serverMode,
+                       X509CertificateCollection certificates,
+                       ref MonoSslPolicyErrors errors, ref int status11)
+               {
+                       if (certificates == null) {
+                               errors |= MonoSslPolicyErrors.RemoteCertificateNotAvailable;
+                               return false;
+                       }
+
+                       if (!string.IsNullOrEmpty (targetHost)) {
+                               var pos = targetHost.IndexOf (':');
+                               if (pos > 0)
+                                       targetHost = targetHost.Substring (0, pos);
+                       }
+
+                       var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost);
+                       var trust = new SecTrust (certificates, policy);
+
+                       if (validator.Settings.TrustAnchors != null) {
+                               var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
+                               if (status != SecStatusCode.Success)
+                                       throw new InvalidOperationException (status.ToString ());
+                               trust.SetAnchorCertificatesOnly (false);
+                       }
+
+                       var result = trust.Evaluate ();
+                       if (result == SecTrustResult.Unspecified)
+                               return true;
+
+                       errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
+                       return false;
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs b/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
new file mode 100644 (file)
index 0000000..2f2fd6b
--- /dev/null
@@ -0,0 +1,907 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+//
+// AppleTlsContext.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc.
+//
+
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Globalization;
+using System.Collections;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices;
+using SSA = System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+#else
+using Mono.Security.Interface;
+#endif
+
+using Mono.Net;
+using Mono.Net.Security;
+using Mono.Util;
+
+using ObjCRuntime;
+
+namespace Mono.AppleTls
+{
+       class AppleTlsContext : MobileTlsContext
+       {
+               public const string SecurityLibrary = "/System/Library/Frameworks/Security.framework/Security";
+
+               GCHandle handle;
+               IntPtr context;
+               IntPtr connectionId;
+               SslReadFunc readFunc;
+               SslWriteFunc writeFunc;
+
+               SecIdentity serverIdentity;
+               SecIdentity clientIdentity;
+
+               X509Certificate remoteCertificate;
+               X509Certificate localClientCertificate;
+               MonoTlsConnectionInfo connectionInfo;
+               bool havePeerTrust;
+               bool isAuthenticated;
+               bool handshakeFinished;
+               int handshakeStarted;
+
+               bool closed;
+               bool disposed;
+               bool closedGraceful;
+               int pendingIO;
+
+               Exception lastException;
+
+               public AppleTlsContext (
+                       MobileAuthenticatedStream parent, bool serverMode, string targetHost,
+                       SSA.SslProtocols enabledProtocols, X509Certificate serverCertificate,
+                       X509CertificateCollection clientCertificates, bool askForClientCert)
+                       : base (parent, serverMode, targetHost, enabledProtocols,
+                               serverCertificate, clientCertificates, askForClientCert)
+               {
+                       handle = GCHandle.Alloc (this);
+                       connectionId = GCHandle.ToIntPtr (handle);
+                       readFunc = NativeReadCallback;
+                       writeFunc = NativeWriteCallback;
+
+                       if (IsServer) {
+                               if (serverCertificate == null)
+                                       throw new ArgumentNullException ("serverCertificate");
+                       }
+               }
+
+               public IntPtr Handle {
+                       get {
+                               if (!HasContext)
+                                       throw new ObjectDisposedException ("AppleTlsContext");
+                               return context;
+                       }
+               }
+
+               public override bool HasContext {
+                       get { return !disposed && context != IntPtr.Zero; }
+               }
+
+               [System.Diagnostics.Conditional ("APPLE_TLS_DEBUG")]
+               protected new void Debug (string message, params object[] args)
+               {
+                       Console.Error.WriteLine ("MobileTlsStream({0}): {1}", Parent.ID, string.Format (message, args));
+               }
+
+               void CheckStatusAndThrow (SslStatus status, params SslStatus[] acceptable)
+               {
+                       var last = Interlocked.Exchange (ref lastException, null);
+                       if (last != null)
+                               throw last;
+
+                       if (status == SslStatus.Success || Array.IndexOf (acceptable, status) > -1)
+                               return;
+
+                       switch (status) {
+                       case SslStatus.ClosedAbort:
+                               throw new IOException ("Connection closed.");
+
+                       case SslStatus.BadCert:
+                               throw new TlsException (AlertDescription.BadCertificate);
+
+                       case SslStatus.UnknownRootCert:
+                       case SslStatus.NoRootCert:
+                       case SslStatus.XCertChainInvalid:
+                               throw new TlsException (AlertDescription.CertificateUnknown, status.ToString ());
+
+                       case SslStatus.CertExpired:
+                       case SslStatus.CertNotYetValid:
+                               throw new TlsException (AlertDescription.CertificateExpired);
+
+                       case SslStatus.Protocol:
+                               throw new TlsException (AlertDescription.ProtocolVersion);
+
+                       default:
+                               throw new TlsException (AlertDescription.InternalError, "Unknown Secure Transport error `{0}'.", status);
+                       }
+               }
+
+               #region Handshake
+
+               public override bool IsAuthenticated {
+                       get { return isAuthenticated; }
+               }
+
+               public override void StartHandshake ()
+               {
+                       Debug ("StartHandshake: {0}", IsServer);
+
+                       if (Interlocked.CompareExchange (ref handshakeStarted, 1, 1) != 0)
+                               throw new InvalidOperationException ();
+
+                       InitializeConnection ();
+
+                       SetSessionOption (SslSessionOption.BreakOnCertRequested, true);
+                       SetSessionOption (SslSessionOption.BreakOnClientAuth, true);
+                       SetSessionOption (SslSessionOption.BreakOnServerAuth, true);
+
+                       if (IsServer) {
+                               SecCertificate[] intermediateCerts;
+                               serverIdentity = AppleCertificateHelper.GetIdentity (LocalServerCertificate, out intermediateCerts);
+                               if (serverIdentity == null)
+                                       throw new SSA.AuthenticationException ("Unable to get server certificate from keychain.");
+
+                               SetCertificate (serverIdentity, intermediateCerts);
+                               for (int i = 0; i < intermediateCerts.Length; i++)
+                                       intermediateCerts [i].Dispose ();
+                       }
+               }
+
+               public override void FinishHandshake ()
+               {
+                       InitializeSession ();
+
+                       isAuthenticated = true;
+               }
+
+               public override void Flush ()
+               {
+               }
+
+               public override bool ProcessHandshake ()
+               {
+                       if (handshakeFinished)
+                               throw new NotSupportedException ("Handshake already finished.");
+
+                       while (true) {
+                               lastException = null;
+                               var status = SSLHandshake (Handle);
+                               Debug ("Handshake: {0} - {0:x}", status);
+
+                               CheckStatusAndThrow (status, SslStatus.WouldBlock, SslStatus.PeerAuthCompleted, SslStatus.PeerClientCertRequested);
+
+                               if (status == SslStatus.PeerAuthCompleted) {
+                                       RequirePeerTrust ();
+                               } else if (status == SslStatus.PeerClientCertRequested) {
+                                       RequirePeerTrust ();
+                                       if (remoteCertificate == null)
+                                               throw new TlsException (AlertDescription.InternalError, "Cannot request client certificate before receiving one from the server.");
+                                       localClientCertificate = SelectClientCertificate (remoteCertificate, null);
+                                       if (localClientCertificate == null)
+                                               continue;
+                                       clientIdentity = AppleCertificateHelper.GetIdentity (localClientCertificate);
+                                       if (clientIdentity == null)
+                                               throw new TlsException (AlertDescription.CertificateUnknown);
+                                       SetCertificate (clientIdentity, new SecCertificate [0]);
+                               } else if (status == SslStatus.WouldBlock) {
+                                       return false;
+                               } else if (status == SslStatus.Success) {
+                                       handshakeFinished = true;
+                                       return true;
+                               }
+                       }
+               }
+
+               void RequirePeerTrust ()
+               {
+                       if (!havePeerTrust) {
+                               EvaluateTrust ();
+                               havePeerTrust = true;
+                       }
+               }
+
+               void EvaluateTrust ()
+               {
+                       InitializeSession ();
+
+                       /*
+                        * We're using .NET's SslStream semantics here.
+                        * 
+                        * A server must always provide a valid certificate.
+                        * 
+                        * However, in server mode, "ask for client certificate" means that
+                        * we ask the client to provide a certificate, then invoke the client
+                        * certificate validator - passing 'null' if the client didn't provide
+                        * any.
+                        * 
+                        */
+
+                       var trust = GetPeerTrust (!IsServer);
+                       X509CertificateCollection certificates;
+
+                       if (trust == null || trust.Count == 0) {
+                               remoteCertificate = null;
+                               if (!IsServer)
+                                       throw new TlsException (AlertDescription.CertificateUnknown);
+                               certificates = null;
+                       } else {
+                               if (trust.Count > 1)
+                                       Debug ("WARNING: Got multiple certificates in SecTrust!");
+
+                               certificates = new X509CertificateCollection ();
+                               for (int i = 0; i < trust.Count; i++)
+                                       certificates.Add (trust [(IntPtr)i].ToX509Certificate ());
+
+                               remoteCertificate = certificates [0];
+                               Debug ("Got peer trust: {0}", remoteCertificate);
+                       }
+
+                       bool ok;
+                       try {
+                               ok = ValidateCertificate (certificates);
+                       } catch (Exception ex) {
+                               Debug ("Certificate validation failed: {0}", ex);
+                               throw new TlsException (AlertDescription.CertificateUnknown, "Certificate validation threw exception.");
+                       }
+
+                       if (!ok)
+                               throw new TlsException (AlertDescription.CertificateUnknown);
+               }
+
+               void InitializeConnection ()
+               {
+                       context = SSLCreateContext (IntPtr.Zero, IsServer ? SslProtocolSide.Server : SslProtocolSide.Client, SslConnectionType.Stream);
+
+                       var result = SSLSetIOFuncs (Handle, readFunc, writeFunc);
+                       CheckStatusAndThrow (result);
+
+                       result = SSLSetConnection (Handle, connectionId);
+                       CheckStatusAndThrow (result);
+
+                       if ((EnabledProtocols & SSA.SslProtocols.Tls) != 0)
+                               MinProtocol = SslProtocol.Tls_1_0;
+                       else if ((EnabledProtocols & SSA.SslProtocols.Tls11) != 0)
+                               MinProtocol = SslProtocol.Tls_1_1;
+                       else
+                               MinProtocol = SslProtocol.Tls_1_2;
+
+                       if ((EnabledProtocols & SSA.SslProtocols.Tls12) != 0)
+                               MaxProtocol = SslProtocol.Tls_1_2;
+                       else if ((EnabledProtocols & SSA.SslProtocols.Tls11) != 0)
+                               MaxProtocol = SslProtocol.Tls_1_1;
+                       else
+                               MaxProtocol = SslProtocol.Tls_1_0;
+
+#if APPLE_TLS_DEBUG
+                       foreach (var c in GetSupportedCiphers ())
+                               Debug ("  {0} SslCipherSuite.{1} {2:x} {3}", IsServer ? "Server" : "Client", c, (int)c, (CipherSuiteCode)c);
+#endif
+
+                       if (Settings != null && Settings.EnabledCiphers != null) {
+                               SslCipherSuite [] ciphers = new SslCipherSuite [Settings.EnabledCiphers.Length];
+                               for (int i = 0 ; i < Settings.EnabledCiphers.Length; ++i)
+                                       ciphers [i] = (SslCipherSuite)Settings.EnabledCiphers[i];
+                               SetEnabledCiphers (ciphers);
+                       }
+
+                       if (AskForClientCertificate)
+                               SetClientSideAuthenticate (SslAuthenticate.Try);
+
+                       IPAddress address;
+                       if (!IsServer && !string.IsNullOrEmpty (TargetHost) &&
+                           !IPAddress.TryParse (TargetHost, out address)) {
+                               PeerDomainName = ServerName;
+                       }
+               }
+
+               void InitializeSession ()
+               {
+                       if (connectionInfo != null)
+                               return;
+
+                       var cipher = NegotiatedCipher;
+                       var protocol = GetNegotiatedProtocolVersion ();
+                       Debug ("GET CONNECTION INFO: {0:x}:{0} {1:x}:{1} {2}", cipher, protocol, (TlsProtocolCode)protocol);
+
+                       connectionInfo = new MonoTlsConnectionInfo {
+                               CipherSuiteCode = (CipherSuiteCode)cipher,
+                               ProtocolVersion = GetProtocol (protocol),
+                               PeerDomainName = PeerDomainName
+                       };
+               }
+
+               static TlsProtocols GetProtocol (SslProtocol protocol)
+               {
+                       switch (protocol) {
+                       case SslProtocol.Tls_1_0:
+                               return TlsProtocols.Tls10;
+                       case SslProtocol.Tls_1_1:
+                               return TlsProtocols.Tls11;
+                       case SslProtocol.Tls_1_2:
+                               return TlsProtocols.Tls12;
+                       default:
+                               throw new NotSupportedException ();
+                       }
+               }
+
+               public override MonoTlsConnectionInfo ConnectionInfo {
+                       get { return connectionInfo; }
+               }
+
+               internal override bool IsRemoteCertificateAvailable {
+                       get { return remoteCertificate != null; }
+               }
+
+               internal override X509Certificate LocalClientCertificate {
+                       get { return localClientCertificate; }
+               }
+
+               public override X509Certificate RemoteCertificate {
+                       get { return remoteCertificate; }
+               }
+
+               public override TlsProtocols NegotiatedProtocol {
+                       get { return connectionInfo.ProtocolVersion; }
+               }
+
+               #endregion
+
+               #region General P/Invokes
+
+               [DllImport (SecurityLibrary )]
+               extern static /* OSStatus */ SslStatus SSLGetProtocolVersionMax (/* SSLContextRef */ IntPtr context, out SslProtocol maxVersion);
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLSetProtocolVersionMax (/* SSLContextRef */ IntPtr context, SslProtocol maxVersion);
+
+               public SslProtocol MaxProtocol {
+                       get {
+                               SslProtocol value;
+                               var result = SSLGetProtocolVersionMax (Handle, out value);
+                               CheckStatusAndThrow (result);
+                               return value;
+                       }
+                       set {
+                               var result = SSLSetProtocolVersionMax (Handle, value);
+                               CheckStatusAndThrow (result);
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLGetProtocolVersionMin (/* SSLContextRef */ IntPtr context, out SslProtocol minVersion);
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLSetProtocolVersionMin (/* SSLContextRef */ IntPtr context, SslProtocol minVersion);
+
+               public SslProtocol MinProtocol {
+                       get {
+                               SslProtocol value;
+                               var result = SSLGetProtocolVersionMin (Handle, out value);
+                               CheckStatusAndThrow (result);
+                               return value;
+                       }
+                       set {
+                               var result = SSLSetProtocolVersionMin (Handle, value);
+                               CheckStatusAndThrow (result);
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLGetNegotiatedProtocolVersion (/* SSLContextRef */ IntPtr context, out SslProtocol protocol);
+
+               public SslProtocol GetNegotiatedProtocolVersion ()
+               {
+                       SslProtocol value;
+                       var result = SSLGetNegotiatedProtocolVersion (Handle, out value);
+                       CheckStatusAndThrow (result);
+                       return value;
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLGetSessionOption (/* SSLContextRef */ IntPtr context, SslSessionOption option, out bool value);
+
+               public bool GetSessionOption (SslSessionOption option)
+               {
+                       bool value;
+                       var result = SSLGetSessionOption (Handle, option, out value);
+                       CheckStatusAndThrow (result);
+                       return value;
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLSetSessionOption (/* SSLContextRef */ IntPtr context, SslSessionOption option, bool value);
+
+               public void SetSessionOption (SslSessionOption option, bool value)
+               {
+                       var result = SSLSetSessionOption (Handle, option, value);
+                       CheckStatusAndThrow (result);
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLSetClientSideAuthenticate (/* SSLContextRef */ IntPtr context, SslAuthenticate auth);
+
+               public void SetClientSideAuthenticate (SslAuthenticate auth)
+               {
+                       var result = SSLSetClientSideAuthenticate (Handle, auth);
+                       CheckStatusAndThrow (result);
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLHandshake (/* SSLContextRef */ IntPtr context);
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLGetSessionState (/* SSLContextRef */ IntPtr context, ref SslSessionState state);
+
+               public SslSessionState SessionState {
+                       get {
+                               var value = SslSessionState.Invalid;
+                               var result = SSLGetSessionState (Handle, ref value);
+                               CheckStatusAndThrow (result);
+                               return value;
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetPeerID (/* SSLContextRef */ IntPtr context, /* const void** */ out IntPtr peerID, /* size_t* */ out IntPtr peerIDLen);
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLSetPeerID (/* SSLContextRef */ IntPtr context, /* const void* */ byte* peerID, /* size_t */ IntPtr peerIDLen);
+
+               public unsafe byte[] PeerId {
+                       get {
+                               IntPtr length;
+                               IntPtr id;
+                               var result = SSLGetPeerID (Handle, out id, out length);
+                               CheckStatusAndThrow (result);
+                               if ((result != SslStatus.Success) || ((int)length == 0))
+                                       return null;
+                               var data = new byte [(int)length];
+                               Marshal.Copy (id, data, 0, (int) length);
+                               return data;
+                       }
+                       set {
+                               SslStatus result;
+                               IntPtr length = (value == null) ? IntPtr.Zero : (IntPtr)value.Length;
+                               fixed (byte *p = value) {
+                                       result = SSLSetPeerID (Handle, p, length);
+                               }
+                               CheckStatusAndThrow (result);
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetBufferedReadSize (/* SSLContextRef */ IntPtr context, /* size_t* */ out IntPtr bufSize);
+
+               public IntPtr BufferedReadSize {
+                       get {
+                               IntPtr value;
+                               var result = SSLGetBufferedReadSize (Handle, out value);
+                               CheckStatusAndThrow (result);
+                               return value;
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetNumberSupportedCiphers (/* SSLContextRef */ IntPtr context, /* size_t* */ out IntPtr numCiphers);
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetSupportedCiphers (/* SSLContextRef */ IntPtr context, SslCipherSuite *ciphers, /* size_t* */ ref IntPtr numCiphers);
+
+               public unsafe IList<SslCipherSuite> GetSupportedCiphers ()
+               {
+                       IntPtr n;
+                       var result = SSLGetNumberSupportedCiphers (Handle, out n);
+                       CheckStatusAndThrow (result);
+                       if ((result != SslStatus.Success) || ((int)n <= 0))
+                               return null;
+
+                       var ciphers = new SslCipherSuite [(int)n];
+                       fixed (SslCipherSuite *p = ciphers) {
+                               result = SSLGetSupportedCiphers (Handle, p, ref n);
+                       }
+                       CheckStatusAndThrow (result);
+                       return ciphers;
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetNumberEnabledCiphers (/* SSLContextRef */ IntPtr context, /* size_t* */ out IntPtr numCiphers);
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetEnabledCiphers (/* SSLContextRef */ IntPtr context, SslCipherSuite *ciphers, /* size_t* */ ref IntPtr numCiphers);
+
+               public unsafe IList<SslCipherSuite> GetEnabledCiphers ()
+               {
+                       IntPtr n;
+                       var result = SSLGetNumberEnabledCiphers (Handle, out n);
+                       CheckStatusAndThrow (result);
+                       if ((result != SslStatus.Success) || ((int)n <= 0))
+                               return null;
+
+                       var ciphers = new SslCipherSuite [(int)n];
+                       fixed (SslCipherSuite *p = ciphers) {
+                               result = SSLGetEnabledCiphers (Handle, p, ref n);
+                       }
+                       CheckStatusAndThrow (result);
+                       return ciphers;
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLSetEnabledCiphers (/* SSLContextRef */ IntPtr context, SslCipherSuite *ciphers, /* size_t */ IntPtr numCiphers);
+
+               public unsafe void SetEnabledCiphers (SslCipherSuite [] ciphers)
+               {
+                       if (ciphers == null)
+                               throw new ArgumentNullException ("ciphers");
+
+                       SslStatus result;
+
+                       fixed (SslCipherSuite *p = ciphers)
+                               result = SSLSetEnabledCiphers (Handle, p, (IntPtr)ciphers.Length);
+                       CheckStatusAndThrow (result);
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetNegotiatedCipher (/* SSLContextRef */ IntPtr context, /* SslCipherSuite* */ out SslCipherSuite cipherSuite);
+
+               public SslCipherSuite NegotiatedCipher {
+                       get {
+                               SslCipherSuite value;
+                               var result = SSLGetNegotiatedCipher (Handle, out value);
+                               CheckStatusAndThrow (result);
+                               return value;
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetPeerDomainNameLength (/* SSLContextRef */ IntPtr context, /* size_t* */ out IntPtr peerNameLen);
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetPeerDomainName (/* SSLContextRef */ IntPtr context, /* char* */ byte[] peerName, /* size_t */ ref IntPtr peerNameLen);
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLSetPeerDomainName (/* SSLContextRef */ IntPtr context, /* char* */ byte[] peerName, /* size_t */ IntPtr peerNameLen);
+
+               public string PeerDomainName {
+                       get {
+                               IntPtr length;
+                               var result = SSLGetPeerDomainNameLength (Handle, out length);
+                               CheckStatusAndThrow (result);
+                               if (result != SslStatus.Success || (int)length == 0)
+                                       return String.Empty;
+                               var bytes = new byte [(int)length];
+                               result = SSLGetPeerDomainName (Handle, bytes, ref length);
+                               CheckStatusAndThrow (result);
+
+                               int peerDomainLength = (int)length;
+
+                               if (result != SslStatus.Success)
+                                       return string.Empty;
+                               if (peerDomainLength > 0 && bytes [peerDomainLength-1] == 0)
+                                       peerDomainLength = peerDomainLength - 1;
+                               return Encoding.UTF8.GetString (bytes, 0, peerDomainLength);
+                       }
+                       set {
+                               SslStatus result;
+                               if (value == null) {
+                                       result = SSLSetPeerDomainName (Handle, null, (IntPtr)0);
+                               } else {
+                                       var bytes = Encoding.UTF8.GetBytes (value);
+                                       result = SSLSetPeerDomainName (Handle, bytes, (IntPtr)bytes.Length);
+                               }
+                               CheckStatusAndThrow (result);
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLSetCertificate (/* SSLContextRef */ IntPtr context, /* CFArrayRef */ IntPtr certRefs);
+
+               CFArray Bundle (SecIdentity identity, IEnumerable<SecCertificate> certificates)
+               {
+                       if (identity == null)
+                               throw new ArgumentNullException ("identity");
+                       int i = 0;
+
+                       int n = 0;
+                       if (certificates != null) {
+                               foreach (var obj in certificates)
+                                       n++;
+                       }
+
+                       var ptrs = new IntPtr [n + 1];
+                       ptrs [0] = identity.Handle;
+                       foreach (var certificate in certificates)
+                               ptrs [++i] = certificate.Handle;
+                       return CFArray.CreateArray (ptrs);
+               }
+
+               public void SetCertificate (SecIdentity identify, IEnumerable<SecCertificate> certificates)
+               {
+                       using (var array = Bundle (identify, certificates)) {
+                               var result = SSLSetCertificate (Handle, array.Handle);
+                               CheckStatusAndThrow (result);
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLGetClientCertificateState (/* SSLContextRef */ IntPtr context, out SslClientCertificateState clientState);
+
+               public SslClientCertificateState ClientCertificateState {
+                       get {
+                               SslClientCertificateState value;
+                               var result = SSLGetClientCertificateState (Handle, out value);
+                               CheckStatusAndThrow (result);
+                               return value;
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLCopyPeerTrust (/* SSLContextRef */ IntPtr context, /* SecTrustRef */ out IntPtr trust);
+
+               public SecTrust GetPeerTrust (bool requireTrust)
+               {
+                       IntPtr value;
+                       var result = SSLCopyPeerTrust (Handle, out value);
+                       if (requireTrust) {
+                               CheckStatusAndThrow (result);
+                               if (value == IntPtr.Zero)
+                                       throw new TlsException (AlertDescription.CertificateUnknown);
+                       }
+                       return (value == IntPtr.Zero) ? null : new SecTrust (value);
+               }
+
+               #endregion
+
+               #region IO Functions
+
+               [DllImport (SecurityLibrary)]
+               extern static /* SSLContextRef */ IntPtr SSLCreateContext (/* CFAllocatorRef */ IntPtr alloc, SslProtocolSide protocolSide, SslConnectionType connectionType);
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLSetConnection (/* SSLContextRef */ IntPtr context, /* SSLConnectionRef */ IntPtr connection);
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLSetIOFuncs (/* SSLContextRef */ IntPtr context, /* SSLReadFunc */ SslReadFunc readFunc, /* SSLWriteFunc */ SslWriteFunc writeFunc);
+
+               [MonoPInvokeCallback (typeof (SslReadFunc))]
+               static SslStatus NativeReadCallback (IntPtr ptr, IntPtr data, ref IntPtr dataLength)
+               {
+                       var handle = GCHandle.FromIntPtr (ptr);
+                       if (!handle.IsAllocated)
+                               return SslStatus.Internal;
+
+                       var context = (AppleTlsContext) handle.Target;
+                       if (context.disposed)
+                               return SslStatus.ClosedAbort;
+
+                       try {
+                               return context.NativeReadCallback (data, ref dataLength);
+                       } catch (Exception ex) {
+                               if (context.lastException == null)
+                                       context.lastException = ex;
+                               return SslStatus.Internal;
+                       }
+               }
+
+               [MonoPInvokeCallback (typeof (SslWriteFunc))]
+               static SslStatus NativeWriteCallback (IntPtr ptr, IntPtr data, ref IntPtr dataLength)
+               {
+                       var handle = GCHandle.FromIntPtr (ptr);
+                       if (!handle.IsAllocated)
+                               return SslStatus.Internal;
+
+                       var context = (AppleTlsContext) handle.Target;
+                       if (context.disposed)
+                               return SslStatus.ClosedAbort;
+
+                       try {
+                               return context.NativeWriteCallback (data, ref dataLength);
+                       } catch (Exception ex) {
+                               if (context.lastException == null)
+                                       context.lastException = ex;
+                               return SslStatus.Internal;
+                       }
+               }
+
+               SslStatus NativeReadCallback (IntPtr data, ref IntPtr dataLength)
+               {
+                       if (closed || disposed || Parent == null)
+                               return SslStatus.ClosedAbort;
+
+                       var len = (int)dataLength;
+                       var readBuffer = new byte [len];
+
+                       Debug ("NativeReadCallback: {0} {1}", dataLength, len);
+
+                       bool wantMore;
+                       var ret = Parent.InternalRead (readBuffer, 0, len, out wantMore);
+                       dataLength = (IntPtr)ret;
+
+                       Debug ("NativeReadCallback #1: {0} - {1} {2}", len, ret, wantMore);
+
+                       if (ret < 0)
+                               return SslStatus.ClosedAbort;
+
+                       Marshal.Copy (readBuffer, 0, data, ret);
+
+                       if (ret > 0)
+                               return SslStatus.Success;
+                       else if (wantMore)
+                               return SslStatus.WouldBlock;
+                       else if (ret == 0) {
+                               closedGraceful = true;
+                               return SslStatus.ClosedGraceful;
+                       } else {
+                               return SslStatus.Success;
+                       }
+               }
+
+               SslStatus NativeWriteCallback (IntPtr data, ref IntPtr dataLength)
+               {
+                       if (closed || disposed || Parent == null)
+                               return SslStatus.ClosedAbort;
+
+                       var len = (int)dataLength;
+                       var writeBuffer = new byte [len];
+
+                       Marshal.Copy (data, writeBuffer, 0, len);
+
+                       Debug ("NativeWriteCallback: {0}", len);
+
+                       var ok = Parent.InternalWrite (writeBuffer, 0, len);
+
+                       Debug ("NativeWriteCallback done: {0} {1}", len, ok);
+
+                       return ok ? SslStatus.Success : SslStatus.ClosedAbort;
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLRead (/* SSLContextRef */ IntPtr context, /* const void* */ byte* data, /* size_t */ IntPtr dataLength, /* size_t* */ out IntPtr processed);
+
+               public override unsafe int Read (byte[] buffer, int offset, int count, out bool wantMore)
+               {
+                       if (Interlocked.Exchange (ref pendingIO, 1) == 1)
+                               throw new InvalidOperationException ();
+
+                       Debug ("Read: {0},{1}", offset, count);
+
+                       lastException = null;
+
+                       try {
+                               IntPtr processed;
+                               SslStatus status;
+
+                               fixed (byte *d = &buffer [offset])
+                                       status = SSLRead (Handle, d, (IntPtr)count, out processed);
+
+                               Debug ("Read done: {0} {1} {2}", status, count, processed);
+
+                               if (closedGraceful && (status == SslStatus.ClosedAbort || status == SslStatus.ClosedGraceful)) {
+                                       /*
+                                        * This is really ugly, but unfortunately SSLRead() also returns 'SslStatus.ClosedAbort'
+                                        * when the first inner Read() returns 0.  MobileAuthenticatedStream.InnerRead() attempts
+                                        * to distinguish between a graceful close and abnormal termination of connection.
+                                        */
+                                       wantMore = false;
+                                       return 0;
+                               }
+
+                               CheckStatusAndThrow (status, SslStatus.WouldBlock, SslStatus.ClosedGraceful);
+                               wantMore = status == SslStatus.WouldBlock;
+                               return (int)processed;
+                       } catch (Exception ex) {
+                               Debug ("Read error: {0}", ex);
+                               throw;
+                       } finally {
+                               pendingIO = 0;
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern unsafe static /* OSStatus */ SslStatus SSLWrite (/* SSLContextRef */ IntPtr context, /* const void* */ byte* data, /* size_t */ IntPtr dataLength, /* size_t* */ out IntPtr processed);
+
+               public override unsafe int Write (byte[] buffer, int offset, int count, out bool wantMore)
+               {
+                       if (Interlocked.Exchange (ref pendingIO, 1) == 1)
+                               throw new InvalidOperationException ();
+
+                       Debug ("Write: {0},{1}", offset, count);
+
+                       lastException = null;
+
+                       try {
+                               SslStatus status = SslStatus.ClosedAbort;
+                               IntPtr processed = (IntPtr)(-1);
+
+                               fixed (byte *d = &buffer [offset])
+                                       status = SSLWrite (Handle, d, (IntPtr)count, out processed);
+
+                               Debug ("Write done: {0} {1}", status, processed);
+
+                               CheckStatusAndThrow (status, SslStatus.WouldBlock);
+
+                               wantMore = status == SslStatus.WouldBlock;
+                               return (int)processed;
+                       } finally {
+                               pendingIO = 0;
+                       }
+               }
+
+               [DllImport (SecurityLibrary)]
+               extern static /* OSStatus */ SslStatus SSLClose (/* SSLContextRef */ IntPtr context);
+
+               public override void Close ()
+               {
+                       if (Interlocked.Exchange (ref pendingIO, 1) == 1)
+                               throw new InvalidOperationException ();
+
+                       Debug ("Close");
+
+                       lastException = null;
+
+                       try {
+                               if (closed || disposed)
+                                       return;
+
+                               var status = SSLClose (Handle);
+                               Debug ("Close done: {0}", status);
+                               CheckStatusAndThrow (status);
+                       } finally {
+                               closed = true;
+                               pendingIO = 0;
+                       }
+               }
+
+               #endregion
+
+               protected override void Dispose (bool disposing)
+               {
+                       try {
+                               if (disposed)
+                                       return;
+                               if (disposing) {
+                                       disposed = true;
+                                       if (serverIdentity != null) {
+                                               serverIdentity.Dispose ();
+                                               serverIdentity = null;
+                                       }
+                                       if (clientIdentity != null) {
+                                               clientIdentity.Dispose ();
+                                               clientIdentity = null;
+                                       }
+                                       if (remoteCertificate != null) {
+                                               remoteCertificate.Dispose ();
+                                               remoteCertificate = null;
+                                       }
+                               }
+                       } finally {
+                               disposed = true;
+                               if (context != IntPtr.Zero) {
+                                       CFObject.CFRelease (context);
+                                       context = IntPtr.Zero;
+                               }
+                               base.Dispose (disposing);
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs b/mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs
new file mode 100644 (file)
index 0000000..81f1b62
--- /dev/null
@@ -0,0 +1,77 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+//
+// AppleTlsProvider.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc.
+//
+
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+
+using MNS = Mono.Net.Security;
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+#else
+using Mono.Security.Interface;
+#endif
+
+namespace Mono.AppleTls
+{
+       class AppleTlsProvider : MonoTlsProvider
+       {
+               static readonly Guid id = new Guid ("981af8af-a3a3-419a-9f01-a518e3a17c1c");
+
+               public override string Name {
+                       get { return "apple-tls"; }
+               }
+
+               public override Guid ID {
+                       get { return id; }
+               }
+
+               public override IMonoSslStream CreateSslStream (
+                       Stream innerStream, bool leaveInnerStreamOpen,
+                       MonoTlsSettings settings = null)
+               {
+                       return new AppleTlsStream (innerStream, leaveInnerStreamOpen, settings, this);
+               }
+
+               public override bool SupportsSslStream {
+                       get { return true; }
+               }
+
+               public override bool SupportsMonoExtensions {
+                       get { return true; }
+               }
+
+               public override bool SupportsConnectionInfo {
+                       get { return true; }
+               }
+
+               public override SslProtocols SupportedProtocols {
+                       get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
+               }
+
+               internal override bool ValidateCertificate (
+                       ICertificateValidator2 validator, string targetHost, bool serverMode,
+                       X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain,
+                       ref MonoSslPolicyErrors errors, ref int status11)
+               {
+                       if (wantsChain)
+                               chain = MNS.SystemCertificateValidator.CreateX509Chain (certificates);
+                       return AppleCertificateHelper.InvokeSystemCertificateValidator (validator, targetHost, serverMode, certificates, ref errors, ref status11);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/AppleTlsStream.cs b/mcs/class/System/Mono.AppleTls/AppleTlsStream.cs
new file mode 100644 (file)
index 0000000..749fec6
--- /dev/null
@@ -0,0 +1,50 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+//
+// AppleTlsStream.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+
+using MNS = Mono.Net.Security;
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+#else
+using Mono.Security.Interface;
+#endif
+
+namespace Mono.AppleTls
+{
+       class AppleTlsStream : MNS.MobileAuthenticatedStream
+       {
+               public AppleTlsStream (Stream innerStream, bool leaveInnerStreamOpen, MonoTlsSettings settings, MonoTlsProvider provider)
+                       : base (innerStream, leaveInnerStreamOpen, settings, provider)
+               {
+               }
+
+               protected override MNS.MobileTlsContext CreateContext (
+                       MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
+                       SslProtocols enabledProtocols, X509Certificate serverCertificate,
+                       X509CertificateCollection clientCertificates, bool askForClientCert)
+               {
+                       return new AppleTlsContext (
+                               parent, serverMode, targetHost,
+                               enabledProtocols, serverCertificate,
+                               clientCertificates, askForClientCert);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/Certificate.cs b/mcs/class/System/Mono.AppleTls/Certificate.cs
new file mode 100644 (file)
index 0000000..e78a85f
--- /dev/null
@@ -0,0 +1,341 @@
+// 
+// Certificate.cs: Implements the managed SecCertificate wrapper.
+//
+// Authors: 
+//     Miguel de Icaza
+//  Sebastien Pouliot  <sebastien@xamarin.com>
+//
+// Copyright 2010 Novell, Inc
+// Copyright 2012-2013 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.
+//
+
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+
+using System;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
+using Mono.Net;
+
+using ObjCRuntime;
+
+namespace Mono.AppleTls {
+
+       partial class SecCertificate : INativeObject, IDisposable {
+               internal IntPtr handle;
+               
+               internal SecCertificate (IntPtr handle, bool owns = false)
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new Exception ("Invalid handle");
+
+                       this.handle = handle;
+                       if (!owns)
+                               CFObject.CFRetain (handle);
+               }
+               
+               [DllImport (AppleTlsContext.SecurityLibrary, EntryPoint="SecCertificateGetTypeID")]
+               public extern static IntPtr GetTypeID ();
+                       
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static IntPtr SecCertificateCreateWithData (IntPtr allocator, IntPtr cfData);
+
+               public SecCertificate (X509Certificate certificate)
+               {
+                       if (certificate == null)
+                               throw new ArgumentNullException ("certificate");
+
+                       handle = certificate.Impl.GetNativeAppleCertificate ();
+                       if (handle != IntPtr.Zero) {
+                               CFObject.CFRetain (handle);
+                               return;
+                       }
+
+                       using (CFData cert = CFData.FromData (certificate.GetRawCertData ())) {
+                               Initialize (cert);
+                       }
+               }
+
+               internal SecCertificate (X509CertificateImpl impl)
+               {
+                       handle = impl.GetNativeAppleCertificate ();
+                       if (handle != IntPtr.Zero) {
+                               CFObject.CFRetain (handle);
+                               return;
+                       }
+
+                       using (CFData cert = CFData.FromData (impl.GetRawCertData ())) {
+                               Initialize (cert);
+                       }
+               }
+
+               void Initialize (CFData data)
+               {
+                       handle = SecCertificateCreateWithData (IntPtr.Zero, data.Handle);
+                       if (handle == IntPtr.Zero)
+                               throw new ArgumentException ("Not a valid DER-encoded X.509 certificate");
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static IntPtr SecCertificateCopySubjectSummary (IntPtr cert);
+
+               public string SubjectSummary {
+                       get {
+                               if (handle == IntPtr.Zero)
+                                       throw new ObjectDisposedException ("SecCertificate");
+                               
+                               IntPtr subjectSummaryHandle = IntPtr.Zero;
+                               try {
+                                       subjectSummaryHandle = SecCertificateCopySubjectSummary (handle);
+                                       CFString subjectSummary = CFString.AsString (subjectSummaryHandle);
+                                       return subjectSummary;
+                               }
+                               finally {
+                                       if (subjectSummaryHandle != IntPtr.Zero)
+                                               CFObject.CFRelease (subjectSummaryHandle);
+                               }
+                       }
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static /* CFDataRef */ IntPtr SecCertificateCopyData (/* SecCertificateRef */ IntPtr cert);
+
+               public CFData DerData {
+                       get {
+                               if (handle == IntPtr.Zero)
+                                       throw new ObjectDisposedException ("SecCertificate");
+
+                               IntPtr data = SecCertificateCopyData (handle);
+                               if (data == IntPtr.Zero)
+                                       throw new ArgumentException ("Not a valid certificate");
+                               return new CFData (data, true);
+                       }
+               }
+
+               public X509Certificate ToX509Certificate ()
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new ObjectDisposedException ("SecCertificate");
+
+                       return new X509Certificate (handle);
+               }
+
+               internal static bool Equals (SecCertificate first, SecCertificate second)
+               {
+                       /*
+                        * This is a little bit expensive, but unfortunately there is no better API to compare two
+                        * SecCertificateRef's for equality.
+                        */
+                       if (first == null)
+                               throw new ArgumentNullException ("first");
+                       if (second == null)
+                               throw new ArgumentNullException ("second");
+                       if (first.Handle == second.Handle)
+                               return true;
+
+                       using (var firstData = first.DerData)
+                       using (var secondData = second.DerData) {
+                               if (firstData.Handle == secondData.Handle)
+                                       return true;
+
+                               if (firstData.Length != secondData.Length)
+                                       return false;
+                               IntPtr length = (IntPtr)firstData.Length;
+                               for (long i = 0; i < (long)length; i++) {
+                                       if (firstData [i] != secondData [i])
+                                               return false;
+                               }
+
+                               return true;
+                       }
+               }
+
+               ~SecCertificate ()
+               {
+                       Dispose (false);
+               }
+
+               public IntPtr Handle {
+                       get {
+                               return handle;
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (handle != IntPtr.Zero){
+                               CFObject.CFRelease (handle);
+                               handle = IntPtr.Zero;
+                       }
+               }
+       }
+
+       partial class SecIdentity : INativeObject, IDisposable {
+                
+               static readonly CFString ImportExportPassphase;
+               static readonly CFString ImportItemIdentity;
+               
+               static SecIdentity ()
+               {
+                       var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0);
+                       if (handle == IntPtr.Zero)
+                               return;
+
+                       try {           
+                               ImportExportPassphase = CFObject.GetStringConstant (handle, "kSecImportExportPassphrase");
+                               ImportItemIdentity = CFObject.GetStringConstant (handle, "kSecImportItemIdentity");
+                       } finally {
+                               CFObject.dlclose (handle);
+                       }
+               }
+
+               internal IntPtr handle;
+               
+               internal SecIdentity (IntPtr handle, bool owns = false)
+               {
+                       this.handle = handle;
+                       if (!owns)
+                               CFObject.CFRetain (handle);
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary, EntryPoint="SecIdentityGetTypeID")]
+               public extern static IntPtr GetTypeID ();
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static /* OSStatus */ SecStatusCode SecIdentityCopyCertificate (/* SecIdentityRef */ IntPtr identityRef,  /* SecCertificateRef* */ out IntPtr certificateRef);
+
+               public SecCertificate Certificate {
+                       get {
+                               if (handle == IntPtr.Zero)
+                                       throw new ObjectDisposedException ("SecIdentity");
+                               IntPtr cert;
+                               SecStatusCode result = SecIdentityCopyCertificate (handle, out cert);
+                               if (result != SecStatusCode.Success)
+                                       throw new InvalidOperationException (result.ToString ());
+                               return new SecCertificate (cert, true);
+                       }
+               }
+
+               public static SecIdentity Import (byte[] data, string password)
+               {
+                       if (data == null)
+                               throw new ArgumentNullException ("data");
+                       if (string.IsNullOrEmpty (password)) // SecPKCS12Import() doesn't allow empty passwords.
+                               throw new ArgumentException ("password");
+                       using (var pwstring = CFString.Create (password))
+                       using (var options = CFDictionary.FromObjectAndKey (pwstring.Handle, ImportExportPassphase.Handle)) {
+                               CFDictionary [] array;
+                               SecStatusCode result = SecImportExport.ImportPkcs12 (data, options, out array);
+                               if (result != SecStatusCode.Success)
+                                       throw new InvalidOperationException (result.ToString ());
+
+                               return new SecIdentity (array [0].GetValue (ImportItemIdentity.Handle));
+                       }
+               }
+
+               public static SecIdentity Import (X509Certificate2 certificate)
+               {
+                       if (certificate == null)
+                               throw new ArgumentNullException ("certificate");
+                       if (!certificate.HasPrivateKey)
+                               throw new InvalidOperationException ("Need X509Certificate2 with a private key.");
+
+                       /*
+                        * SecPSK12Import does not allow any empty passwords, so let's generate
+                        * a semi-random one here.
+                        */
+                       var password = Guid.NewGuid ().ToString ();
+                       var pkcs12 = certificate.Export (X509ContentType.Pfx, password);
+                       return Import (pkcs12, password);
+               }
+
+               ~SecIdentity ()
+               {
+                       Dispose (false);
+               }
+
+               public IntPtr Handle {
+                       get {
+                               return handle;
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (handle != IntPtr.Zero){
+                               CFObject.CFRelease (handle);
+                               handle = IntPtr.Zero;
+                       }
+               }
+       }
+
+       partial class SecKey : INativeObject, IDisposable {
+               internal IntPtr handle;
+               
+               public SecKey (IntPtr handle, bool owns = false)
+               {
+                       this.handle = handle;
+                       if (!owns)
+                               CFObject.CFRetain (handle);
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary, EntryPoint="SecKeyGetTypeID")]
+               public extern static IntPtr GetTypeID ();
+               
+               ~SecKey ()
+               {
+                       Dispose (false);
+               }
+
+               public IntPtr Handle {
+                       get {
+                               return handle;
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (handle != IntPtr.Zero){
+                               CFObject.CFRelease (handle);
+                               handle = IntPtr.Zero;
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/Enums.cs b/mcs/class/System/Mono.AppleTls/Enums.cs
new file mode 100644 (file)
index 0000000..3ec2107
--- /dev/null
@@ -0,0 +1,30 @@
+#if MONO_FEATURE_APPLETLS
+// Copyright 2011-2015 Xamarin Inc. All rights reserved.
+
+using ObjCRuntime;
+
+namespace Mono.AppleTls {
+
+       // this is a subset of OSStatus -> SInt32 -> signed int - see CoreFoundation.framework/Headers/CFBase.h
+       // values are defined in Security.framework/Headers/SecBase.h 
+       enum SecStatusCode {
+               Success                                                         = 0,
+               DuplicateItem                                           = -25299,
+               Param                                                           = -50,
+       }
+
+       // typedef uint32_t SecTrustResultType;
+       // values are defined in Security.framework/Headers/SecTrust.h 
+       enum SecTrustResult {
+               Invalid,
+               Proceed,
+
+               Confirm,
+               Deny,
+               Unspecified,
+               RecoverableTrustFailure,
+               FatalTrustFailure,
+               ResultOtherError,
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/INativeObject.cs b/mcs/class/System/Mono.AppleTls/INativeObject.cs
new file mode 100644 (file)
index 0000000..81c8003
--- /dev/null
@@ -0,0 +1,21 @@
+using System;
+
+namespace ObjCRuntime {
+
+       internal interface INativeObject {
+               IntPtr Handle { 
+                       get;
+               }
+       }
+
+       static class NativeObjectHelper {
+
+               // help to avoid the (too common pattern)
+               //      var p = x == null ? IntPtr.Zero : x.Handle;
+               static public IntPtr GetHandle (this INativeObject self)
+               {
+                       return self == null ? IntPtr.Zero : self.Handle;
+               }
+       }
+
+}
diff --git a/mcs/class/System/Mono.AppleTls/ImportExport.cs b/mcs/class/System/Mono.AppleTls/ImportExport.cs
new file mode 100644 (file)
index 0000000..518f0b1
--- /dev/null
@@ -0,0 +1,62 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+// 
+// ImportExport.cs
+//
+// Authors:
+//     Sebastien Pouliot  <sebastien@xamarin.com>
+//     
+// Copyright 2011-2014 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.Runtime.InteropServices;
+using ObjCRuntime;
+using Mono.Net;
+
+namespace Mono.AppleTls {
+
+       internal partial class SecImportExport {
+               
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static SecStatusCode SecPKCS12Import (IntPtr pkcs12_data, IntPtr options, out IntPtr items);
+               
+               static public SecStatusCode ImportPkcs12 (byte[] buffer, CFDictionary options, out CFDictionary[] array)
+               {
+                       using (CFData data = CFData.FromData (buffer)) {
+                               return ImportPkcs12 (data, options, out array);
+                       }
+               }
+
+               static public SecStatusCode ImportPkcs12 (CFData data, CFDictionary options, out CFDictionary [] array)
+               {
+                       if (options == null)
+                               throw new ArgumentNullException ("options");
+                       
+                       IntPtr handle;
+                       SecStatusCode code = SecPKCS12Import (data.Handle, options.Handle, out handle);
+                       array = CFArray.ArrayFromHandle <CFDictionary> (handle, h => new CFDictionary (h, false));
+                       CFObject.CFRelease (handle);
+                       return code;
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/Items.cs b/mcs/class/System/Mono.AppleTls/Items.cs
new file mode 100644 (file)
index 0000000..1c9fd03
--- /dev/null
@@ -0,0 +1,258 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+// 
+// Items.cs: Implements the KeyChain query access APIs
+//
+// We use strong types and a helper SecQuery class to simplify the
+// creation of the dictionary used to query the Keychain
+// 
+// Authors:
+//     Miguel de Icaza
+//     Sebastien Pouliot
+//     
+// Copyright 2010 Novell, Inc
+// Copyright 2011-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.Collections;
+using System.Runtime.InteropServices;
+using ObjCRuntime;
+using Mono.Net;
+
+namespace Mono.AppleTls {
+
+       enum SecKind {
+               Identity
+       }
+
+       static class SecKeyChain {
+               static readonly IntPtr MatchLimitAll;
+               static readonly IntPtr MatchLimitOne;
+               static readonly IntPtr MatchLimit;
+
+               static SecKeyChain ()
+               {
+                       var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0);
+                       if (handle == IntPtr.Zero)
+                               return;
+
+                       try {           
+                               MatchLimit = CFObject.GetIntPtr (handle, "kSecMatchLimit");
+                               MatchLimitAll = CFObject.GetIntPtr (handle, "kSecMatchLimitAll");
+                               MatchLimitOne = CFObject.GetIntPtr (handle, "kSecMatchLimitOne");
+                       } finally {
+                               CFObject.dlclose (handle);
+                       }
+               }
+
+               public static SecIdentity FindIdentity (SecCertificate certificate, bool throwOnError = false)
+               {
+                       if (certificate == null)
+                               throw new ArgumentNullException ("certificate");
+                       var identity = FindIdentity (cert => SecCertificate.Equals (certificate, cert));
+                       if (!throwOnError || identity != null)
+                               return identity;
+
+                       throw new InvalidOperationException (string.Format ("Could not find SecIdentity for certificate '{0}' in keychain.", certificate.SubjectSummary));
+               }
+
+               static SecIdentity FindIdentity (Predicate<SecCertificate> filter)
+               {
+                       /*
+                        * Unfortunately, SecItemCopyMatching() does not allow any search
+                        * filters when looking up an identity.
+                        * 
+                        * The following lookup will return all identities from the keychain -
+                        * we then need need to find the right one.
+                        */
+                       using (var record = new SecRecord (SecKind.Identity)) {
+                               SecStatusCode status;
+                               var result = SecKeyChain.QueryAsReference (record, -1, out status);
+                               if (status != SecStatusCode.Success || result == null)
+                                       return null;
+
+                               for (int i = 0; i < result.Length; i++) {
+                                       var identity = (SecIdentity)result [i];
+                                       if (filter (identity.Certificate))
+                                               return identity;
+                               }
+                       }
+
+                       return null;
+               }
+               
+               public static INativeObject[] QueryAsReference (SecRecord query, int max, out SecStatusCode result)
+               {
+                       if (query == null){
+                               result = SecStatusCode.Param;
+                               return null;
+                       }
+
+                       using (var copy = query.queryDict.MutableCopy ()) {
+                               copy.SetValue (CFBoolean.True.Handle, SecItem.ReturnRef);
+                               SetLimit (copy, max);
+
+                               IntPtr ptr;
+                               result = SecItem.SecItemCopyMatching (copy.Handle, out ptr);
+                               if ((result == SecStatusCode.Success) && (ptr != IntPtr.Zero)) {
+                                       var array = CFArray.ArrayFromHandle<INativeObject> (ptr, p => {
+                                               IntPtr cfType = CFType.GetTypeID (p);
+                                               if (cfType == SecCertificate.GetTypeID ())
+                                                       return new SecCertificate (p, true);
+                                               else if (cfType == SecKey.GetTypeID ())
+                                                       return new SecKey (p, true);
+                                               else if (cfType == SecIdentity.GetTypeID ())
+                                                       return new SecIdentity (p, true);
+                                               else
+                                                       throw new Exception (String.Format ("Unexpected type: 0x{0:x}", cfType));
+                                       });
+                                       return array;
+                               }
+                               return null;
+                       }
+               }
+
+               static CFNumber SetLimit (CFMutableDictionary dict, int max)
+               {
+                       CFNumber n = null;
+                       IntPtr val;
+                       if (max == -1)
+                               val = MatchLimitAll;
+                       else if (max == 1)
+                               val = MatchLimitOne;
+                       else {
+                               n = CFNumber.FromInt32 (max);
+                               val = n.Handle;
+                       }
+                       
+                       dict.SetValue (val, SecKeyChain.MatchLimit);
+                       return n;
+               }
+       }
+       
+       class SecRecord : IDisposable {
+
+               static readonly IntPtr SecClassKey;
+               static SecRecord ()
+               {
+                       var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0);
+                       if (handle == IntPtr.Zero)
+                               return;
+
+                       try {           
+                               SecClassKey = CFObject.GetIntPtr (handle, "kSecClassKey");
+                       } finally {
+                               CFObject.dlclose (handle);
+                       }
+               }
+
+               // Fix <= iOS 6 Behaviour - Desk #83099
+               // NSCFDictionary: mutating method sent to immutable object
+               // iOS 6 returns an inmutable NSDictionary handle and when we try to set its values it goes kaboom
+               // By explicitly calling `MutableCopy` we ensure we always have a mutable reference we expect that.
+               CFDictionary _queryDict;
+               internal CFDictionary queryDict 
+               { 
+                       get {
+                               return _queryDict;
+                       }
+                       set {
+                               _queryDict = value != null ? value.Copy () : null;
+                       }
+               }
+
+               public SecRecord (SecKind secKind)
+               {
+                       var kind = SecClass.FromSecKind (secKind);
+                       queryDict = CFDictionary.FromObjectAndKey (kind, SecClassKey);
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (queryDict != null){
+                               if (disposing){
+                                       queryDict.Dispose ();
+                                       queryDict = null;
+                               }
+                       }
+               }
+
+               ~SecRecord ()
+               {
+                       Dispose (false);
+               }
+       }
+       
+       partial class SecItem {
+               public static readonly IntPtr ReturnRef;
+               
+               static SecItem ()
+               {
+                       var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0);
+                       if (handle == IntPtr.Zero)
+                               return;
+
+                       try {           
+                               ReturnRef = CFObject.GetIntPtr (handle, "kSecReturnRef");
+                       } finally {
+                               CFObject.dlclose (handle);
+                       }
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               internal extern static SecStatusCode SecItemCopyMatching (/* CFDictionaryRef */ IntPtr query, /* CFTypeRef* */ out IntPtr result);
+       }
+
+       static partial class SecClass {
+       
+               public static readonly IntPtr Identity;
+               
+               static SecClass ()
+               {
+                       var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0);
+                       if (handle == IntPtr.Zero)
+                               return;
+
+                       try {           
+                               Identity = CFObject.GetIntPtr (handle, "kSecClassIdentity");
+                       } finally {
+                               CFObject.dlclose (handle);
+                       }
+               }
+
+               public static IntPtr FromSecKind (SecKind secKind)
+               {
+                       switch (secKind){
+                       case SecKind.Identity:
+                               return Identity;
+                       default:
+                               throw new ArgumentException ("secKind");
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/Policy.cs b/mcs/class/System/Mono.AppleTls/Policy.cs
new file mode 100644 (file)
index 0000000..b91f713
--- /dev/null
@@ -0,0 +1,87 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+// 
+// Policy.cs: Implements the managed SecPolicy wrapper.
+//
+// Authors: 
+//     Miguel de Icaza
+//  Sebastien Pouliot  <sebastien@xamarin.com>
+//
+// Copyright 2010 Novell, Inc
+// Copyright 2012-2014 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.Runtime.InteropServices;
+using ObjCRuntime;
+using Mono.Net;
+
+namespace Mono.AppleTls {
+       partial class SecPolicy : INativeObject, IDisposable {
+               IntPtr handle;
+
+               internal SecPolicy (IntPtr handle, bool owns = false)
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new Exception ("Invalid handle");
+
+                       this.handle = handle;
+                       if (!owns)
+                               CFObject.CFRetain (handle);
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static IntPtr /* SecPolicyRef */ SecPolicyCreateSSL (bool server, IntPtr /* CFStringRef */ hostname);
+
+               static public SecPolicy CreateSslPolicy (bool server, string hostName)
+               {
+                       CFString host = hostName == null ? null : CFString.Create (hostName);
+                       IntPtr handle = host == null ? IntPtr.Zero : host.Handle; 
+                       SecPolicy policy = new SecPolicy (SecPolicyCreateSSL (server, handle), true);
+                       if (host != null)
+                               host.Dispose ();
+                       return policy;
+               }
+
+               ~SecPolicy ()
+               {
+                       Dispose (false);
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               public IntPtr Handle {
+                       get { return handle; }
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (handle != IntPtr.Zero){
+                               CFObject.CFRelease (handle);
+                               handle = IntPtr.Zero;
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/SecureTransport.cs b/mcs/class/System/Mono.AppleTls/SecureTransport.cs
new file mode 100644 (file)
index 0000000..d19d6e4
--- /dev/null
@@ -0,0 +1,251 @@
+#if MONO_FEATURE_APPLETLS
+// Copyright 2014 Xamarin Inc. All rights reserved.
+
+namespace Mono.AppleTls {
+
+       // Security.framework/Headers/SecureTransport.h
+       // untyped enum
+       enum SslProtocol {
+               Unknown = 0,
+               // Ssl_3_0 = 2,
+               Tls_1_0 = 4,
+               Tls_1_1 = 7, 
+               Tls_1_2 = 8, 
+               // Dtls_1_0 = 9,
+               
+               /* Obsolete on iOS */
+               // Ssl_2_0 = 1,          
+               // Ssl_3_0_only = 3,         
+               // Tls_1_0_only = 5,         
+               // All = 6,                
+       }
+
+       // subset of OSStatus (int)
+       enum SslStatus {
+               Success                                 = 0,            // errSecSuccess in SecBase.h
+               Protocol                                = -9800,
+               Negotiation                             = -9801,
+               FatalAlert                              = -9802,
+               WouldBlock                              = -9803,
+               SessionNotFound                         = -9804,
+               ClosedGraceful                          = -9805,
+               ClosedAbort                             = -9806,
+               XCertChainInvalid                       = -9807,
+               BadCert                                 = -9808,
+               Crypto                                  = -9809,
+               Internal                                = -9810,
+               ModuleAttach                            = -9811,
+               UnknownRootCert                         = -9812,
+               NoRootCert                              = -9813,
+               CertExpired                             = -9814,
+               CertNotYetValid                         = -9815,
+               ClosedNotNotified                       = -9816,
+               BufferOverflow                          = -9817,
+               BadCipherSuite                          = -9818,
+               PeerUnexpectedMsg                       = -9819,
+               PeerBadRecordMac                        = -9820,
+               PeerDecryptionFail                      = -9821,
+               PeerRecordOverflow                      = -9822,
+               PeerDecompressFail                      = -9823,
+               PeerHandshakeFail                       = -9824,
+               PeerBadCert                             = -9825,
+               PeerUnsupportedCert                     = -9826,
+               PeerCertRevoked                         = -9827,
+               PeerCertExpired                         = -9828,
+               PeerCertUnknown                         = -9829,
+               IllegalParam                            = -9830,
+               PeerUnknownCA                           = -9831,
+               PeerAccessDenied                        = -9832,
+               PeerDecodeError                         = -9833,
+               PeerDecryptError                        = -9834,
+               PeerExportRestriction                   = -9835,
+               PeerProtocolVersion                     = -9836,
+               PeerInsufficientSecurity                = -9837,
+               PeerInternalError                       = -9838,
+               PeerUserCancelled                       = -9839,
+               PeerNoRenegotiation                     = -9840,
+               PeerAuthCompleted                       = -9841, // non fatal
+               PeerClientCertRequested                 = -9842, // non fatal
+               HostNameMismatch                        = -9843,
+               ConnectionRefused                       = -9844,
+               DecryptionFail                          = -9845,
+               BadRecordMac                            = -9846,
+               RecordOverflow                          = -9847,
+               BadConfiguration                        = -9848,
+               UnexpectedRecord                        = -9849,
+               SSLWeakPeerEphemeralDHKey               = -9850,
+               SSLClientHelloReceived                  = -9851 // non falta
+       }
+
+       // Security.framework/Headers/SecureTransport.h
+       // untyped enum
+       enum SslSessionOption {
+               BreakOnServerAuth,
+               BreakOnCertRequested,
+               BreakOnClientAuth,
+
+               // FalseStart,
+
+               // SendOneByteRecord,
+
+               // AllowServerIdentityChange = 5,
+               
+               // Fallback = 6,
+
+               // BreakOnClientHello = 7,
+
+               // AllowRenegotiation = 8,
+       }
+
+       // Security.framework/Headers/SecureTransport.h
+       // untyped enum
+       enum SslAuthenticate {
+               // Never,
+               // Always,
+               Try = 2,
+       }
+
+       // Security.framework/Headers/SecureTransport.h
+       // untyped enum
+       enum SslProtocolSide {
+               Server,
+               Client,
+       }
+
+       // Security.framework/Headers/SecureTransport.h
+       // untyped enum
+       enum SslConnectionType {
+               Stream,
+               // Datagram
+       }
+
+       // Security.framework/Headers/SecureTransport.h
+       // untyped enum
+       enum SslSessionState {
+               Invalid = -1,
+               // Idle,
+               // Handshake,
+               // Connected,
+               // Closed,
+               // Aborted
+       }
+
+       // Security.framework/Headers/SecureTransport.h
+       // untyped enum
+       enum SslClientCertificateState {
+               None,
+               Requested,
+               Sent,
+               Rejected
+       }
+
+       // Security.framework/Headers/CipherSuite.h
+       // 32 bits (uint32_t) on OSX, 16 bits (uint16_t) on iOS
+#if XAMMAC || XAMMAC_4_5
+       enum SslCipherSuite : uint {
+#else
+       enum SslCipherSuite : ushort {
+#endif
+               // DO NOT RENAME VALUES - they don't look good but we need them to keep compatibility with our System.dll code
+               // it's how it's defined across most SSL/TLS implementation (from RFC)
+
+               SSL_NULL_WITH_NULL_NULL                                         = 0x0000,       // value used before (not after) negotiation
+               TLS_NULL_WITH_NULL_NULL                                         = 0x0000,
+
+               // Not the whole list (too much unneeed metadata) but only what's supported
+               // FIXME needs to be expended with OSX 10.9
+
+               SSL_RSA_WITH_NULL_MD5                                           = 0x0001,
+               SSL_RSA_WITH_NULL_SHA                                           = 0x0002,
+               SSL_RSA_EXPORT_WITH_RC4_40_MD5                          = 0x0003,       // iOS 5.1 only
+               SSL_RSA_WITH_RC4_128_MD5                                        = 0x0004,
+               SSL_RSA_WITH_RC4_128_SHA                                        = 0x0005,
+               SSL_RSA_WITH_3DES_EDE_CBC_SHA                           = 0x000A,
+               SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA                       = 0x0016,
+               SSL_DH_anon_EXPORT_WITH_RC4_40_MD5                      = 0x0017,       // iOS 5.1 only
+               SSL_DH_anon_WITH_RC4_128_MD5                            = 0x0018,
+               SSL_DH_anon_WITH_3DES_EDE_CBC_SHA                       = 0x001B,
+
+               // TLS - identical values to SSL (above)
+
+               TLS_RSA_WITH_NULL_MD5                                           = 0x0001,
+               TLS_RSA_WITH_NULL_SHA                                           = 0x0002,
+               TLS_RSA_WITH_RC4_128_MD5                                        = 0x0004,
+               TLS_RSA_WITH_RC4_128_SHA                                        = 0x0005,
+               TLS_RSA_WITH_3DES_EDE_CBC_SHA                           = 0x000A,
+               TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA                       = 0x0016,
+               TLS_DH_anon_WITH_RC4_128_MD5                            = 0x0018,
+               TLS_DH_anon_WITH_3DES_EDE_CBC_SHA                       = 0x001B,
+
+               // TLS specific
+
+               TLS_PSK_WITH_NULL_SHA                                           = 0x002C,
+               TLS_RSA_WITH_AES_128_CBC_SHA                            = 0x002F,
+               TLS_DHE_RSA_WITH_AES_128_CBC_SHA                        = 0x0033,
+               TLS_DH_anon_WITH_AES_128_CBC_SHA                        = 0x0034,
+               TLS_RSA_WITH_AES_256_CBC_SHA                            = 0x0035,
+               TLS_DHE_RSA_WITH_AES_256_CBC_SHA                        = 0x0039,
+               TLS_DH_anon_WITH_AES_256_CBC_SHA                        = 0x003A,
+               TLS_RSA_WITH_NULL_SHA256                                        = 0x003B,
+               TLS_RSA_WITH_AES_128_CBC_SHA256                         = 0x003C,
+               TLS_RSA_WITH_AES_256_CBC_SHA256                         = 0x003D,
+               TLS_DHE_RSA_WITH_AES_128_CBC_SHA256                     = 0x0067,
+               TLS_DHE_RSA_WITH_AES_256_CBC_SHA256                     = 0x006B,
+               TLS_DH_anon_WITH_AES_128_CBC_SHA256                     = 0x006C,
+               TLS_DH_anon_WITH_AES_256_CBC_SHA256                     = 0x006D,
+               TLS_PSK_WITH_RC4_128_SHA                                        = 0x008A,
+               TLS_PSK_WITH_3DES_EDE_CBC_SHA                           = 0x008B,
+               TLS_PSK_WITH_AES_128_CBC_SHA                            = 0x008C,
+               TLS_PSK_WITH_AES_256_CBC_SHA                            = 0x008D,
+
+               TLS_RSA_WITH_AES_128_GCM_SHA256                         = 0x009C,       // iOS 9+
+               TLS_RSA_WITH_AES_256_GCM_SHA384                         = 0x009D,       // iOS 9+
+               TLS_DHE_RSA_WITH_AES_128_GCM_SHA256                     = 0x009E,       // iOS 9+
+               TLS_DHE_RSA_WITH_AES_256_GCM_SHA384                     = 0x009F,       // iOS 9+
+
+               TLS_DH_anon_WITH_AES_128_GCM_SHA256                     = 0x00A6,       // iOS 5.1 only
+               TLS_DH_anon_WITH_AES_256_GCM_SHA384                     = 0x00A7,       // iOS 5.1 only
+               TLS_PSK_WITH_AES_128_CBC_SHA256                         = 0x00AE,
+               TLS_PSK_WITH_AES_256_CBC_SHA384                         = 0x00AF,
+               TLS_PSK_WITH_NULL_SHA256                                        = 0x00B0,
+               TLS_PSK_WITH_NULL_SHA384                                        = 0x00B1,
+               TLS_ECDH_ECDSA_WITH_NULL_SHA                            = 0xC001,
+               TLS_ECDH_ECDSA_WITH_RC4_128_SHA                         = 0xC002,
+               TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA            = 0xC003,
+               TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA                     = 0xC004,
+               TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA                     = 0xC005,
+               TLS_ECDHE_ECDSA_WITH_NULL_SHA                           = 0xC006,
+               TLS_ECDHE_ECDSA_WITH_RC4_128_SHA                        = 0xC007,
+               TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA           = 0xC008,
+               TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA            = 0xC009,
+               TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA            = 0xC00A,
+               TLS_ECDH_RSA_WITH_NULL_SHA                                      = 0xC00B,
+               TLS_ECDH_RSA_WITH_RC4_128_SHA                           = 0xC00C,
+               TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA                      = 0xC00D,
+               TLS_ECDH_RSA_WITH_AES_128_CBC_SHA                       = 0xC00E,
+               TLS_ECDH_RSA_WITH_AES_256_CBC_SHA                       = 0xC00F,
+               TLS_ECDHE_RSA_WITH_NULL_SHA                                     = 0xC010,
+               TLS_ECDHE_RSA_WITH_RC4_128_SHA                          = 0xC011,
+               TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA                     = 0xC012,
+               TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA                      = 0xC013,
+               TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA                      = 0xC014,
+               TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256         = 0xC023,
+               TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384         = 0xC024,
+               TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256          = 0xC025,
+               TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384          = 0xC026,
+               TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256           = 0xC027,
+               TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384           = 0xC028,
+               TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256            = 0xC029,
+               TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384            = 0xC02A,
+
+               TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256         = 0xC02B,       // iOS 9+
+               TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384         = 0xC02C,       // iOS 9+
+               TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256          = 0xC02D,       // iOS 9+
+               TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384          = 0xC02E,       // iOS 9+
+               TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256           = 0xC02F,       // iOS 9+
+               TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384           = 0xC030,       // iOS 9+
+               TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256            = 0xC031,       // iOS 9+
+               TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384            = 0xC032,       // iOS 9+
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/SslConnection.cs b/mcs/class/System/Mono.AppleTls/SslConnection.cs
new file mode 100644 (file)
index 0000000..888a777
--- /dev/null
@@ -0,0 +1,18 @@
+#if MONO_FEATURE_APPLETLS
+//
+// SslConnection
+//
+// Authors:
+//     Sebastien Pouliot  <sebastien@xamarin.com>
+//
+// Copyright 2014 Xamarin Inc.
+//
+
+using System;
+
+namespace Mono.AppleTls 
+{
+       delegate SslStatus SslReadFunc (IntPtr connection, IntPtr data, /* size_t* */ ref IntPtr dataLength);
+       delegate SslStatus SslWriteFunc (IntPtr connection, IntPtr data, /* size_t* */ ref IntPtr dataLength);
+}
+#endif
diff --git a/mcs/class/System/Mono.AppleTls/Trust.cs b/mcs/class/System/Mono.AppleTls/Trust.cs
new file mode 100644 (file)
index 0000000..99c2cd8
--- /dev/null
@@ -0,0 +1,186 @@
+#if SECURITY_DEP && MONO_FEATURE_APPLETLS
+// 
+// Trust.cs: Implements the managed SecTrust wrapper.
+//
+// Authors: 
+//     Miguel de Icaza
+//  Sebastien Pouliot  <sebastien@xamarin.com>
+//
+// Copyright 2010 Novell, Inc
+// Copyright 2012-2014 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.Runtime.InteropServices;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+using ObjCRuntime;
+using Mono.Net;
+
+namespace Mono.AppleTls {
+       partial class SecTrust : INativeObject, IDisposable {
+               IntPtr handle;
+
+               internal SecTrust (IntPtr handle, bool owns = false)
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new Exception ("Invalid handle");
+
+                       this.handle = handle;
+                       if (!owns)
+                               CFObject.CFRetain (handle);
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static SecStatusCode SecTrustCreateWithCertificates (
+                       /* CFTypeRef */            IntPtr certOrCertArray,
+                       /* CFTypeRef __nullable */ IntPtr policies,
+                       /* SecTrustRef *__nonull */ out IntPtr sectrustref);
+               
+
+               public SecTrust (X509CertificateCollection certificates, SecPolicy policy)
+               {
+                       if (certificates == null)
+                               throw new ArgumentNullException ("certificates");
+
+                       SecCertificate[] array = new SecCertificate [certificates.Count];
+                       int i = 0;
+                       foreach (var certificate in certificates)
+                               array [i++] = new SecCertificate (certificate);
+                       Initialize (array, policy);
+               }
+
+               void Initialize (SecCertificate[] array, SecPolicy policy)
+               {
+                       using (var certs = CFArray.CreateArray (array)) {
+                               Initialize (certs.Handle, policy);
+                       }
+               }
+
+               void Initialize (IntPtr certHandle, SecPolicy policy)
+               {
+                       SecStatusCode result = SecTrustCreateWithCertificates (certHandle, policy == null ? IntPtr.Zero : policy.Handle, out handle);
+                       if (result != SecStatusCode.Success)
+                               throw new ArgumentException (result.ToString ());
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static SecStatusCode /* OSStatus */ SecTrustEvaluate (IntPtr /* SecTrustRef */ trust, out /* SecTrustResultType */ SecTrustResult result);
+
+               public SecTrustResult Evaluate ()
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new ObjectDisposedException ("SecTrust");
+
+                       SecTrustResult trust;
+                       SecStatusCode result = SecTrustEvaluate (handle, out trust);
+                       if (result != SecStatusCode.Success)
+                               throw new InvalidOperationException (result.ToString ());
+                       return trust;
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static IntPtr /* CFIndex */ SecTrustGetCertificateCount (IntPtr /* SecTrustRef */ trust);
+
+               public int Count {
+                       get {
+                               if (handle == IntPtr.Zero)
+                                       return 0;
+                               return (int) SecTrustGetCertificateCount (handle);
+                       }
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static IntPtr /* SecCertificateRef */ SecTrustGetCertificateAtIndex (IntPtr /* SecTrustRef */ trust, IntPtr /* CFIndex */ ix);
+
+               public SecCertificate this [IntPtr index] {
+                       get {
+                               if (handle == IntPtr.Zero)
+                                       throw new ObjectDisposedException ("SecTrust");
+                               if (((long)index < 0) || ((long)index >= Count))
+                                       throw new ArgumentOutOfRangeException ("index");
+
+                               return new SecCertificate (SecTrustGetCertificateAtIndex (handle, index));
+                       }
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static SecStatusCode /* OSStatus */ SecTrustSetAnchorCertificates (IntPtr /* SecTrustRef */ trust, IntPtr /* CFArrayRef */ anchorCertificates);
+
+               public SecStatusCode SetAnchorCertificates (X509CertificateCollection certificates)
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new ObjectDisposedException ("SecTrust");
+                       if (certificates == null)
+                               return SecTrustSetAnchorCertificates (handle, IntPtr.Zero);
+
+                       SecCertificate[] array = new SecCertificate [certificates.Count];
+                       int i = 0;
+                       foreach (var certificate in certificates)
+                               array [i++] = new SecCertificate (certificate);
+                       return SetAnchorCertificates (array);
+               }
+
+               public SecStatusCode SetAnchorCertificates (SecCertificate[] array)
+               {
+                       if (array == null)
+                               return SecTrustSetAnchorCertificates (handle, IntPtr.Zero);
+                       using (var certs = CFArray.FromNativeObjects (array)) {
+                               return SecTrustSetAnchorCertificates (handle, certs.Handle);
+                       }
+               }
+
+               [DllImport (AppleTlsContext.SecurityLibrary)]
+               extern static SecStatusCode /* OSStatus */ SecTrustSetAnchorCertificatesOnly (IntPtr /* SecTrustRef */ trust, bool anchorCertificatesOnly);
+
+               public SecStatusCode SetAnchorCertificatesOnly (bool anchorCertificatesOnly)
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new ObjectDisposedException ("SecTrust");
+
+                       return SecTrustSetAnchorCertificatesOnly (handle, anchorCertificatesOnly);
+               }
+
+               ~SecTrust ()
+               {
+                       Dispose (false);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (handle != IntPtr.Zero) {
+                               CFObject.CFRelease (handle);
+                               handle = IntPtr.Zero;
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               public IntPtr Handle {
+                       get { return handle; }
+               }
+       }
+}
+#endif
index 787de7577576d4223f934e12790662f37f35d143..bf326e51721db3f50c23396d1fd91bcd3d36f7df 100644 (file)
-// Copyright 2015 Xamarin Inc. All rights reserved.
+//
+// MonoTlsProviderFactory.cs
+//
+// Author:
+//      Chris Hamons  <chris.hamons@xamarin.com>
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// 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.
+
+#if !ONLY_APPLETLS
+#error Use MonoTlsProviderFactory.cs instead
+#endif
+
 #if SECURITY_DEP
 
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 using MSI = MonoSecurity::Mono.Security.Interface;
+using MX = MonoSecurity::Mono.Security.X509;
 #else
 using MSI = Mono.Security.Interface;
+using MX = Mono.Security.X509;
 #endif
+using System.Security.Cryptography.X509Certificates;
+using Mono.AppleTls;
+
+#endif
+
+using System;
+using System.Net;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
 
 namespace Mono.Net.Security
 {
+       /*
+        * Keep in sync with Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs.
+        * Simple implementation that does hard codes only a single provider
+        */
        static partial class MonoTlsProviderFactory
        {
-               static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
+               #region Internal API
+
+               /*
+                * APIs in this section are for consumption within System.dll only - do not access via
+                * reflection or from friend assemblies.
+                * 
+                * @IMonoTlsProvider is defined as empty interface outside 'SECURITY_DEP', so we don't need
+                * this conditional here.
+                */
+
+               internal static IMonoTlsProvider GetProviderInternal ()
+               {
+#if SECURITY_DEP
+                       return GetTlsProvider ();
+#else
+                       throw new NotSupportedException ("TLS Support not available.");
+#endif
+               }
+               
+               #endregion
+
+#if SECURITY_DEP
+               static object locker = new object ();
+               static IMonoTlsProvider provider;
+               static IMonoTlsProvider GetTlsProvider ()
                {
-                       MSI.MonoTlsProvider provider = null;
-                       if (MSI.MonoTlsProviderFactory._PrivateFactoryDelegate != null)
-                               provider = MSI.MonoTlsProviderFactory._PrivateFactoryDelegate ();
-                       return provider;
+                       lock (locker) {
+                               if (provider == null)
+                                       provider = new Private.MonoTlsProviderWrapper (new AppleTlsProvider ());
+                               return provider;
+                       }
                }
+
+
+               #region Mono.Security visible API
+
+               /*
+                * "Public" section, intended to be consumed via reflection.
+                * 
+                * Mono.Security.dll provides a public wrapper around these.
+                */
+
+               internal static MSI.MonoTlsProvider GetProvider ()
+               {
+                       return GetTlsProvider ().Provider;
+               }
+
+               internal static bool IsProviderSupported (string name)
+               {
+                       return true;
+               }
+
+               internal static MSI.MonoTlsProvider GetProvider (string name)
+               {
+                       return GetTlsProvider ().Provider;
+               }
+
+               internal static bool IsInitialized => true;
+
+               internal static void Initialize ()
+               {
+               }
+
+               internal static void Initialize (string provider)
+               {
+               }
+
+               internal static HttpWebRequest CreateHttpsRequest (Uri requestUri, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
+               {
+                       lock (locker) {
+                               var internalProvider = provider != null ? new Private.MonoTlsProviderWrapper (provider) : null;
+                               return new HttpWebRequest (requestUri, internalProvider, settings);
+                       }
+               }
+
+               internal static HttpListener CreateHttpListener (X509Certificate certificate, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
+               {
+                       lock (locker) {
+                               var internalProvider = provider != null ? new Private.MonoTlsProviderWrapper (provider) : null;
+                               return new HttpListener (certificate, internalProvider, settings);
+                       }
+               }
+               #endregion
+#endif
        }
 }
-#endif
+
index 0f25e003c7ebf0816f8f3e4013d1d51fb9eb7859..75138d8c715cf3d98741fd11398d41e1956a8f32 100644 (file)
@@ -24,6 +24,8 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
+#if !ONLY_APPLETLS // ONLY_APPLETLS uses MonoTlsProviderFactory.Apple.cs instead 
+
 #if SECURITY_DEP
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
@@ -160,9 +162,17 @@ namespace Mono.Net.Security
                                        return;
                                providerRegistration = new Dictionary<string,string> ();
                                providerRegistration.Add ("legacy", "Mono.Net.Security.LegacyTlsProvider");
-                               providerRegistration.Add ("default", "Mono.Net.Security.LegacyTlsProvider");
+                       
+                               if (Platform.IsMacOS)
+                                       providerRegistration.Add ("default", "Mono.AppleTls.AppleTlsProvider");
+                               else
+                                       providerRegistration.Add ("default", "Mono.Net.Security.LegacyTlsProvider");
+
                                if (IsBtlsSupported ())
                                        providerRegistration.Add ("btls", "Mono.Btls.MonoBtlsProvider");
+                       
+                               providerRegistration.Add ("apple", "Mono.AppleTls.AppleTlsProvider");
+                               
                                X509Helper2.Initialize ();
                        }
                }
@@ -261,4 +271,4 @@ namespace Mono.Net.Security
 
        }
 }
-
+#endif
index 4a14ea6534ca5f87e38831f65fd30dba6eccdde7..0b1baaa7af7b8a8f3c1fb15b9531bc2160c57e96 100644 (file)
@@ -29,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,436</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_BTLS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_APPLETLS;MONO_FEATURE_BTLS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -37,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,436</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_BTLS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_APPLETLS;MONO_FEATURE_BTLS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventHandler.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleCertificateHelper.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsContext.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsProvider.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsStream.cs" />\r
+    <Compile Include="Mono.AppleTls\Certificate.cs" />\r
+    <Compile Include="Mono.AppleTls\Enums.cs" />\r
+    <Compile Include="Mono.AppleTls\ImportExport.cs" />\r
+    <Compile Include="Mono.AppleTls\INativeObject.cs" />\r
+    <Compile Include="Mono.AppleTls\Items.cs" />\r
+    <Compile Include="Mono.AppleTls\Policy.cs" />\r
+    <Compile Include="Mono.AppleTls\SecureTransport.cs" />\r
+    <Compile Include="Mono.AppleTls\SslConnection.cs" />\r
+    <Compile Include="Mono.AppleTls\Trust.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsBio.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsContext.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsError.cs" />\r
index 3a1fc7a53c6baca054b0ec6ac77d3653b8a98ba9..50577efc812c8c3943098149dc34bfa16b9bbfb4 100644 (file)
@@ -29,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,436</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_APPLETLS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -37,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,436</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_APPLETLS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventHandler.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleCertificateHelper.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsContext.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsProvider.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsStream.cs" />\r
+    <Compile Include="Mono.AppleTls\Certificate.cs" />\r
+    <Compile Include="Mono.AppleTls\Enums.cs" />\r
+    <Compile Include="Mono.AppleTls\ImportExport.cs" />\r
+    <Compile Include="Mono.AppleTls\INativeObject.cs" />\r
+    <Compile Include="Mono.AppleTls\Items.cs" />\r
+    <Compile Include="Mono.AppleTls\Policy.cs" />\r
+    <Compile Include="Mono.AppleTls\SecureTransport.cs" />\r
+    <Compile Include="Mono.AppleTls\SslConnection.cs" />\r
+    <Compile Include="Mono.AppleTls\Trust.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsBio.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsContext.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsError.cs" />\r
index 56ebac3cd2414168b0aa2818492c72712ea998c2..ddaafd283905def3aa06f11aeee924e8e7a7aaf2 100644 (file)
@@ -29,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,436</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_APPLETLS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -37,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,436</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;CODEDOM;MONO_FEATURE_APPLETLS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventHandler.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleCertificateHelper.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsContext.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsProvider.cs" />\r
+    <Compile Include="Mono.AppleTls\AppleTlsStream.cs" />\r
+    <Compile Include="Mono.AppleTls\Certificate.cs" />\r
+    <Compile Include="Mono.AppleTls\Enums.cs" />\r
+    <Compile Include="Mono.AppleTls\ImportExport.cs" />\r
+    <Compile Include="Mono.AppleTls\INativeObject.cs" />\r
+    <Compile Include="Mono.AppleTls\Items.cs" />\r
+    <Compile Include="Mono.AppleTls\Policy.cs" />\r
+    <Compile Include="Mono.AppleTls\SecureTransport.cs" />\r
+    <Compile Include="Mono.AppleTls\SslConnection.cs" />\r
+    <Compile Include="Mono.AppleTls\Trust.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsBio.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsContext.cs" />\r
     <Compile Include="Mono.Btls\MonoBtlsError.cs" />\r
index 5402d58f522a0f413aac15f2dc281e19a66d4827..5a32084972359603e7f55acefeefae274fc4477e 100644 (file)
@@ -86,10 +86,14 @@ namespace System.Net
                        }
 
                        string content_encoding = webHeaders ["Content-Encoding"];
-                       if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0)
+                       if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
                                stream = new GZipStream (stream, CompressionMode.Decompress);
-                       else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0)
+                               webHeaders.Remove (HttpRequestHeader.ContentEncoding);
+                       }
+                       else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
                                stream = new DeflateStream (stream, CompressionMode.Decompress);
+                               webHeaders.Remove (HttpRequestHeader.ContentEncoding);
+                       }
                }
 
                [Obsolete ("Serialization is obsoleted for this type", false)]
index c9c1077b1e2f813582583a0731b62d46fe6e27f4..f0b7ef8398e5f83e43ef92f093c97994cc23719a 100644 (file)
@@ -99,19 +99,26 @@ namespace System.Net {
                        if (start_host >= length)
                                throw new ArgumentException ("No host specified.");
 
-                       int colon = uri.IndexOf (':', start_host, length - start_host);
-                       int root;
-                       if (colon > 0) {
-                               host = uri.Substring (start_host, colon - start_host);
-                               root = uri.IndexOf ('/', colon, length - colon);
-                               port = (ushort) Int32.Parse (uri.Substring (colon + 1, root - colon - 1));
-                               path = uri.Substring (root);
+                       int startPort = uri.IndexOf (':', start_host, length - start_host);
+                       if (uri [start_host] == '[') {
+                               startPort = uri.IndexOf ("]:") + 1;
+                       }
+                       if (start_host == startPort)
+                               throw new ArgumentException ("No host specified.");
+
+                       int root = uri.IndexOf ('/', start_host, length - start_host);
+                       if (root == -1)
+                               throw new ArgumentException ("No path specified.");
+
+                       if (startPort > 0) {
+                               host = uri.Substring (start_host, startPort - start_host).Trim ('[', ']');
+                               port = UInt16.Parse (uri.Substring (startPort + 1, root - startPort - 1));
                        } else {
-                               root = uri.IndexOf ('/', start_host, length - start_host);
-                               host = uri.Substring (start_host, root - start_host);
+                               host = uri.Substring (start_host, root - start_host).Trim ('[', ']');
                                port = default_port;
-                               path = uri.Substring (root);
                        }
+                       path = uri.Substring (root);
+
                        if (path.Length != 1)
                                path = path.Substring (0, path.Length - 1);
                }
@@ -121,7 +128,7 @@ namespace System.Net {
                        if (uri == null)
                                throw new ArgumentNullException ("uriPrefix");
 
-                       if(!uri.StartsWith ("http://") && !uri.StartsWith ("https://"))
+                       if (!uri.StartsWith ("http://") && !uri.StartsWith ("https://"))
                                throw new ArgumentException ("Only 'http' and 'https' schemes are supported.");
 
                        int length = uri.Length;
@@ -129,27 +136,23 @@ namespace System.Net {
                        if (start_host >= length)
                                throw new ArgumentException ("No host specified.");
 
-                       int colon = uri.IndexOf (':', start_host, length - start_host);
-                       if (start_host == colon)
+                       int startPort = uri.IndexOf (':', start_host, length - start_host);
+                       if (uri [start_host] == '[')
+                               startPort = uri.IndexOf ("]:") + 1;
+                       if (start_host == startPort)
                                throw new ArgumentException ("No host specified.");
+                       int root = uri.IndexOf ('/', start_host, length - start_host);
+                       if (root == -1)
+                               throw new ArgumentException ("No path specified.");
 
-                       int root;
-                       if (colon > 0) {
-                               root = uri.IndexOf ('/', colon, length - colon);
-                               if (root == -1)
-                                       throw new ArgumentException ("No path specified.");
-
+                       if (startPort > 0) {
                                try {
-                                       int p = Int32.Parse (uri.Substring (colon + 1, root - colon - 1));
+                                       int p = Int32.Parse (uri.Substring (startPort + 1, root - startPort - 1));
                                        if (p <= 0 || p >= 65536)
                                                throw new Exception ();
                                } catch {
                                        throw new ArgumentException ("Invalid port.");
                                }
-                       } else {
-                               root = uri.IndexOf ('/', start_host, length - start_host);
-                               if (root == -1)
-                                       throw new ArgumentException ("No path specified.");
                        }
 
                        if (uri [uri.Length - 1] != '/')
@@ -158,4 +161,3 @@ namespace System.Net {
        }
 }
 #endif
-
index 8294f7b43d2574ac4142bfd1dc19476032484160..69b4133226bb0834e49955797829d1a81deb5d43 100644 (file)
@@ -29,10 +29,16 @@ using System.Net;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using System.Threading;
+using ObjCRuntime;
 
 namespace Mono.Net
 {
-       internal class CFObject : IDisposable
+       internal class CFType {
+               [DllImport (CFObject.CoreFoundationLibrary, EntryPoint="CFGetTypeID")]
+               public static extern IntPtr GetTypeID (IntPtr typeRef);
+       }
+
+       internal class CFObject : IDisposable, INativeObject
        {
                public const string CoreFoundationLibrary = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation";
                const string SystemLibrary = "/usr/lib/libSystem.dylib";
@@ -51,6 +57,25 @@ namespace Mono.Net
                        return dlsym (handle, symbol);
                }
 
+               public static CFString GetStringConstant (IntPtr handle, string symbol)
+               {
+                       var indirect = dlsym (handle, symbol);
+                       if (indirect == IntPtr.Zero)
+                               return null;
+                       var actual = Marshal.ReadIntPtr (indirect);
+                       if (actual == IntPtr.Zero)
+                               return null;
+                       return new CFString (actual, false);
+               }
+
+               public static IntPtr GetIntPtr (IntPtr handle, string symbol)
+               {
+                       var indirect = dlsym (handle, symbol);
+                       if (indirect == IntPtr.Zero)
+                               return IntPtr.Zero;
+                       return Marshal.ReadIntPtr (indirect);
+               }
+
                public static IntPtr GetCFObjectHandle (IntPtr handle, string symbol)
                {
                        var indirect = dlsym (handle, symbol);
@@ -76,7 +101,7 @@ namespace Mono.Net
                public IntPtr Handle { get; private set; }
 
                [DllImport (CoreFoundationLibrary)]
-               extern static IntPtr CFRetain (IntPtr handle);
+               internal extern static IntPtr CFRetain (IntPtr handle);
 
                void Retain ()
                {
@@ -84,7 +109,7 @@ namespace Mono.Net
                }
 
                [DllImport (CoreFoundationLibrary)]
-               extern static void CFRelease (IntPtr handle);
+               internal extern static void CFRelease (IntPtr handle);
 
                void Release ()
                {
@@ -126,8 +151,22 @@ namespace Mono.Net
                                dlclose (handle);
                        }
                }
+               
+               public static CFArray FromNativeObjects (params INativeObject[] values)
+               {
+                       return new CFArray (Create (values), true);
+               }
+
+               public static unsafe IntPtr Create (params IntPtr[] values)
+               {
+                       if (values == null)
+                               throw new ArgumentNullException ("values");
+                       fixed (IntPtr* pv = values) {
+                               return CFArrayCreate (IntPtr.Zero, (IntPtr) pv, (IntPtr)values.Length, kCFTypeArrayCallbacks);
+                       }
+               }
 
-               static unsafe CFArray Create (params IntPtr[] values)
+               internal static unsafe CFArray CreateArray (params IntPtr[] values)
                {
                        if (values == null)
                                throw new ArgumentNullException ("values");
@@ -138,16 +177,19 @@ namespace Mono.Net
                                return new CFArray (handle, false);
                        }
                }
+               
+               public static CFArray CreateArray (params INativeObject[] values)
+               {
+                       return new CFArray (Create (values), true);
+               }
 
-               public static CFArray Create (params CFObject[] values)
+               public static IntPtr Create (params INativeObject[] values)
                {
                        if (values == null)
                                throw new ArgumentNullException ("values");
-
                        IntPtr[] _values = new IntPtr [values.Length];
-                       for (int i = 0; i < _values.Length; i++)
-                               _values[i] = values[i].Handle;
-
+                       for (int i = 0; i < _values.Length; ++i)
+                               _values [i] = values [i].Handle;
                        return Create (_values);
                }
 
@@ -166,6 +208,20 @@ namespace Mono.Net
                                return CFArrayGetValueAtIndex (Handle, (IntPtr) index);
                        }
                }
+               
+               static public T [] ArrayFromHandle<T> (IntPtr handle, Func<IntPtr, T> creation) where T : class, INativeObject
+               {
+                       if (handle == IntPtr.Zero)
+                               return null;
+
+                       var c = CFArrayGetCount (handle);
+                       T [] ret = new T [(int)c];
+
+                       for (uint i = 0; i < (uint)c; i++) {
+                               ret [i] = creation (CFArrayGetValueAtIndex (handle, (IntPtr)i));
+                       }
+                       return ret;
+               }
        }
 
        internal class CFNumber : CFObject
@@ -209,6 +265,15 @@ namespace Mono.Net
 
                        return value;
                }
+               
+               [DllImport (CoreFoundationLibrary)]
+               extern static IntPtr CFNumberCreate (IntPtr allocator, IntPtr theType, IntPtr valuePtr);        
+
+               public static CFNumber FromInt32 (int number)
+               {
+                       // 9 == kCFNumberIntType == C int
+                       return new CFNumber (CFNumberCreate (IntPtr.Zero, (IntPtr)9, (IntPtr)number), true);
+               }
 
                public static implicit operator int (CFNumber number)
                {
@@ -328,13 +393,105 @@ namespace Mono.Net
                }
        }
 
+       
+       internal class CFData : CFObject
+       {
+               public CFData (IntPtr handle, bool own) : base (handle, own) { }
+       
+               [DllImport (CoreFoundationLibrary)]
+               extern static /* CFDataRef */ IntPtr CFDataCreate (/* CFAllocatorRef */ IntPtr allocator, /* UInt8* */ IntPtr bytes, /* CFIndex */ IntPtr length);
+               public unsafe static CFData FromData (byte [] buffer)
+               {
+                       fixed (byte* p = buffer)
+                       {
+                               return FromData ((IntPtr)p, (IntPtr)buffer.Length);
+                       }
+               }
+
+               public static CFData FromData (IntPtr buffer, IntPtr length)
+               {
+                       return new CFData (CFDataCreate (IntPtr.Zero, buffer, length), true);
+               }
+               
+               public IntPtr Length {
+                       get { return CFDataGetLength (Handle); }
+               }
+
+               [DllImport (CoreFoundationLibrary)]
+               extern static /* CFIndex */ IntPtr CFDataGetLength (/* CFDataRef */ IntPtr theData);
+
+               [DllImport (CoreFoundationLibrary)]
+               extern static /* UInt8* */ IntPtr CFDataGetBytePtr (/* CFDataRef */ IntPtr theData);
+
+               /*
+                * Exposes a read-only pointer to the underlying storage.
+                */
+               public IntPtr Bytes {
+                       get { return CFDataGetBytePtr (Handle); }
+               }
+
+               public byte this [long idx] {
+                       get {
+                               if (idx < 0 || (ulong) idx > (ulong) Length)
+                                       throw new ArgumentException ("idx");
+                               return Marshal.ReadByte (new IntPtr (Bytes.ToInt64 () + idx));
+                       }
+
+                       set {
+                               throw new NotImplementedException ("NSData arrays can not be modified, use an NSMutableData instead");
+                       }
+               }
+
+       }
+
        internal class CFDictionary : CFObject
        {
+               static readonly IntPtr KeyCallbacks;
+               static readonly IntPtr ValueCallbacks;
+               
+               static CFDictionary ()
+               {
+                       var handle = dlopen (CoreFoundationLibrary, 0);
+                       if (handle == IntPtr.Zero)
+                               return;
+
+                       try {           
+                               KeyCallbacks = GetIndirect (handle, "kCFTypeDictionaryKeyCallBacks");
+                               ValueCallbacks = GetIndirect (handle, "kCFTypeDictionaryValueCallBacks");
+                       } finally {
+                               dlclose (handle);
+                       }
+               }
+
                public CFDictionary (IntPtr handle, bool own) : base (handle, own) { }
 
+               public static CFDictionary FromObjectAndKey (IntPtr obj, IntPtr key)
+               {
+                       return new CFDictionary (CFDictionaryCreate (IntPtr.Zero, new IntPtr[] { key }, new IntPtr [] { obj }, (IntPtr)1, KeyCallbacks, ValueCallbacks), true);
+               }
+               
+               [DllImport (CoreFoundationLibrary)]
+               extern static IntPtr CFDictionaryCreate (IntPtr allocator, IntPtr[] keys, IntPtr[] vals, IntPtr len, IntPtr keyCallbacks, IntPtr valCallbacks);
+
                [DllImport (CoreFoundationLibrary)]
                extern static IntPtr CFDictionaryGetValue (IntPtr handle, IntPtr key);
 
+               [DllImport (CoreFoundationLibrary)]
+               extern static IntPtr CFDictionaryCreateCopy (IntPtr allocator, IntPtr handle);
+
+               public CFDictionary Copy ()
+               {
+                       return new CFDictionary (CFDictionaryCreateCopy (IntPtr.Zero, Handle), true);
+               }
+               
+               public CFMutableDictionary MutableCopy ()
+               {
+                       return new CFMutableDictionary (CFDictionaryCreateMutableCopy (IntPtr.Zero, IntPtr.Zero, Handle), true);
+               }
+
+               [DllImport (CoreFoundationLibrary)]
+               extern static IntPtr CFDictionaryCreateMutableCopy (IntPtr allocator, IntPtr capacity, IntPtr theDict);
+
                public IntPtr GetValue (IntPtr key)
                {
                        return CFDictionaryGetValue (Handle, key);
@@ -346,6 +503,19 @@ namespace Mono.Net
                        }
                }
        }
+       
+       internal class CFMutableDictionary : CFDictionary
+       {
+               public CFMutableDictionary (IntPtr handle, bool own) : base (handle, own) { }
+
+               public void SetValue (IntPtr key, IntPtr val)
+               {
+                       CFDictionarySetValue (Handle, key, val);
+               }
+
+               [DllImport (CoreFoundationLibrary)]
+               extern static void CFDictionarySetValue (IntPtr handle, IntPtr key, IntPtr val);
+       }
 
        internal class CFUrl : CFObject
        {
@@ -1066,4 +1236,86 @@ namespace Mono.Net
                        return new CFWebProxy ();
                }
        }
+
+       class CFBoolean : INativeObject, IDisposable {
+               IntPtr handle;
+
+               public static readonly CFBoolean True;
+               public static readonly CFBoolean False;
+
+               static CFBoolean ()
+               {
+                       var handle = CFObject.dlopen (CFObject.CoreFoundationLibrary, 0);
+                       if (handle == IntPtr.Zero)
+                               return;
+                       try {
+                               True  = new CFBoolean (CFObject.dlsym (handle, "kCFBooleanTrue"), false);
+                               False = new CFBoolean (CFObject.dlsym (handle, "kCFBooleanFalse"), false);
+                       }
+                       finally {
+                               CFObject.dlclose (handle);
+                       }
+               }
+
+               internal CFBoolean (IntPtr handle, bool owns)
+               {
+                       this.handle = handle;
+                       if (!owns)
+                               CFObject.CFRetain (handle);
+               }
+
+               ~CFBoolean ()
+               {
+                       Dispose (false);
+               }
+
+               public IntPtr Handle {
+                       get {
+                               return handle;
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (handle != IntPtr.Zero){
+                               CFObject.CFRelease (handle);
+                               handle = IntPtr.Zero;
+                       }
+               }
+
+               public static implicit operator bool (CFBoolean value)
+               {
+                       return value.Value;
+               }
+
+               public static explicit operator CFBoolean (bool value)
+               {
+                       return FromBoolean (value);
+               }
+
+               public static CFBoolean FromBoolean (bool value)
+               {
+                       return value ? True : False;
+               }
+
+               [DllImport (CFObject.CoreFoundationLibrary)]
+               [return: MarshalAs (UnmanagedType.I1)]
+               extern static /* Boolean */ bool CFBooleanGetValue (/* CFBooleanRef */ IntPtr boolean);
+
+               public bool Value {
+                       get {return CFBooleanGetValue (handle);}
+               }
+
+               public static bool GetValue (IntPtr boolean)
+               {
+                       return CFBooleanGetValue (boolean);
+               }
+       }
+
 }
index ab92e6a4fb2fb3cbdbd458859bef000c6a5e5182..91b5379d8c046df5c39db4c32f7b8d6c5e1c2d28 100644 (file)
@@ -16,7 +16,7 @@ using System.ComponentModel.Design;
 using System.Globalization;
 using System.Reflection;
 using System.Runtime.InteropServices;
-#if !MOBILE && !MONOMAC
+#if !MOBILE && !MONOMAC && !XAMMAC_4_5
 using System.Drawing.Design;
 #endif
 using NUnit.Framework;
@@ -1053,7 +1053,7 @@ namespace MonoTests.System.ComponentModel
                                        return attr;
                        return null;
                }
-#if !MOBILE && !MONOMAC
+#if !MOBILE && !MONOMAC && !XAMMAC_4_5
                class GetEditor_test 
                {
                        [Editor (typeof (UIEditor), typeof (UITypeEditor))]
index 8707702ce0ec0276e14ddf4fefc927fbf40d2ccd..8f2662a26788b0a241de111dcd78e8572492636c 100644 (file)
@@ -16,7 +16,7 @@ namespace MonoTests.System.ComponentModel
        [TestFixture]
        public class ToolboxItemAttributeTests
        {
-#if !MOBILE && !MONOMAC
+#if !MOBILE && !MONOMAC && !XAMMAC_4_5
                [Test]
                public void DefaultType ()
                {
index e12f53291d208b523a3b974f70e561018a4a9ea2..50b605adae75845e1af063e2718bd2bb937a45e8 100644 (file)
@@ -287,7 +287,11 @@ namespace MonoTests.System.Configuration {
                [Test]
                public void TestSettings2_Properties ()
                {
+#if XAMMAC_4_5
+                       string expected = "MonoTests.System.Configuration.ProviderPoker, xammac_net_4_5_System_test, Version=0.0.0.0";
+#else
                        string expected = "MonoTests.System.Configuration.ProviderPoker, net_4_x_System_test, Version=0.0.0.0";
+#endif
                        Assert.AreEqual (expected, new SettingsProviderAttribute (typeof (ProviderPoker)).ProviderTypeName.Substring (0, expected.Length), "#1");
                        TestSettings2 settings = new TestSettings2 ();
 
index cb3827785af4dab4ced082075e03b608d27e1861..be41016a4d2e1325995f6ca240d2c728f152f623 100644 (file)
@@ -23,6 +23,13 @@ namespace MonoTests.System.Diagnostics
        [TestFixture]
        public class ProcessTest
        {
+               static bool RunningOnUnix {
+                       get {
+                               int p = (int)Environment.OSVersion.Platform;
+                               return ((p == 128) || (p == 4) || (p == 6));
+                       }
+               }
+
                [Test]
                public void GetProcessById_MachineName_Null ()
                {
@@ -729,13 +736,6 @@ namespace MonoTests.System.Diagnostics
                        bytesRead = stm.EndRead (ar);
                }
 
-               static bool RunningOnUnix {
-                       get {
-                               int p = (int)Environment.OSVersion.Platform;
-                               return ((p == 128) || (p == 4) || (p == 6));
-                       }
-               }
-
                public int bytesRead = -1;
 
                [Test]
index e3542c34f37428c53bfd338e59b298a0909ff60a..be4e5ad98315b2356d2922376cf81bcc2da8fd56 100644 (file)
@@ -59,6 +59,7 @@ public class SslStreamTest {
        }
 
        [Test] //bug https://bugzilla.novell.com/show_bug.cgi?id=457120
+       [Category ("MacNotWorking")] // Works but launches a prompt on 10.12 that will fail if you don't click in a few seconds
 #if FEATURE_NO_BSD_SOCKETS
        [ExpectedException (typeof (PlatformNotSupportedException))]
 #endif
index b2c8e90488c059be03460d907142b53827d3a03f..ffa7f6359e5cd5ec17d70cc0701ff96b41e6d76f 100644 (file)
@@ -286,7 +286,7 @@ namespace MonoTests.System.Net
                                WebHeaderCollection headers = resp.Headers;
                                Assert.AreEqual (6, headers.Count, "#1");
                                Assert.AreEqual ("9", headers ["Content-Length"], "#2");
-                               Assert.AreEqual ("utf-8", headers ["Content-Encoding"], "#3");
+                               Assert.AreEqual ("identity", headers ["Content-Encoding"], "#3");
                                Assert.AreEqual ("text/xml; charset=UTF-8", headers ["Content-Type"], "#4");
                                Assert.AreEqual ("Wed, 08 Jan 2003 23:11:55 GMT", headers ["Last-Modified"], "#5");
                                Assert.AreEqual ("UserID=Miguel,StoreProfile=true", headers ["Set-Cookie"], "#6");
@@ -510,7 +510,7 @@ namespace MonoTests.System.Net
                        sw.WriteLine ("HTTP/1.0 200 OK");
                        sw.WriteLine ("Server: Mono/Test");
                        sw.WriteLine ("Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT");
-                       sw.WriteLine ("Content-Encoding: " + Encoding.UTF8.WebName);
+                       sw.WriteLine ("Content-Encoding: identity");
                        sw.WriteLine ("Content-Type: text/xml; charset=UTF-8");
                        sw.WriteLine ("Content-Length: 9");
                        sw.WriteLine ("Set-Cookie: UserID=Miguel");
@@ -521,6 +521,30 @@ namespace MonoTests.System.Net
 
                        return Encoding.UTF8.GetBytes (sw.ToString ());
                }
+
+               internal static byte [] GzipResponseHandler (Socket socket)
+               {
+                       StringWriter sw = new StringWriter ();
+                       sw.NewLine = "\r\n";
+                       sw.WriteLine ("HTTP/1.0 200 OK");
+                       sw.WriteLine ("Server: Mono/Test");
+                       sw.WriteLine ("Content-Encoding: gzip");
+                       sw.WriteLine ("Content-Type: text/xml; charset=UTF-8");
+                       sw.WriteLine ();
+                       sw.Flush ();
+
+                       var gzipDummyXml = new byte[] {
+                               0x1f, 0x8b, 0x08, 0x08, 0xb6, 0xb1, 0xd3, 0x58, 0x00, 0x03, 0x74, 0x65, 0x73, 0x74, 0x67, 0x7a,
+                               0x00, 0xb3, 0x49, 0x29, 0xcd, 0xcd, 0xad, 0x54, 0xd0, 0xb7, 0x03, 0x00, 0xed, 0x55, 0x32, 0xec,
+                               0x09, 0x00, 0x00, 0x00 };
+                       var header = Encoding.UTF8.GetBytes (sw.ToString ());
+                       
+                       var response = new byte[gzipDummyXml.Length + header.Length];
+                       header.CopyTo(response, 0);
+                       gzipDummyXml.CopyTo(response, header.Length);
+
+                       return response;
+               }
        }
 
        [TestFixture]
@@ -1193,5 +1217,38 @@ namespace MonoTests.System.Net
                                }
                        }
                }
+
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void AutomaticDecompression ()
+               {
+                       IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
+                       string url = "http://" + ep.ToString () + "/test/";
+
+                       using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.GzipResponseHandler (s))) {
+                               HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
+                               req.Method = "GET";
+                               req.Timeout = 2000;
+                               req.ReadWriteTimeout = 2000;
+                               req.KeepAlive = false;
+                               req.AutomaticDecompression = DecompressionMethods.GZip;
+
+                               using (HttpWebResponse resp = (HttpWebResponse) req.GetResponse ()) {
+                                       Stream rs = resp.GetResponseStream ();
+                                       byte [] buffer = new byte [24];
+                                       try {
+                                               // read full response
+                                               Assert.AreEqual (9, rs.Read (buffer, 0, buffer.Length));
+                                               Assert.IsNull (resp.Headers[HttpRequestHeader.ContentEncoding]);
+                                       } finally {
+                                               rs.Close ();
+                                               req.Abort ();
+                                       }
+                               }
+                       }
+               }
        }
 }
index 7b90a046743566d25c58ca5cbabcd4f63b5ea73e..c53bd72e937d8003767a1524bc8bb5b3ff5327a7 100644 (file)
@@ -292,6 +292,20 @@ Mono.Btls/X509ChainImplBtls.cs
 
 Mono.Http/NtlmClient.cs
 
+Mono.AppleTls/AppleCertificateHelper.cs
+Mono.AppleTls/AppleTlsContext.cs
+Mono.AppleTls/AppleTlsProvider.cs
+Mono.AppleTls/AppleTlsStream.cs
+Mono.AppleTls/INativeObject.cs
+Mono.AppleTls/Certificate.cs
+Mono.AppleTls/ImportExport.cs
+Mono.AppleTls/Enums.cs
+Mono.AppleTls/SecureTransport.cs
+Mono.AppleTls/Policy.cs
+Mono.AppleTls/Trust.cs
+Mono.AppleTls/SslConnection.cs
+Mono.AppleTls/Items.cs
+
 Mono.Net.Security/AsyncProtocolRequest.cs
 Mono.Net.Security/CallbackHelpers.cs
 Mono.Net.Security/ChainValidationHelper.cs
index beb6f2415cf1c7c2da9e4ba40f1a04757013f3b9..fe68fff758f91170508456245fee3a8f194fabee 100644 (file)
@@ -1 +1,2 @@
 #include net_4_x_System.dll.sources
+Mono.Net.Security/MonoTlsProviderFactory.Apple.cs
index 7a765d35b5504cc6049d5d5591988d3e8da169bd..aa8356730c3f14431e7c54bfabf9c57605025634 100644 (file)
@@ -1,3 +1,4 @@
+#if MONO_FEATURE_APPLETLS
 using System;
 using System.Runtime.InteropServices;
 
@@ -108,3 +109,4 @@ namespace XamMac.CoreFoundation
                }
        }
 }
+#endif
index 19b9392fc781fcc43d1aab962c74c3f167b36d2e..0bc4d0693fd15d9c6c5921eec1672076579db399 100644 (file)
@@ -72,6 +72,14 @@ ifndef NO_CONSOLE
 LIB_MCS_FLAGS += -d:MONO_FEATURE_CONSOLE
 endif
 
+ifdef MONO_FEATURE_APPLETLS
+LIB_MCS_FLAGS += -d:MONO_FEATURE_APPLETLS
+endif
+
+ifdef ONLY_APPLETLS
+LIB_MCS_FLAGS += -d:ONLY_APPLETLS
+endif
+
 WARNING_ABOUT_DISABLED_WARNING=1635
 LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618,$(WARNING_ABOUT_DISABLED_WARNING) -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS)
 DEFAULT_REFERENCES =
index 718aadc3f374ab1ba539160635b4c594da13b2ab..63ed7a3371111b90bf3e0ce575ee8532f4208d83 100644 (file)
@@ -1,3 +1,4 @@
+#if MONO_FEATURE_APPLETLS
 using System;
 using System.Text;
 using System.Runtime.InteropServices;
@@ -197,3 +198,4 @@ namespace System.Security.Cryptography.X509Certificates
                }
        }
 }
+#endif
index 995865a3c623a43dee23dfc4b208b99acfa6b759..6c15bbb54f4788fb034f61d73be312b678227b80 100644 (file)
@@ -1,3 +1,4 @@
+#if MONO_FEATURE_APPLETLS
 using System;
 using System.Runtime.InteropServices;
 using MX = Mono.Security.X509;
@@ -7,12 +8,12 @@ namespace System.Security.Cryptography.X509Certificates
 {
        static partial class X509Helper
        {
-               public static X509CertificateImpl InitFromHandle (IntPtr handle)
+               public static X509CertificateImpl InitFromHandleApple (IntPtr handle)
                {
                        return new X509CertificateImplApple (handle, false);
                }
 
-               static X509CertificateImpl Import (byte[] rawData)
+               static X509CertificateImpl ImportApple (byte[] rawData)
                {
                        var handle = CFHelpers.CreateCertificateFromData (rawData);
                        if (handle != IntPtr.Zero)
@@ -35,3 +36,4 @@ namespace System.Security.Cryptography.X509Certificates
                }
        }
 }
+#endif
index 8bdd3db4daa29b51bf198b0379ff2b5df3b68e8d..05575d9d58c0f5632081f661ce5b7bb70f96bee6 100644 (file)
@@ -49,6 +49,55 @@ namespace System.Security.Cryptography.X509Certificates
                                Interlocked.CompareExchange (ref nativeHelper, helper, null);
                }
 
+#if MONO_FEATURE_APPLETLS
+               static bool ShouldUseAppleTls
+               {
+                       get
+                       {
+                               if (!System.Environment.IsMacOS)
+                                       return false;
+                               // MONO_TLS_PROVIDER values default or apple (not legacy or btls) and must be on MacOS
+                               var variable = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER");
+                               return string.IsNullOrEmpty (variable) || variable == "default" || variable == "apple"; // On Platform.IsMacOS default is AppleTlsProvider
+                       }
+               }
+#endif
+
+               public static X509CertificateImpl InitFromHandle (IntPtr handle)
+               {
+#if MONO_FEATURE_APPLETLS && ONLY_APPLETLS // ONLY_APPLETLS should not support any other option
+                       return InitFromHandleApple (handle);
+#elif MONOTOUCH_WATCH
+                       throw new PlatformNotSupportedException ();
+#else
+
+#if MONO_FEATURE_APPLETLS // If we support AppleTls, which is the default, and not overriding to legacy
+                       if (ShouldUseAppleTls)
+                               return InitFromHandleApple (handle);
+#endif
+#if !MOBILE
+                       return InitFromHandleCore (handle);
+#elif !MONOTOUCH && !XAMMAC
+                       throw new NotSupportedException ();
+#endif
+#endif
+               }
+
+               static X509CertificateImpl Import (byte[] rawData)
+               {
+#if MONO_FEATURE_APPLETLS && ONLY_APPLETLS // ONLY_APPLETLS should not support any other option
+                       return ImportApple (rawData);
+#elif MONOTOUCH_WATCH
+                       throw new PlatformNotSupportedException ();
+#else
+#if MONO_FEATURE_APPLETLS
+                       if (ShouldUseAppleTls)
+                               return ImportApple (rawData);
+#endif
+                       return ImportCore (rawData);
+#endif
+               }
+
 #if !MOBILE
                // typedef struct _CERT_CONTEXT {
                //      DWORD                   dwCertEncodingType;
@@ -70,7 +119,7 @@ namespace System.Security.Cryptography.X509Certificates
                // so we don't create any dependencies on Windows DLL in corlib
 
                [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
-               public static X509CertificateImpl InitFromHandle (IntPtr handle)
+               public static X509CertificateImpl InitFromHandleCore (IntPtr handle)
                {
                        // both Marshal.PtrToStructure and Marshal.Copy use LinkDemand (so they will always success from here)
                        CertificateContext cc = (CertificateContext) Marshal.PtrToStructure (handle, typeof (CertificateContext));
@@ -79,11 +128,6 @@ namespace System.Security.Cryptography.X509Certificates
                        var x509 = new MX.X509Certificate (data);
                        return new X509CertificateImplMono (x509);
                }
-#elif !MONOTOUCH && !XAMMAC
-               public static X509CertificateImpl InitFromHandle (IntPtr handle)
-               {
-                       throw new NotSupportedException ();
-               }
 #endif
 
                public static X509CertificateImpl InitFromCertificate (X509Certificate cert)
@@ -175,8 +219,7 @@ namespace System.Security.Cryptography.X509Certificates
                        return data;
                }
 
-#if !MONOTOUCH && !XAMMAC
-               static X509CertificateImpl Import (byte[] rawData)
+               static X509CertificateImpl ImportCore (byte[] rawData)
                {
                        MX.X509Certificate x509;
                        try {
@@ -193,7 +236,6 @@ namespace System.Security.Cryptography.X509Certificates
 
                        return new X509CertificateImplMono (x509);
                }
-#endif
 
                public static X509CertificateImpl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
                {
index 0fbc27d11b449808c84742888593ae4ec371f774..6a22ea1c638288ad05e8789c0d273423091ec327 100644 (file)
@@ -287,12 +287,28 @@ namespace MonoTests.System.Reflection
                class GBD_D : GBD_C { public new virtual void f () {} }
                class GBD_E : GBD_D { public override    void f () {} }
 
+               class GBD_E2 : GBD_D { }
+               class GBD_F : GBD_E { }
+
+
                [Test]
                public void GetBaseDefinition ()
                {
                        Assert.AreEqual (typeof (GBD_A), typeof (GBD_C).GetMethod ("f").GetBaseDefinition ().DeclaringType);
+                       Assert.AreEqual (typeof (GBD_A), typeof (GBD_C).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#1r");
+
                        Assert.AreEqual (typeof (GBD_D), typeof (GBD_D).GetMethod ("f").GetBaseDefinition ().DeclaringType);
+                       Assert.AreEqual (typeof (GBD_D), typeof (GBD_D).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#2r");
+
                        Assert.AreEqual (typeof (GBD_D), typeof (GBD_E).GetMethod ("f").GetBaseDefinition ().DeclaringType);
+                       Assert.AreEqual (typeof (GBD_D), typeof (GBD_E).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#3r");
+
+                       Assert.AreEqual (typeof (GBD_D), typeof (GBD_E2).GetMethod ("f").GetBaseDefinition ().DeclaringType, "#4");
+                       Assert.AreEqual (typeof (GBD_D), typeof (GBD_E2).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#4r");
+
+                       Assert.AreEqual (typeof (GBD_D), typeof (GBD_F).GetMethod ("f").GetBaseDefinition ().DeclaringType, "#5");
+                       Assert.AreEqual (typeof (GBD_D), typeof (GBD_F).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#5r");
+
                }
 
                class GenericBase<T,H> {
index efbc57018e6b942dc8260569805bb702abc1e0dd..f49cf1ac3cf7686ca80449cf64ba50532100ce92 100644 (file)
@@ -72,7 +72,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                        File.Delete("temp.b64");
                }
 
-#if !MOBILE
+#if !MOBILE && !MONOMAC
                public IntPtr GetHandleEx (byte[] certificate) 
                {
                        CertificateContext cc = new CertificateContext ();
@@ -104,11 +104,15 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                }
 
                [Test]
-#if MOBILE
+#if MOBILE || MONOMAC
                [Ignore ("This constructor always throw a NotSupportedException under MOBILE and is useless without CryptoAPI (i.e. outside Windows)")]
 #endif
                public void ConstructorIntPtr ()
                {
+                       // This test uses a certificate format that only works
+                       if (PlatformID.Win32NT != Environment.OSVersion.Platform)
+                               return;
+
                        byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
                                0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x37,0x5A,0x17,0x0D,0x39,0x37,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x36,0x5A,0x30,0x61,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x31,0x14,0x30,0x12,0x06,0x03,
                                0x55,0x04,0x0A,0x13,0x0B,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x0B,0x13,0x1E,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x70,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x5F,0x00,0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,
index 24cf2b4ccc401c577389a81e641b12a151e9de90..ee5c13285bf8fdb2210b00103954378a01435b59 100644 (file)
@@ -487,6 +487,7 @@ public void Certificate6 ()
 // Certificate: basic\BADCERT.cer
 // - Bad certificate (will throw an exception)
 [Test]
+[Category ("MacNotWorking")] // SecCertificateCreateWithData does different things on 10.11 vs 10.12 with invalid certificates https://bugzilla.xamarin.com/show_bug.cgi?id=53689
 public void Certificate7 ()
 {
        // cannot be loaded - will throw an exception
index 8306ffa046ce5d5b8f7b2303596aa7bced1fd2a1..409f345eccbe572ee5c793c11c8f37074275c29a 100644 (file)
@@ -29,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>612,618,1635,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_CONSOLE</DefineConstants>\r
+    <DefineConstants>TRACE;INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_CONSOLE;MONO_FEATURE_APPLETLS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -37,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>612,618,1635,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_CONSOLE</DefineConstants>\r
+    <DefineConstants>INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_CONSOLE;MONO_FEATURE_APPLETLS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\mscorlib\system\unsafecharbuffer.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\version.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="CoreFoundation\CFHelpers.cs" />\r
     <Compile Include="corefx\SR.cs" />\r
     <Compile Include="corert\AddrofIntrinsics.cs" />\r
     <Compile Include="corert\Debug.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate20.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateImpl.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateImplApple.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateImplMono.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\X509Helper.Apple.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Helper.cs" />\r
     <Compile Include="System.Security.Cryptography\CryptoAPITransform.cs" />\r
     <Compile Include="System.Security.Cryptography\CryptoConfig.common.cs" />\r
index 751885d3ed085f94e25a96ac785a86431a8b4d12..33f1c83c097edfc401399168ac636af1bec8811e 100644 (file)
@@ -1690,3 +1690,7 @@ corefx/SR.cs
 ../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/OrderablePartitioner.cs
 ../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/Partitioner.cs
 ../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs
+
+System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs
+System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs
+CoreFoundation/CFHelpers.cs
diff --git a/mcs/class/legacy/Mono.Cecil/legacy_Mono.Cecil-net_4_x.csproj b/mcs/class/legacy/Mono.Cecil/legacy_Mono.Cecil-net_4_x.csproj
new file mode 100644 (file)
index 0000000..1164355
--- /dev/null
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{CF1339E8-584B-4B3D-9A93-6F4AFDAFEE66}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699</NoWarn>\r
+    <OutputPath>./../../../class/lib/net_4_x/legacy</OutputPath>\r
+    <IntermediateOutputPath>obj-legacy</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>Mono.Cecil</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+    <PropertyGroup>\r
+    <SignAssembly>true</SignAssembly>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <AssemblyOriginatorKeyFile>../../mono.snk</AssemblyOriginatorKeyFile>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;NET_3_5</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;NET_3_5</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Code.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\CodeReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\CodeWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Document.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\ExceptionHandler.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\ILProcessor.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Instruction.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\MethodBody.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\OpCode.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\OpCodes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\SequencePoint.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Symbols.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\VariableDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\VariableReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\BlobHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Buffers.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\CodedIndex.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\ElementType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\GuidHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Heap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\MetadataToken.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Row.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\StringHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\TableHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\TokenType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\UserStringHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Utilities.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\BinaryStreamReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\BinaryStreamWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ByteBuffer.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ByteBufferEqualityComparer.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\DataDirectory.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\Image.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ImageReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ImageWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\Section.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\TextMap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ArrayType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyFlags.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyHashAlgorithm.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyInfo.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyLinkedResource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyNameDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyNameReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\BaseAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\CallSite.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\CustomAttribute.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\DefaultAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EmbeddedResource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EventAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EventDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EventReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ExportedType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FieldAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FieldDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FieldReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FileAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FunctionPointerType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericInstanceMethod.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericInstanceType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericParameter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IConstantProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ICustomAttributeProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IGenericInstance.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IGenericParameterProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMarshalInfoProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMemberDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMetadataScope.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMetadataTokenProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMethodSignature.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\Import.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\LinkedResource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ManifestResourceAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MarshalInfo.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MemberDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MemberReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MetadataResolver.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MetadataSystem.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodCallingConvention.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodImplAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodReturnType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodSemanticsAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodSpecification.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\Modifiers.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ModuleDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ModuleKind.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ModuleReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\NativeType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PinnedType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PInvokeAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PInvokeInfo.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PointerType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PropertyAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PropertyDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PropertyReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ReferenceType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\Resource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\SecurityDeclaration.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\SentinelType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TargetRuntime.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeParser.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeSpecification.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeSystem.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\VariantType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Collections.Generic\Collection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Collections.Generic\ReadOnlyCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Security.Cryptography\CryptoConvert.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Security.Cryptography\CryptoService.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono\Actions.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono\Empty.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono\Funcs.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\System.Runtime.CompilerServices\ExtensionAttribute.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../System.Core/System.Core-net_4_x.csproj">\r
+      <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
+      <Name>System.Core-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
index b696582ec135c34d75a3e81c1797e576f855fd39..c65542683e2f6301392d89e79a140fa316e839a4 100644 (file)
@@ -81,8 +81,8 @@
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
+    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
index 1dc04fc82fca90f56dae1e5f258937ef1baf2e7f..29918a4739813e01ce729b78e8668966f466f80e 100644 (file)
@@ -80,8 +80,8 @@
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
+    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
     <ProjectReference Include="../../class/System.XML/System.Xml-net_4_x.csproj">\r
index 567c766e6cb5092bce1e1803a64f8e78e1647eb7..87714c727ec32ef0b225689dad8268ad8b77fb7e 100644 (file)
@@ -38,9 +38,15 @@ namespace Mono {
                static string target_host;
                static int target_port;
                static string agent;
+               static string [] script_args;
+
+               public static string [] ScriptArgs => script_args;
                
                static int Main (string [] args)
                {
+                       if (!SplitDriverAndScriptArguments (ref args, out script_args))
+                               return 1;
+
                        var cmd = new CommandLineParser (Console.Out);
                        cmd.UnknownOptionHandler += HandleExtraArguments;
 
@@ -90,6 +96,55 @@ namespace Mono {
                        return shell.Run (startup_files);
                }
 
+               static bool SplitDriverAndScriptArguments (ref string [] driver_args, out string [] script_args)
+               {
+                       // split command line arguments into two groups:
+                       // - anything before '--' or '-s' goes to the mcs driver, which may
+                       //   call back into the csharp driver for further processing
+                       // - anything after '--' or '-s' is made available to the REPL/script
+                       //   via the 'Args' global, similar to csi.
+                       // - if '-s' is used, the argument immediately following it will
+                       //   also be processed by the mcs driver (e.g. a source file)
+
+                       int driver_args_count = 0;
+                       int script_args_offset = 0;
+                       string script_file = null;
+
+                       while (driver_args_count < driver_args.Length && script_args_offset == 0) {
+                               switch (driver_args [driver_args_count]) {
+                               case "--":
+                                       script_args_offset = driver_args_count + 1;
+                                       break;
+                               case "-s":
+                                       if (driver_args_count + 1 >= driver_args.Length) {
+                                               script_args = null;
+                                               Console.Error.WriteLine ("usage is: -s SCRIPT_FILE");
+                                               return false;
+                                       }
+                                       driver_args_count++;
+                                       script_file = driver_args [driver_args_count];
+                                       script_args_offset = driver_args_count + 1;
+                                       break;
+                               default:
+                                       driver_args_count++;
+                                       break;
+                               }
+                       }
+
+                       if (script_args_offset > 0) {
+                               int script_args_count = driver_args.Length - script_args_offset;
+                               script_args = new string [script_args_count];
+                               Array.Copy (driver_args, script_args_offset, script_args, 0, script_args_count);
+                       } else
+                               script_args = Array.Empty<string> ();
+
+                       Array.Resize (ref driver_args, driver_args_count);
+                       if (script_file != null)
+                               driver_args [driver_args_count - 1] = script_file;
+
+                       return true;
+               }
+
                static int HandleExtraArguments (string [] args, int pos)
                {
                        switch (args [pos]) {
@@ -163,9 +218,13 @@ namespace Mono {
                public static new string help {
                        get {
                                return InteractiveBase.help +
-                                       "  TabAtStartCompletes      - Whether tab will complete even on empty lines\n";
+                                       "  TabAtStartCompletes      - Whether tab will complete even on empty lines\n" +
+                                       "  Args                     - Any command line arguments passed to csharp\n" +
+                                       "                             after the '--' (stop processing) argument";
                        }
                }
+
+               public static string [] Args => Driver.ScriptArgs;
        }
        
        public class CSharpShell {
index 49971281cd7852cae7af4b1efbd9c71bf534c2f4..13dc651863c7932150b51e6cfd18fc9030e65aa8 100644 (file)
@@ -72,6 +72,8 @@
     <Compile Include="..\..\..\external\linker\linker\Mono.Linker\I18nAssemblies.cs" />\r
     <Compile Include="..\..\..\external\linker\linker\Mono.Linker\IXApiVisitor.cs" />\r
     <Compile Include="..\..\..\external\linker\linker\Mono.Linker\LinkContext.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\LoadException.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\MarkException.cs" />\r
     <Compile Include="..\..\..\external\linker\linker\Mono.Linker\MethodAction.cs" />\r
     <Compile Include="..\..\..\external\linker\linker\Mono.Linker\Pipeline.cs" />\r
     <Compile Include="..\..\..\external\linker\linker\Mono.Linker\TypePreserve.cs" />\r
       <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
       <Name>System.Xml-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
+    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
index 66410e5fe69bddfb2af8f759616b3291a8797308..f0e2169f2672872ac599b557d378da842d75270b 100644 (file)
@@ -10,6 +10,8 @@
 ../../../external/linker/linker/Mono.Linker/MethodAction.cs
 ../../../external/linker/linker/Mono.Linker/XApiReader.cs
 ../../../external/linker/linker/Mono.Linker/IXApiVisitor.cs
+../../../external/linker/linker/Mono.Linker/LoadException.cs
+../../../external/linker/linker/Mono.Linker/MarkException.cs
 ../../../external/linker/linker/Mono.Linker.Steps/BaseStep.cs
 ../../../external/linker/linker/Mono.Linker.Steps/LoadReferencesStep.cs
 ../../../external/linker/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs
index e5bcb85ff16c6cfa2eed81b8113766c8a320862a..19a93b9c4f9a2adc4b2391bba1dd0b1dd07a06d6 100644 (file)
@@ -76,8 +76,8 @@
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
+    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
     <ProjectReference Include="../../class/Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj">\r
index 4bc6fa1365a42a4132704bac161c70e90fe94c2d..944e0bcc710691969c20e4d127aab9e1ca9bc04b 100644 (file)
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
+    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
     <ProjectReference Include="../../class/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib-net_4_x.csproj">\r
index 8be07f281f4171f13abb56785c77755f11caeb96..5c6e6e895ef0ea61eb001dffbb889469d7788d35 100755 (executable)
@@ -1159,7 +1159,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        Assembly a = universe.LoadFile (path);
 
                        foreach (AssemblyName an in a.GetReferencedAssemblies ()) {
-                               a = universe.Load (an.FullName);
+                               a = LoadAssembly (an.Name);
                                if (!QueueAssembly (files, a.CodeBase))
                                        return false;
                        }
index d4120d4f909008aa2b62488abf53cff63ac8c4cd..4ffaddf33b9d698cb1807a35d016f1fa66c98d4f 100644 (file)
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
+    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
     <ProjectReference Include="../../class/Mono.CompilerServices.SymbolWriter/Mono.CompilerServices.SymbolWriter-net_4_x.csproj">\r
index 3f61191b3146cbdf38a3cac5aabd935bc63152ae..43361fed57c5f12546b05ef6dd4d8c3e72c8a89e 100644 (file)
@@ -8,6 +8,20 @@
 #include <config.h>
 #include <glib.h>
 
+/*
+ * This file defines macros to compute sizes/alignments/field offsets which depend on
+ * the ABI. It is needed during cross compiling since the generated code needs to
+ * contain offsets which correspond to the ABI of the target, not the host.
+ * It defines the following macros:
+ * - MONO_ABI_SIZEOF(type) for every basic type
+ * - MONO_ABI_ALIGNOF(type) for every basic type
+ * - MONO_STRUCT_OFFSET(struct, field) for various runtime structures
+ * When not cross compiling, these correspond to the host ABI (i.e. sizeof/offsetof).
+ * When cross compiling, these are defined in a generated header file which is
+ * generated by the offsets tool in tools/offsets-tool. The name of the file
+ * is given by the --with-cross-offsets= configure argument.
+ */
+
 #define MONO_ABI_ALIGNOF(type) MONO_ALIGN_ ## type
 #define MONO_CURRENT_ABI_ALIGNOF_TYPEDEF(type) typedef struct { char c; type x; } Mono_Align_Struct_ ##type;
 #define MONO_CURRENT_ABI_ALIGNOF(type) ((int)G_STRUCT_OFFSET(Mono_Align_Struct_ ##type, x))
index 2f3b7f7f27fc1a5dec9a8c1d2adb5193ed908486..9e82d04380846297cadfd2550f81f44face86260 100644 (file)
@@ -7285,10 +7285,20 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethodHandle m, gboolean def
 
        MonoMethod *base = mono_method_get_base_method (method, definition, error);
        return_val_if_nok (error, MONO_HANDLE_CAST (MonoReflectionMethod, NULL_HANDLE));
-       if (base == method)
-               return m;
-       else
-               return mono_method_get_object_handle (mono_domain_get (), base, NULL, error);
+       if (base == method) {
+               /* we want to short-circuit and return 'm' here. But we should
+                  return the same method object that
+                  mono_method_get_object_handle, below would return.  Since
+                  that call takes NULL for the reftype argument, it will take
+                  base->klass as the reflected type for the MonoMethod.  So we
+                  need to check that m also has base->klass as the reflected
+                  type. */
+               MonoReflectionTypeHandle orig_reftype = MONO_HANDLE_NEW_GET (MonoReflectionType, m, reftype);
+               MonoClass *orig_klass = mono_class_from_mono_type (MONO_HANDLE_GETVAL (orig_reftype, type));
+               if (base->klass == orig_klass)
+                       return m;
+       }
+       return mono_method_get_object_handle (mono_domain_get (), base, NULL, error);
 }
 
 ICALL_EXPORT MonoStringHandle
index 4e745ecc705415fd5156690d64d64b027259b289..b90bc76f74da9cbb449acaf19e3dbde46f50beb8 100644 (file)
@@ -535,9 +535,9 @@ load_metadata_ptrs (MonoImage *image, MonoCLIImageInfo *iinfo)
        }
 
        i = ((MonoImageLoader*)image->loader)->load_tables (image);
-       g_assert (image->heap_guid.data);
 
        if (!image->metadata_only) {
+               g_assert (image->heap_guid.data);
                g_assert (image->heap_guid.size >= 16);
 
                image->guid = mono_guid_to_string ((guint8*)image->heap_guid.data);
index 561e9968838f4a69d24e7c6eb77e273118386a88..8253059523687b8120643f7e375d60974707bf23 100644 (file)
@@ -97,6 +97,12 @@ mono_dump_metadata_offsets (void)
 void
 mono_metadata_cross_helpers_run (void);
 
+/*
+ * mono_metadata_cross_helpers_run:
+ *
+ *   Check that the offsets given by object-offsets.h match the offsets
+ * on the host. This only checks the metadata offsets.
+ */
 void
 mono_metadata_cross_helpers_run (void)
 {
index f304361d4bd4129d9996f6c2cd5891906e146e0d..07a0342f9f48734f07d624c88220025e68bf80b9 100644 (file)
@@ -1,3 +1,4 @@
+
 /*
 This is a parameterized header. It's supposed/ok to be included multiple times.
 
@@ -12,6 +13,12 @@ DECL_ALIGN2(name,alignment)
 Optional:
 USE_CROSS_COMPILE_OFFSETS - if defined, force the cross compiler offsets to be used, otherwise
        they will only be used if MONO_CROSS_COMPILE is defined
+DISABLE_METADATA_OFFSETS - Disable the definition of offsets for structures defined in metadata/.
+DISABLE_JIT_OFFSETS - Disable the definition of offsets for structures defined in mini/.
+
+The last two are needed because metadata shouldn't include JIT offsets since the structures
+are not defined, while the JIT shouldn't include metadata offsets, since some of them
+are GC specific, and the JIT needs to remain GC agnostic.
 
 Output defines:
 
@@ -51,8 +58,8 @@ DECL_SIZE(float)
 DECL_SIZE(double)
 DECL_SIZE(gpointer)
 
+// Offsets for structures defined in metadata/
 #ifndef DISABLE_METADATA_OFFSETS
-//object offsets
 DECL_OFFSET(MonoObject, vtable)
 DECL_OFFSET(MonoObject, synchronisation)
 
@@ -141,6 +148,7 @@ DECL_OFFSET(SgenThreadInfo, tlab_temp_end)
 
 #endif //DISABLE METADATA OFFSETS
 
+// Offsets for structures defined in mini/
 #ifndef DISABLE_JIT_OFFSETS
 DECL_OFFSET(MonoLMF, previous_lmf)
 
index 0a57d00bc66ddb7baf4a003e3c9b8ffb3f3056e3..41c481d41097c862b4a715f246f4fd922af40c62 100644 (file)
@@ -4830,10 +4830,12 @@ invoke_array_extract_argument (MonoArray *params, int i, MonoType *t, gboolean*
                                                *has_byref_nullables = TRUE;
                                } else {
                                        /* MS seems to create the objects if a null is passed in */
+                                       gboolean was_null = FALSE;
                                        if (!mono_array_get (params, MonoObject*, i)) {
                                                MonoObject *o = mono_object_new_checked (mono_domain_get (), mono_class_from_mono_type (t_orig), error);
                                                return_val_if_nok (error, NULL);
                                                mono_array_setref (params, i, o); 
+                                               was_null = TRUE;
                                        }
 
                                        if (t->byref) {
@@ -4851,6 +4853,8 @@ invoke_array_extract_argument (MonoArray *params, int i, MonoType *t, gboolean*
                                        }
                                                
                                        result = mono_object_unbox (mono_array_get (params, MonoObject*, i));
+                                       if (!t->byref && was_null)
+                                               mono_array_setref (params, i, NULL);
                                }
                                break;
                        case MONO_TYPE_STRING:
index 4e3b30f011541330aa48beb58265f4b6d68a9d17..5048c6ae08f76e95b3637bd8b26ec63ccc6e756f 100644 (file)
@@ -318,8 +318,6 @@ selector_thread (gpointer data)
        MonoError error;
        MonoGHashTable *states;
 
-       io_selector_running = TRUE;
-
        if (mono_runtime_is_shutting_down ()) {
                io_selector_running = FALSE;
                return 0;
@@ -445,7 +443,12 @@ selector_thread (gpointer data)
 
        mono_g_hash_table_destroy (states);
 
+       mono_coop_mutex_lock (&threadpool_io->updates_lock);
+
        io_selector_running = FALSE;
+       mono_coop_cond_broadcast (&threadpool_io->updates_cond);
+
+       mono_coop_mutex_unlock (&threadpool_io->updates_lock);
 
        return 0;
 }
@@ -555,9 +558,15 @@ initialize (void)
        if (!threadpool_io->backend.init (threadpool_io->wakeup_pipes [0]))
                g_error ("initialize: backend->init () failed");
 
+       mono_coop_mutex_lock (&threadpool_io->updates_lock);
+
+       io_selector_running = TRUE;
+
        MonoError error;
        if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, &error))
                g_error ("initialize: mono_thread_create_internal () failed due to %s", mono_error_get_message (&error));
+
+       mono_coop_mutex_unlock (&threadpool_io->updates_lock);
 }
 
 static void
@@ -591,6 +600,11 @@ ves_icall_System_IOSelector_Add (gpointer handle, MonoIOSelectorJob *job)
 
        mono_coop_mutex_lock (&threadpool_io->updates_lock);
 
+       if (!io_selector_running) {
+               mono_coop_mutex_unlock (&threadpool_io->updates_lock);
+               return;
+       }
+
        update = update_get_new ();
        update->type = UPDATE_ADD;
        update->data.add.fd = GPOINTER_TO_INT (handle);
@@ -618,6 +632,11 @@ mono_threadpool_io_remove_socket (int fd)
 
        mono_coop_mutex_lock (&threadpool_io->updates_lock);
 
+       if (!io_selector_running) {
+               mono_coop_mutex_unlock (&threadpool_io->updates_lock);
+               return;
+       }
+
        update = update_get_new ();
        update->type = UPDATE_REMOVE_SOCKET;
        update->data.add.fd = fd;
@@ -640,6 +659,11 @@ mono_threadpool_io_remove_domain_jobs (MonoDomain *domain)
 
        mono_coop_mutex_lock (&threadpool_io->updates_lock);
 
+       if (!io_selector_running) {
+               mono_coop_mutex_unlock (&threadpool_io->updates_lock);
+               return;
+       }
+
        update = update_get_new ();
        update->type = UPDATE_REMOVE_DOMAIN;
        update->data.remove_domain.domain = domain;
index cda335d25a69471d6ef9d5a5114f3cda884f9f27..253cc30358512404940b5d37925f67f0d50dc72c 100644 (file)
@@ -554,7 +554,7 @@ static gint
 get_errno_from_g_file_error (gint error)
 {
        switch (error) {
-#ifdef EACCESS
+#ifdef EACCES
        case G_FILE_ERROR_ACCES: return EACCES;
 #endif
 #ifdef ENAMETOOLONG
@@ -611,7 +611,7 @@ get_errno_from_g_file_error (gint error)
 #ifdef EINTR
        case G_FILE_ERROR_INTR: return EINTR;
 #endif
-#ifdef EWIO
+#ifdef EIO
        case G_FILE_ERROR_IO: return EIO;
 #endif
 #ifdef EPERM
index 28e04d6d6288388a8ca141a481b7262cd1b7ea5a..6c6ead8c4d2e204cd451f913386fccb891100e0f 100644 (file)
@@ -44,6 +44,12 @@ mono_dump_jit_offsets (void)
 #endif
 }
 
+/*
+ * mono_cross_helpers_run:
+ *
+ *   Check that the offsets given by object-offsets.h match the offsets
+ * on the host.
+ */
 void
 mono_cross_helpers_run (void)
 {
@@ -59,6 +65,7 @@ mono_cross_helpers_run (void)
 #if defined (HAS_CROSS_COMPILER_OFFSETS) && !defined (MONO_CROSS_COMPILE)
        mono_metadata_cross_helpers_run ();
 
+       /* The metadata offsets are already checked above */
 #define DISABLE_METADATA_OFFSETS
 #define USE_CROSS_COMPILE_OFFSETS
 #define DECL_OFFSET(struct,field) this_should_not_happen_for_cross_fields
index a9f727f9296a779de712399b25b78862aecd9dc2..23fec490693ff134df0462fe9125fc60160bbd86 100644 (file)
@@ -265,4 +265,18 @@ class Tests
                return 0;
        }
 
+       private static void method_invoke_no_modify_by_value_arg_helper (int dummy)
+    {
+    }
+
+    public static int test_0_method_invoke_no_modify_by_value_arg ()
+    {
+        var args = new object[] { null };
+        var method = typeof (Tests).GetMethod ("method_invoke_no_modify_by_value_arg_helper", BindingFlags.NonPublic | BindingFlags.Static);
+        method.Invoke (null, args);
+        if (args[0] == null)
+            return 0;
+        else
+            return 1;
+    }
 }
index dda2aafb936f4316201d8370105732c4e27df78e..35e07dde01621005a0bca0ad8b5feda74c7d443e 100644 (file)
     </project>
     <project dir="class/Mono.Cecil" library="Mono.Cecil-basic">
       <boot>true</boot>
-      <flags>/codepage:65001 /nologo /noconfig -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -d:BOOTSTRAP_BASIC -nowarn:1699 -nostdlib -r:./../../class/lib/basic/mscorlib.dll -optimize -keyfile:../mono.snk -d:NET_4_0 /publicsign -r:./../../class/lib/basic/System.Core.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -d:BOOTSTRAP_BASIC -nowarn:1699 -nostdlib -r:./../../class/lib/basic/mscorlib.dll -optimize -keyfile:../mono.snk -d:NET_4_0 /publicsign -r:./../../class/lib/basic/System.Core.dll -r:./../../class/lib/basic/System.dll</flags>
       <output>Mono.Cecil.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/Mono.Cecil.dll</library_output>
     </project>
     <project dir="class/Mono.Cecil" library="Mono.Cecil-build">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize -keyfile:../mono.snk -d:NET_4_0 /publicsign -r:./../../class/lib/build/System.Core.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize -keyfile:../mono.snk -d:NET_4_0 /publicsign -r:./../../class/lib/build/System.Core.dll -r:./../../class/lib/build/System.dll</flags>
       <output>Mono.Cecil.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/Mono.Cecil.dll</library_output>
     </project>
     <project dir="class/corlib" library="corlib-net_4_x">
       <boot>true</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib /debug:portable -optimize -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin -runtimemetadataversion:v4.0.30319 -d:MONO_FEATURE_CONSOLE</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib /debug:portable -optimize -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin -runtimemetadataversion:v4.0.30319 -d:MONO_FEATURE_CONSOLE -d:MONO_FEATURE_APPLETLS</flags>
       <output>mscorlib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mscorlib.dll</library_output>
     </project>
     <project dir="class/System" library="System-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -nowarn:436 -d:CODEDOM -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -nowarn:436 -d:CODEDOM -d:MONO_FEATURE_APPLETLS -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.dll</library_output>
     </project>
     <project dir="class/System" library="System-bare-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -nowarn:436 -d:CODEDOM -d:MONO_FEATURE_BTLS</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -nowarn:436 -d:CODEDOM -d:MONO_FEATURE_APPLETLS -d:MONO_FEATURE_BTLS</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/bare/System.dll</library_output>
     </project>
     <project dir="class/System" library="System-secxml-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -nowarn:436 -d:CODEDOM -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -nowarn:436 -d:CODEDOM -d:MONO_FEATURE_APPLETLS -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/secxml/System.dll</library_output>
     </project>
     <project dir="class/Mono.Cecil" library="Mono.Cecil-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -keyfile:../../mono.snk -d:NET_3_5 /publicsign -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -keyfile:../mono.snk -d:NET_4_0 /publicsign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Mono.Cecil.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/legacy/Mono.Cecil.dll</library_output>
+      <library_output>./../../class/lib/net_4_x/Mono.Cecil.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
       <resources></resources>
       <response>System.Reflection.Context.dll.sources</response>
     </project>
-    <project dir="class/legacy/Mono.Cecil" library="Mono.Cecil-net_4_x">
+    <project dir="class/legacy/Mono.Cecil" library="legacy_Mono.Cecil-net_4_x">
       <boot>false</boot>
       <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -keyfile:../../mono.snk -d:NET_3_5 /publicsign -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>Mono.Cecil.dll</output>
index c4621b6759d9d29b8e2208bd815817de2627b39a..a40e037e8beb7816e2249e5c9341b44b3e31dc7c 100644 (file)
@@ -211,7 +211,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Http-net_4_x", "mcs/cl
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cairo-net_4_x", "mcs/class/Mono.Cairo/Mono.Cairo-net_4_x.csproj", "{D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil-net_4_x", "mcs/class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj", "{6DE38817-EC25-433A-AE58-0D30C5E6C460}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil-net_4_x", "mcs/class/Mono.Cecil/Mono.Cecil-net_4_x.csproj", "{2C0D558F-0B38-4691-967E-A910A1B995C1}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Mdb-net_4_x", "mcs/class/Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj", "{CF14D34A-F69B-47FB-A99C-D25C77198F30}"
 EndProject
@@ -305,6 +305,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Workflow.Runtime-net
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Context-net_4_x", "mcs/class/System.Reflection.Context/System.Reflection.Context-net_4_x.csproj", "{50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "legacy_Mono.Cecil-net_4_x", "mcs/class/legacy/Mono.Cecil/legacy_Mono.Cecil-net_4_x.csproj", "{CF1339E8-584B-4B3D-9A93-6F4AFDAFEE66}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Cryptography.X509Certificates-net_4_x", "mcs/class/Facades/System.Security.Cryptography.X509Certificates/Facades_System.Security.Cryptography.X509Certificates-net_4_x.csproj", "{C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.ServiceModel.Primitives-net_4_x", "mcs/class/Facades/System.ServiceModel.Primitives/Facades_System.ServiceModel.Primitives-net_4_x.csproj", "{524B10FC-880D-4131-8CAE-027BC3A68B6F}"
@@ -1099,10 +1101,10 @@ Global
                {D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}.Release|Any CPU.Build.0 = Release|Any CPU
-               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Release|Any CPU.Build.0 = Release|Any CPU
+               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Release|Any CPU.Build.0 = Release|Any CPU
                {CF14D34A-F69B-47FB-A99C-D25C77198F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {CF14D34A-F69B-47FB-A99C-D25C77198F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {CF14D34A-F69B-47FB-A99C-D25C77198F30}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1287,6 +1289,10 @@ Global
                {50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}.Release|Any CPU.Build.0 = Release|Any CPU
+               {CF1339E8-584B-4B3D-9A93-6F4AFDAFEE66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {CF1339E8-584B-4B3D-9A93-6F4AFDAFEE66}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {CF1339E8-584B-4B3D-9A93-6F4AFDAFEE66}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {CF1339E8-584B-4B3D-9A93-6F4AFDAFEE66}.Release|Any CPU.Build.0 = Release|Any CPU
                {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
index e615aef425d006ff1b3657a161234b3dd45638d2..fa2dad0cb86fdda398c11a5659c054e0ed23097a 100644 (file)
@@ -1,2 +1,2 @@
 #!/bin/sh
-exec @bindir@/mono $MONO_OPTIONS @mono_instdir@/xbuild/14.0/bin/xbuild.exe "$@"
+MONO_GC_PARAMS="nursery-size=64m,$MONO_GC_PARAMS" exec @bindir@/mono $MONO_OPTIONS @mono_instdir@/xbuild/14.0/bin/xbuild.exe "$@"