# 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])
-Subproject commit 1ab0b08ad40962d4f794f12ce042b98d2148df52
+Subproject commit 44bc86223530a07fa74ab87007cf264e53d63400
-Subproject commit e4d9784ac37b9ebf4757175c92bc7a3ec9fd867a
+Subproject commit 1bdcf6b7bfbe3b03fdaa76f6124d0d7374f08615
.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
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
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
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.
\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
.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
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.
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
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
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.
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.
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/
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); \
# -*- 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
NO_CONSOLE = yes
PROFILE_DISABLE_BTLS=1
+MONO_FEATURE_APPLETLS=1
+ONLY_APPLETLS=1
NO_MULTIPLE_APPDOMAINS=1
NO_PROCESS_START=1
NO_MONO_SECURITY=1
+MONO_FEATURE_APPLETLS=
+ONLY_APPLETLS=
# so we need a System.dll that can do that.
#NO_PROCESS_START=1
NO_MONO_SECURITY=1
+MONO_FEATURE_APPLETLS=
+ONLY_APPLETLS=
FRAMEWORK_VERSION = 4.5
XBUILD_VERSION = 4.0
+MONO_FEATURE_APPLETLS=1
NO_CONSOLE = yes
PROFILE_DISABLE_BTLS=1
+MONO_FEATURE_APPLETLS=1
+ONLY_APPLETLS=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
<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
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
<?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
<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
<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
<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
}
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))
<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
+++ /dev/null
-namespace Mono.Security.Interface
-{
- delegate MonoTlsProvider MonoTlsProviderFactoryDelegate ();
-
- static partial class MonoTlsProviderFactory
- {
- internal static MonoTlsProviderFactoryDelegate _PrivateFactoryDelegate;
- }
-}
#include Mono.Security.dll.sources
../corlib/CommonCrypto/CommonCrypto.cs
../corlib/CommonCrypto/RC4CommonCrypto.cs
-Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs
CheckFileMap (level, map);
- if (locationSubPath == null)
+ if (locationSubPath == null) {
switch (level) {
case ConfigurationUserLevel.PerUserRoaming:
if (map.RoamingUserConfigFilename == null)
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 ();
}
}
using System.Security.AccessControl;
using System.Security.Permissions;
using System.Security.Principal;
+using System.IO.MemoryMappedFiles;
namespace Microsoft.Win32.SafeHandles
{
handle = preexistingHandle;
}
- [MonoTODO]
protected override bool ReleaseHandle ()
{
- throw new NotImplementedException ();
+ MemoryMapImpl.CloseMapping (handle);
+ handle = IntPtr.Zero;
+ return true;
}
}
}
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
-
namespace System.IO.MemoryMappedFiles
{
internal static class MemoryMapImpl {
}
}
-
public class MemoryMappedFile : IDisposable {
// MemoryMappedFileAccess fileAccess;
// string name;
//
FileStream stream;
bool keepOpen;
- IntPtr handle;
+ SafeMemoryMappedFileHandle handle;
public static MemoryMappedFile CreateFromFile (string path)
{
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
};
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
MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability);
return new MemoryMappedFile () {
- handle = handle,
+ handle = new SafeMemoryMappedFileHandle (handle, true),
// fileAccess = access,
// name = mapName,
// fileCapacity = capacity,
MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability);
return new MemoryMappedFile () {
- handle = handle,
+ handle = new SafeMemoryMappedFileHandle (handle, true),
// fileAccess = access,
// name = mapName,
// fileCapacity = capacity,
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
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);
}
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);
}
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;
}
}
[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");
$(wildcard Test/System.Data/schemas/*.xsd) \
Test/test-config-file \
Test/System.Data/binserialize/*.bin \
+ Test/ProviderTests/sql/*.sql \
SqliteTest.db \
corefx.common.sources
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
// 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
{
}
}
}
+
+#endif
\ No newline at end of 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 = """,
+ 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;
}
}
}
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
{
using System.Data;
using System.Data.SqlClient;
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
{
public class DataProvider
{
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");
//
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;
private EngineType type;
private int clientVersion;
- private EngineConfig ()
+ public EngineConfig ()
{
}
/// </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)
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);
}
}
}
// 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
{
// 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.Text;
using System.Xml;
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected
{
class ProviderTestsConfigurationHandler : IConfigurationSectionHandler
{
}
}
}
+
+#endif
\ No newline at end of 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
{
[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]
}
[Test]
+ [Category("NotWorking")]
public void GetChars_Reader_NoData ()
{
//Console.WriteLine ("GetChars_Reader_NoData - first_executereader");
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");
}
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");
}
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;
[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;
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)
}
[Test]
+ [Category("NotWorking")]
public void GetBytes_DataIndex_Overflow ()
{
cmd.CommandText = "SELECT type_blob FROM binary_family where id = 2";
}
[Test]
+ [Category("NotWorking")]
public void GetValues_Reader_Closed ()
{
//Console.WriteLine ("GetValues_Reader_Closed - first_executereader");
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");
}
}
[Test]
+ [Category("NotWorking")]
public void GetValues_Reader_NoData ()
{
//Console.WriteLine ("GetValues_Reader_NoData - first_executereader");
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");
}
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");
}
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
{
[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]
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")]
[SetUp]
public void SetUp ()
{
- conn = ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Sql.Connection;
cmd = conn.CreateCommand ();
}
{
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Close ();
}
[Test]
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");
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");
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
// 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")]
[Test]
public void GetInsertCommandTest ()
{
- OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
+ OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
OdbcCommand cmd = null;
try {
} 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 {
} 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 {
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
[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);
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);
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);
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);
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);
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);
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);
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 {
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
[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;
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
[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;
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
[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;
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
[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;
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
[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;
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
[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;
} finally {
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
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 ();
Assert.AreEqual (" ", cb.QuoteIdentifier (" ", conn), "#E11");
Assert.AreEqual ("\r", cb.QuoteIdentifier ("\r", conn), "#E12");
} finally {
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
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)");
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)");
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)");
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)");
// FIXME: Add test for ContinueUpdateOnError property
}
}
+
+#endif
\ No newline at end of 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")]
[SetUp]
public void SetUp ()
{
- conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Odbc.Connection;
cmd = conn.CreateCommand ();
}
{
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Close ();
}
[Test]
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;
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;
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;
}
}
}
+
+#endif
\ No newline at end of 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")]
[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
"#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,
3);
} finally {
DoExecuteNonQuery ((OdbcConnection) conn, "DROP TABLE odbc_ins_utf8_test");
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
}
}
}
}
+
+#endif
\ No newline at end of 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")]
[SetUp]
public void SetUp ()
{
- conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Odbc.Connection;
cmd = conn.CreateCommand ();
}
{
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Close ();
}
[Test]
Assert.AreEqual (totalsize, ret, "#C1");
}
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Odbc.CloseConnection ();
}
[Test]
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");
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");
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");
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");
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");
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");
// 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;
[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;
[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");
[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");
[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);
}
}
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_ODBC
+
using System;
using System.Text;
using System.Data;
using NUnit.Framework;
-namespace MonoTests.System.Data.Odbc
+namespace MonoTests.System.Data.Connected.Odbc
{
[TestFixture]
[Category ("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 ();
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 ();
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 ();
}
}
[Test]
public void InsertNoOverwriteTest ()
{
- OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
try {
OdbcCommand OdbcCmd = conn.CreateCommand ();
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 ();
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 ();
}
} 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 ();
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 ();
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 ();
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 ();
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 AddRangeTest ()
{
- OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
try {
OdbcCommand OdbcCmd = conn.CreateCommand ();
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 ();
}
}
[Test]
public void AddRangeParameterAlreadyContainedTest ()
{
- OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
try {
OdbcCommand OdbcCmd = conn.CreateCommand ();
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 ();
}
}
[Test]
public void AddRangeArgumentNullExceptionTest ()
{
- OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
try {
OdbcCommand OdbcCmd = conn.CreateCommand ();
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 ();
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 ();
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 ();
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 ();
}
}
[Test]
public void ContainsTest ()
{
- OdbcConnection conn = (OdbcConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ OdbcConnection conn = ConnectionManager.Instance.Odbc.Connection;
try {
OdbcCommand OdbcCmd = conn.CreateCommand ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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
// 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.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")]
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;
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;
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;
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;
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 ();
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;
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;
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 ();
}
}
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;
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 ();
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 ();
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;
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");
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");
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");
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");
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;
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");
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 {
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;
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;
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;
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");
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");
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");
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");
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");
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");
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;
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;
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;
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");
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 ();
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;
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;
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;
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;
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 ();
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 ();
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 ();
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 ();
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 ();
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;
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;
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");
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;
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 ();
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);
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 ();
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 ();
[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 ();
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 ();
}
}
}
}
}
+
+#endif
\ No newline at end of file
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")]
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")]
[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 {
{
conn.Open ();
}
+
[TearDown]
public void TearDown ()
{
- conn.Close ();
+ conn?.Close ();
}
[Test]
+ [Category("NotWorking")]
public void GetInsertCommand1 ()
{
SqlCommand cmd = null;
}
[Test]
+ [Category("NotWorking")]
public void GetInsertCommand1_Expression ()
{
SqlCommand cmd = null;
}
[Test] // GetInsertCommand (Boolean)
+ [Category("NotWorking")]
public void GetInsertCommand2 ()
{
SqlCommand cmd = null;
}
[Test] // GetUpdateCommand ()
+ [Category("NotWorking")]
public void GetUpdateCommand1 ()
{
SqlCommand cmd = null;
}
[Test] // GetUpdateCommand (Boolean)
+ [Category("NotWorking")]
public void GetUpdateCommand2 ()
{
SqlCommand cmd = null;
}
[Test]
+ [Category("NotWorking")]
public void GetUpdateCommandDBConcurrencyExceptionTest ()
{
string selectQuery = "select id, fname from employee where id = 1";
}
[Test]
+ [Category("NotWorking")]
public void GetDeleteCommandDBConcurrencyExceptionTest ()
{
string selectQuery = "select id, fname from employee where id = 1";
}
[Test] // GetDeleteCommand ()
+ [Category("NotWorking")]
public void GetDeleteCommand1 ()
{
SqlCommand cmd = null;
}
[Test] // GetDeleteCommand ()
+ [Category("NotWorking")]
public void GetDeleteCommand2 ()
{
SqlCommand cmd = null;
}
[Test]
+ [Category("NotWorking")]
public void DefaultProperties ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
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");
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)");
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)");
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)");
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)");
using NUnit.Framework;
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
{
[TestFixture]
[Category ("sqlserver")]
{
SqlConnection conn;
SqlCommand cmd;
- string connectionString = ConnectionManager.Singleton.ConnectionString;
+ string connectionString = ConnectionManager.Instance.Sql.ConnectionString;
EngineConfig engine;
static readonly decimal SMALLMONEY_MAX = 214748.3647m;
[SetUp]
public void SetUp ()
{
- engine = ConnectionManager.Singleton.Engine;
+ engine = ConnectionManager.Instance.Sql.EngineConfig;
}
[TearDown]
[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'";
}
[Test]
+ [Category("NotWorking")]
public void ExecuteScalar ()
{
conn = new SqlConnection (connectionString);
[Test]
public void ExecuteScalar_CommandText_Empty ()
{
- conn = (SqlConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Sql.Connection;
cmd = conn.CreateCommand ();
}
[Test]
+ [Category("NotWorking")]
public void ExecuteNonQuery ()
{
conn = new SqlConnection (connectionString);
}
[Test]
+ [Category("NotWorking")]
public void Prepare_Transaction_Only ()
{
SqlTransaction trans = null;
// 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
SqlParameter idParam;
SqlParameter dojParam;
- conn = (SqlConnection) ConnectionManager.Singleton.Connection;
- conn.Open ();
+ conn = ConnectionManager.Instance.Sql.Connection;
// parameters with leading '@'
try {
}
[Test] // bug #319598
+ [Category("NotWorking")]
public void LongStoredProcTest ()
{
if (ClientVersion == 7)
[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 ("
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 ();
}
}
}
[Test]
+ [Category("NotWorking")]
public void StoredProc_ParameterTest ()
{
string create_query = CREATE_TMP_SP_PARAM_TEST;
[Test]
public void OutputParamSizeTest1 ()
{
- conn = (SqlConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Sql.Connection;
cmd = new SqlCommand ();
cmd.Connection = conn;
[Test]
public void OutputParamSizeTest2 ()
{
- conn = (SqlConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Sql.Connection;
cmd = new SqlCommand ();
cmd.Connection = conn;
[Test]
public void OutputParamSizeTest3 ()
{
- conn = (SqlConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Sql.Connection;
cmd = new SqlCommand ();
cmd.Connection = conn;
[Test]
public void OutputParamSizeTest4 ()
{
- conn = (SqlConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ conn = ConnectionManager.Instance.Sql.Connection;
cmd = new SqlCommand ();
cmd.Connection = conn;
{
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";
{
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 ();
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 ();
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 ();
}
}
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 {
while (reader.Read ()) ;
} finally {
reader.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
}
}
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);
cmd = null;
}
} finally {
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
conn = null;
}
}
+ "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 ();
cmd.CommandText = create_sp;
cmd.ExecuteNonQuery ();
- cmd.CommandText = "monotest.dbo.sp_bug584833";
+ cmd.CommandText = "dbo.sp_bug584833";
cmd.CommandType = CommandType.StoredProcedure;
SqlCommandBuilder.DeriveParameters (cmd);
cmd.ExecuteNonQuery ();
cmd.Dispose ();
cmd = null;
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
conn = null;
}
+ "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 ();
cmd.ExecuteNonQuery ();
cmd.Dispose ();
cmd = null;
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
conn = null;
}
}
+ "END";
try {
- conn = (SqlConnection) ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
-
+ conn = ConnectionManager.Instance.Sql.Connection;
+
cmd = conn.CreateCommand ();
cmd.CommandText = create_tbl;
cmd.ExecuteNonQuery ();
cmd.ExecuteNonQuery ();
cmd.Dispose ();
cmd = null;
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
conn = null;
}
}
[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;
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;
}
}
using System;
using System.Text;
using System.Collections;
-
using System.Data;
using System.Data.SqlClient;
#endregion
-namespace MonoTests.System.Data.Common
+namespace MonoTests.System.Data.Connected.SqlClient
{
[TestFixture]
public class SqlConnectionStringBuilderTest
{
private SqlConnectionStringBuilder builder = null;
-
+
[Test]
public void DefaultValuestTest ()
{
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]
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]
using NUnit.Framework;
-namespace MonoTests.System.Data
+namespace MonoTests.System.Data.Connected.SqlClient
{
[TestFixture]
[Category ("sqlserver")]
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]
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 {
// 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 ();
}
[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 ();
}
[Test] // bug #443131
+ [Category("NotWorking")]
public void ClearPool ()
{
SqlConnection conn1 = new SqlConnection (connectionString);
}
[Test]
+ [Category("NotWorking")]
public void ChangePasswordTest ()
{
string tmpPassword = "modifiedbymonosqlclient";
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();
[TearDown]
public void TearDown()
{
- conn.Close();
+ conn?.Close();
}
[Test]
{
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;
}
[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";
}
[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;
}
[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;
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;
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")]
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]
}
[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 ();
}
[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 ();
}
[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 ();
da.Update(dt);
} finally {
DBHelper.ExecuteSimpleSP (conn, "sp_clean_employee_table");
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Singleton.Sql.CloseConnection ();
}
}
Assert.AreEqual (true, rowUpdating, "RowUpdating");
} finally {
DBHelper.ExecuteSimpleSP (conn, "sp_clean_employee_table");
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Singleton.Sql.CloseConnection ();
}
}
*/
[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))");
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");
}
[Test]
+ [Category("NotWorking")]
public void Fill_Test_Data ()
{
//Check if a table is created for each resultset
}
[Test]
+ [Category("NotWorking")]
public void MissingSchemaActionTest ()
{
adapter = new SqlDataAdapter (
}
[Test]
+ [Category("NotWorking")]
public void MissingMappingActionTest ()
{
adapter = new SqlDataAdapter ("select id,type_bit from numeric_family where id=1",
}
[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";
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;";
Assert.AreEqual (6, dt.Columns.Count, "#2");
} finally {
DBHelper.ExecuteSimpleSP (conn, "sp_clean_employee_table");
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
}
}
}
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 [] {
[TestFixtureSetUp]
public void init ()
{
- conn = new SqlConnection (ConnectionManager.Singleton.ConnectionString);
+ conn = new SqlConnection (ConnectionManager.Instance.Sql.ConnectionString);
cmd = conn.CreateCommand ();
sqlDataset = (new DataProvider()).GetDataSet ();
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]
}
Assert.AreEqual (false, dr.Read (), "#2");
} finally {
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
}
}
Assert.AreEqual(548967465189498, id, "#3");
}
} finally {
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
}
}
[Test]
public void GetBytes_BufferIndex_Negative ()
{
- IDbConnection conn = ConnectionManager.Singleton.Connection;
- conn.Open ();
+ var conn = ConnectionManager.Instance.Sql.Connection;
try {
IDbCommand cmd = conn.CreateCommand ();
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 ();
}
}
} 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 ();
Assert.AreEqual (5, size, "#B2");
}
} finally {
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
}
}
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 ();
}
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";
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";
[Test]
public void GetSchemaTable ()
{
- IDbConnection conn = ConnectionManager.Singleton.Connection;
- ConnectionManager.Singleton.OpenConnection ();
+ var conn = ConnectionManager.Instance.Sql.Connection;
IDbCommand cmd = null;
IDataReader reader = null;
cmd.Dispose ();
if (reader != null)
reader.Close ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Sql.CloseConnection ();
}
}
datetimeDataTable);
}
- string connectionString = ConnectionManager.Singleton.ConnectionString;
+ string connectionString = ConnectionManager.Instance.Sql.ConnectionString;
//FIXME : Add more test cases
[Test]
[TestFixture]
[Category ("sqlserver")]
+ [Category("NotWorking")]
public class SqlDataReaderSchemaTest
{
SqlConnection conn;
[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]
{
if (cmd != null)
cmd.Dispose ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Close ();
}
[Test]
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
DataRow row = schemaTable.Rows [0];
Assert.IsFalse (row.IsNull ("ProviderType"), "IsNull");
Assert.AreEqual (0, row ["ProviderType"], "Value");
- }
+ }
}
[Test]
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");
}
}
using NUnit.Framework;
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
{
[TestFixture]
[Category ("sqlserver")]
public class SqlParameterCollectionTest
- {
-
+ {
[Test]
public void CopyToTest ()
{
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");
}
-
}
}
using NUnit.Framework;
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
{
[TestFixture]
[Category ("sqlserver")]
[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]
cmd.Dispose ();
if (rdr != null)
rdr.Close ();
- ConnectionManager.Singleton.CloseConnection ();
+ ConnectionManager.Instance.Close ();
}
[Test] // bug #324840
}
[Test] // bug #382635
+ [Category("NotWorking")]
public void ParameterSize_compatibility_Test ()
{
string longstring = "abcdefghijklmnopqrstuvwxyz";
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 ();
}
using NUnit.Framework;
-namespace MonoTests.System.Data.SqlClient
+namespace MonoTests.System.Data.Connected.SqlClient
{
[TestFixture]
[Category ("sqlserver")]
[SetUp]
public void SetUp ()
{
- connectionString = ConnectionManager.Singleton.ConnectionString;
- engine = ConnectionManager.Singleton.Engine;
+ connectionString = ConnectionManager.Instance.Sql.ConnectionString;
+ engine = ConnectionManager.Instance.Sql.EngineConfig;
}
[TearDown]
// 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");
}
[Test]
+ [Ignore("Deesn't work on mono. TODO:Fix")]
public void Save_TransactionName_Null ()
{
if (RunningOnMono)
<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>
<?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>
===========================================================================================
*/
-use monotest;
-
/*
=================================== OBJECT NUMERIC_FAMILY =========================
-- TABLE : NUMERIC_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, '', '', '', '', '', '');
`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);
/*
`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');
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
-use monotest;
-
-- =================================== OBJECT NUMERIC_FAMILY============================
-- TABLE : NUMERIC_FAMILY
-- data with id > 6000 is not gaurenteed to be read-only.
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);
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'),
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', '', '', '', '', '', '');
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);
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');
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')
end
go
-grant execute on sp_get_age to monotester;
-
-- =================================== END OBJECT EMPLOYEE ============================
-- SP : sp_326182a
end
go
-grant execute on sp_326182a to monotester;
-
-- SP: sp_326182b
if exists (select name from sysobjects where
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
// 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;
}
}
}
+
+#endif
\ No newline at end of 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;
}
}
}
+
+#endif
\ No newline at end of file
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+#if !NO_ODBC
using System;
using System.Collections;
using System.Data;
}
}
}
+
+#endif
\ No newline at end of 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;
}
}
}
+
+#endif
\ No newline at end of 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;
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_ODBC
+
using System.Data.Odbc;
using NUnit.Framework;
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_ODBC
+
using System;
using System.Text;
using System.Data;
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_ODBC
+
using System;
using System.Text;
using System.Data;
}
}
+
+#endif
\ No newline at end of file
// 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
}\r
}\r
}\r
+\r
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_ODBC
+
using NUnit.Framework;
using System;
using System.Data;
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_OLEDB
+
using System.Data;
using System.Data.OleDb;
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_OLEDB
using System;
using System.Data;
using System.Data.OleDb;
}
}
}
+
+#endif
\ No newline at end of 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;
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_OLEDB
+
using System.Data.OleDb;
using NUnit.Framework;
}
}
}
+
+#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NO_OLEDB
using NUnit.Framework;
using System;
using System.Data;
}
}
}
+
+#endif
\ No newline at end of file
// 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
}\r
}\r
}\r
+\r
+#endif
\ No newline at end of file
// 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
}\r
}\r
}\r
+\r
+#endif
\ No newline at end of file
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="""
+ 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>
+++ /dev/null
-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
+++ /dev/null
-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
$(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
--- /dev/null
+/Consts.cs
void TestQueryMode_Aspx_Start (string result, TestRunItem runItem)
{
- string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><a disabled=""disabled"">First</a> <span>1</span> <a href=""/Test_QueryMode.aspx?pageNumber=2"">2</a> <a href=""/Test_QueryMode.aspx?pageNumber=3"">3</a> <a href=""/Test_QueryMode.aspx?pageNumber=4"">4</a> <a href=""/Test_QueryMode.aspx?pageNumber=5"">5</a> <a href=""/Test_QueryMode.aspx?pageNumber=6"">...</a> <a href=""/Test_QueryMode.aspx?pageNumber=10"">Last</a> </span>";
+ string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><a class=""aspNetDisabled"">First</a> <span>1</span> <a href=""/Test_QueryMode.aspx?pageNumber=2"">2</a> <a href=""/Test_QueryMode.aspx?pageNumber=3"">3</a> <a href=""/Test_QueryMode.aspx?pageNumber=4"">4</a> <a href=""/Test_QueryMode.aspx?pageNumber=5"">5</a> <a href=""/Test_QueryMode.aspx?pageNumber=6"">...</a> <a href=""/Test_QueryMode.aspx?pageNumber=10"">Last</a> </span>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
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"" /> <span>1</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01','')"">2</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">5</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </span>";
+ string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" disabled=""disabled"" /> <span>1</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01','')"">2</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">5</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </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"" /> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">1</a> <span>2</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">5</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </span>";
+ string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" /> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">1</a> <span>2</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">5</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </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"" /> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">...</a> <span>6</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">7</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">8</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">9</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">10</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </span>";
+ string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" /> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">...</a> <span>6</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">7</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">8</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl04','')"">9</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">10</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </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"" /> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">1</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01','')"">2</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a> <span>5</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </span>";
+ string originalHtml = @"<span id=""ctl00_ContentPlaceHolder1_ListView1_DataPager1""><input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl00$ctl00"" value=""First"" /> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl00','')"">1</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl01','')"">2</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl02','')"">3</a> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl03','')"">4</a> <span>5</span> <a href=""javascript:__doPostBack('ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl01$ctl05','')"">...</a> <input type=""submit"" name=""ctl00$ContentPlaceHolder1$ListView1$DataPager1$ctl02$ctl00"" value=""Last"" /> </span>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
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;
writer.Dispose ();
}
}
+
+ return failedCounter == 0;
}
static string FormatReport (StandaloneTest test)
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
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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+//
+// 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
--- /dev/null
+#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
--- /dev/null
+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;
+ }
+ }
+
+}
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
-// 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
+
// 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;
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 ();
}
}
}
}
-
+#endif
<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
<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
<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
<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
<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
<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
}
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)]
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);
}
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;
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] != '/')
}
}
#endif
-
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";
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);
public IntPtr Handle { get; private set; }
[DllImport (CoreFoundationLibrary)]
- extern static IntPtr CFRetain (IntPtr handle);
+ internal extern static IntPtr CFRetain (IntPtr handle);
void Retain ()
{
}
[DllImport (CoreFoundationLibrary)]
- extern static void CFRelease (IntPtr handle);
+ internal extern static void CFRelease (IntPtr handle);
void Release ()
{
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");
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);
}
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
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)
{
}
}
+
+ 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);
}
}
}
+
+ 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
{
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);
+ }
+ }
+
}
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;
return attr;
return null;
}
-#if !MOBILE && !MONOMAC
+#if !MOBILE && !MONOMAC && !XAMMAC_4_5
class GetEditor_test
{
[Editor (typeof (UIEditor), typeof (UITypeEditor))]
[TestFixture]
public class ToolboxItemAttributeTests
{
-#if !MOBILE && !MONOMAC
+#if !MOBILE && !MONOMAC && !XAMMAC_4_5
[Test]
public void DefaultType ()
{
[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 ();
[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 ()
{
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]
}
[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
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");
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");
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]
}
}
}
+
+
+ [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 ();
+ }
+ }
+ }
+ }
}
}
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
#include net_4_x_System.dll.sources
+Mono.Net.Security/MonoTlsProviderFactory.Apple.cs
+#if MONO_FEATURE_APPLETLS
using System;
using System.Runtime.InteropServices;
}
}
}
+#endif
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 =
+#if MONO_FEATURE_APPLETLS
using System;
using System.Text;
using System.Runtime.InteropServices;
}
}
}
+#endif
+#if MONO_FEATURE_APPLETLS
using System;
using System.Runtime.InteropServices;
using MX = Mono.Security.X509;
{
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)
}
}
}
+#endif
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;
// 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));
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)
return data;
}
-#if !MONOTOUCH && !XAMMAC
- static X509CertificateImpl Import (byte[] rawData)
+ static X509CertificateImpl ImportCore (byte[] rawData)
{
MX.X509Certificate x509;
try {
return new X509CertificateImplMono (x509);
}
-#endif
public static X509CertificateImpl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
{
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> {
File.Delete("temp.b64");
}
-#if !MOBILE
+#if !MOBILE && !MONOMAC
public IntPtr GetHandleEx (byte[] certificate)
{
CertificateContext cc = new CertificateContext ();
}
[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,
// 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
<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
<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
../../../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
--- /dev/null
+<?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
+
<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
<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
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;
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]) {
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 {
<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
../../../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
<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
<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
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;
}
<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
#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))
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
}
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);
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)
{
+
/*
This is a parameterized header. It's supposed/ok to be included multiple times.
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:
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)
#endif //DISABLE METADATA OFFSETS
+// Offsets for structures defined in mini/
#ifndef DISABLE_JIT_OFFSETS
DECL_OFFSET(MonoLMF, previous_lmf)
*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) {
}
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:
MonoError error;
MonoGHashTable *states;
- io_selector_running = TRUE;
-
if (mono_runtime_is_shutting_down ()) {
io_selector_running = FALSE;
return 0;
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;
}
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
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);
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;
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;
get_errno_from_g_file_error (gint error)
{
switch (error) {
-#ifdef EACCESS
+#ifdef EACCES
case G_FILE_ERROR_ACCES: return EACCES;
#endif
#ifdef ENAMETOOLONG
#ifdef EINTR
case G_FILE_ERROR_INTR: return EINTR;
#endif
-#ifdef EWIO
+#ifdef EIO
case G_FILE_ERROR_IO: return EIO;
#endif
#ifdef EPERM
#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)
{
#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
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;
+ }
}
</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>
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
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}"
{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
{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
#!/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 "$@"