Imported Upstream version 3.12.0

Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
Jo Shields 2015-01-13 10:44:36 +00:00
parent 8b9b85e7f5
commit 181b81b4a4
659 changed files with 12743 additions and 16300 deletions

View File

@ -494,16 +494,12 @@ Directory Roadmap
* `dis/` - CIL executable Disassembler
* `cli/` - Common code for the JIT and the interpreter.
* `io-layer/` - The I/O layer and system abstraction for
emulating the .NET IO model.
* `cil/` - Common Intermediate Representation, XML
definition of the CIL bytecodes.
* `interp/` - Interpreter for CLI executables (obsolete).
* `arch/` - Architecture specific portions.
* `man/` - Manual pages for the various Mono commands and programs.

View File

@ -26,7 +26,7 @@ i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-li
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
pic_options='-fPIC'
;;
?86-pc-cygwin*|i?86-pc-cygwin*)
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
pic_options='-DDLL_EXPORT'
;;
i?86-apple-darwin*|arm-apple-darwin*)

View File

@ -335,6 +335,9 @@
/* Define to 1 if you have the `getresuid' function. */
#undef HAVE_GETRESUID
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
/* Define to 1 if you have the `getrusage' function. */
#undef HAVE_GETRUSAGE
@ -761,6 +764,9 @@
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/sdt.h> header file. */
#undef HAVE_SYS_SDT_H

View File

@ -1 +1 @@
f98bd1e8bf7b203688329a408624ecaaf8192c9a
03ca165ce83cc7c3a8c992c897eb02312b51e7b8

View File

@ -1 +1 @@
6792b0c1cb1e40049a4610645db04eb603741561
5d9961ae1eab15d979b37b7a90e6507b7a79f51b

View File

@ -26,17 +26,8 @@ else
SGENPCFILE=
endif
if JIT_SUPPORTED
if INTERP_SUPPORTED
pkgconfig_DATA= mono.pc mono-2.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc xbuild12.pc $(SGENPCFILE)
else
pkgconfig_DATA= mono.pc mono-2.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc xbuild12.pc $(SGENPCFILE)
endif
else
pkgconfig_DATA= mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc
endif
DISTCLEANFILES= mono-2.pc mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc $(SGENPCFILE) mono-sgen-gdb.py

View File

@ -447,13 +447,9 @@ EXTRA_DIST = \
pkgconfigdir = $(libdir)/pkgconfig
@SUPPORT_SGEN_FALSE@SGENPCFILE =
@SUPPORT_SGEN_TRUE@SGENPCFILE = monosgen-2.pc
@INTERP_SUPPORTED_FALSE@@JIT_SUPPORTED_TRUE@pkgconfig_DATA = mono.pc mono-2.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
@INTERP_SUPPORTED_FALSE@@JIT_SUPPORTED_TRUE@ system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc xbuild12.pc $(SGENPCFILE)
pkgconfig_DATA = mono.pc mono-2.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc xbuild12.pc $(SGENPCFILE)
@INTERP_SUPPORTED_TRUE@@JIT_SUPPORTED_TRUE@pkgconfig_DATA = mono.pc mono-2.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
@INTERP_SUPPORTED_TRUE@@JIT_SUPPORTED_TRUE@ system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc xbuild12.pc $(SGENPCFILE)
@JIT_SUPPORTED_FALSE@pkgconfig_DATA = mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc
DISTCLEANFILES = mono-2.pc mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc $(SGENPCFILE) mono-sgen-gdb.py

View File

@ -10,7 +10,7 @@
<dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
<dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
<dllmap dll="db2cli" target="libdb2_36@libsuffix@" os="!windows"/>
<dllmap dll="MonoPosixHelper" target="@prefix@/lib/libMonoPosixHelper@libsuffix@" os="!windows" />
<dllmap dll="MonoPosixHelper" target="@prefix@/@reloc_libdir@/libMonoPosixHelper@libsuffix@" os="!windows" />
<dllmap dll="i:msvcrt" target="@LIBC@" os="!windows"/>
<dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
<dllmap dll="sqlite" target="@SQLITE@" os="!windows"/>

View File

@ -125,7 +125,7 @@ mono_class_from_name_case (MonoImage *image, const char* name_space, const char
</div>
<p />
<b>Parameters</b>
<blockquote><dt><i>image:</i></dt><dd> The MonoImage where the type is looked up in</dd><dt><i>name_space:</i></dt><dd> the type namespace</dd><dt><i>name:</i></dt><dd> the type short name.</dd></blockquote>
<blockquote><dt><i>image:</i></dt><dd> The MonoImage where the type is looked up in</dd><dt><i>name_space:</i></dt><dd> the type namespace</dd><dt><i>name:</i></dt><dd> the type short name.</dd><dt><i>deprecated:</i></dt><dd> use the _checked variant</dd></blockquote>
<b>Remarks</b>
<p />
Obtains a MonoClass with a given namespace and a given name which
@ -332,7 +332,7 @@ mono_class_get_full (MonoImage *image, guint32 type_token, MonoGenericContext *c
</div>
<p />
<b>Parameters</b>
<blockquote><dt><i>image:</i></dt><dd> the image where the class resides</dd><dt><i>type_token:</i></dt><dd> the token for the class</dd><dt><i>context:</i></dt><dd> the generic context used to evaluate generic instantiations in</dd></blockquote>
<blockquote><dt><i>image:</i></dt><dd> the image where the class resides</dd><dt><i>type_token:</i></dt><dd> the token for the class</dd><dt><i>context:</i></dt><dd> the generic context used to evaluate generic instantiations in</dd><dt><i>deprecated:</i></dt><dd> Functions that expose MonoGenericContext are going away in mono 4.0</dd></blockquote>
<b>Returns</b>
<blockquote> the MonoClass that represents <i>type_token</i> in <i>image</i>
</blockquote>

View File

@ -26,7 +26,7 @@ i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-li
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
pic_options='-fPIC'
;;
?86-pc-cygwin*|i?86-pc-cygwin*)
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
pic_options='-DDLL_EXPORT'
;;
i?86-apple-darwin*|arm-apple-darwin*)

View File

@ -12,6 +12,9 @@
/* Define to 1 if you have the `getpwuid_r' function. */
#undef HAVE_GETPWUID_R
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
@ -60,6 +63,9 @@
/* Define to 1 if you have the `strtok_r' function. */
#undef HAVE_STRTOK_R
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H

View File

@ -1 +1 @@
8efa2ac8877cc4d116d3625738612cdba7e474a4
f63e8c4f995b49470fb7c4bd1f34dac0e85ad20c

View File

@ -135,6 +135,7 @@ AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
AC_CHECK_FUNCS(getrlimit)
#
# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
@ -179,7 +180,7 @@ if test "x$have_iso_varargs" = "xyes"; then
fi
AC_SUBST(G_HAVE_ISO_VARARGS)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
AC_SUBST(HAVE_ALLOCA_H)

View File

@ -176,7 +176,6 @@ typedef struct _GMemChunk GMemChunk;
/*
* Misc.
*/
#define g_atexit(func) ((void) atexit (func))
const gchar * g_getenv(const gchar *variable);
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);

View File

@ -176,7 +176,7 @@ default_stderr_handler (const gchar *message)
}
#elif MONOTOUCH
#elif defined(HOST_IOS)
#include <asl.h>
static int

View File

@ -53,6 +53,10 @@
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#ifdef G_OS_WIN32
#include <io.h>
#include <winsock2.h>
@ -213,6 +217,23 @@ write_all (int fd, const void *vbuf, size_t n)
return nwritten;
}
#ifndef G_OS_WIN32
static int
g_getdtablesize (void)
{
#ifdef HAVE_GETRLIMIT
struct rlimit limit;
int res;
res = getrlimit (RLIMIT_NOFILE, &limit);
g_assert (res == 0);
return limit.rlim_cur;
#else
return getdtablesize ();
#endif
}
#endif
gboolean
g_spawn_command_line_sync (const gchar *command_line,
gchar **standard_output,
@ -256,7 +277,7 @@ g_spawn_command_line_sync (const gchar *command_line,
close (stderr_pipe [0]);
dup2 (stderr_pipe [1], STDERR_FILENO);
}
for (i = getdtablesize () - 1; i >= 3; i--)
for (i = g_getdtablesize () - 1; i >= 3; i--)
close (i);
/* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
@ -417,7 +438,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
}
if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
for (i = getdtablesize () - 1; i >= 3; i--)
for (i = g_getdtablesize () - 1; i >= 3; i--)
close (i);
}

View File

@ -1,6 +1,10 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
#ifndef _MSC_VER
#include "cygconfig.h"
#else
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@ -74,3 +78,4 @@
#define VERSION "0.1"
#define HAVE_STRTOK_R 1
#endif

View File

@ -26,7 +26,7 @@ i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-li
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
pic_options='-fPIC'
;;
?86-pc-cygwin*|i?86-pc-cygwin*)
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
pic_options='-DDLL_EXPORT'
;;
i?86-apple-darwin*|arm-apple-darwin*)

View File

@ -1 +1 @@
8f066765940517df1ea0554208196aab32b6b19b
2f526024d2da61894c7ed648a1207722cbb90688

View File

@ -1075,19 +1075,10 @@ first generation (of two). A larger nursery will usually speed up the
program but will obviously use more memory. The default nursery size
4 MB.
.TP
\fBmajor=\fIcollector\fR
Specifies which major collector to use. Options are `marksweep' for
the Mark&Sweep collector, `marksweep-conc' for concurrent Mark&Sweep,
`marksweep-par' for parallel Mark&Sweep, `marksweep-fixed' for
Mark&Sweep with a fixed heap, and `marksweep-fixed-par' for parallel
Mark&Sweep with a fixed heap. The Mark&Sweep collector is the default.
.TP
\fBmajor-heap-size=\fIsize\fR
Sets the size of the major heap (not including the large object space)
for the fixed-heap Mark&Sweep collector (i.e. `marksweep-fixed' and
`marksweep-fixed-par'). The size is in bytes, with optional suffixes
`k', `m' and `g' to specify kilo-, mega- and gigabytes, respectively.
The default is 512 megabytes.
\fBmajor=\fIcollector\fR Specifies which major collector to use.
Options are `marksweep' for the Mark&Sweep collector, and
`marksweep-conc' for concurrent Mark&Sweep. The non-concurrent
Mark&Sweep collector is the default.
.TP
\fBsoft-heap-limit=\fIsize\fR
Once the heap size gets larger than this size, ignore what the default
@ -1266,6 +1257,11 @@ work, Mono needs to be compiled with the BINARY_PROTOCOL define on
sgen-gc.c. You can then use this command to explore the output
.nf
sgen-grep-binprot 0x1234 0x5678 < file
.TP
\fBnursery-canaries\fR
If set, objects allocated in the nursery are suffixed with a canary (guard)
word, which is checked on each minor collection. Can be used to detect/debug
heap corruption issues.
.fi
.ne
.RE

View File

@ -12,6 +12,7 @@ monotouch_SUBDIRS := build class
monotouch_runtime_SUBDIRS := build class
xammac_SUBDIRS := build class
mobile_SUBDIRS := build class
mobile_static_SUBDIRS := build class
net_3_5_SUBDIRS := build class tools/xbuild
net_4_0_SUBDIRS := build class
net_4_5_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
@ -114,6 +115,7 @@ $(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%:
$(_boot_:%=profile-do--monotouch_runtime--%): profile-do--monotouch_runtime--%: profile-do--build--%
$(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--%
$(_boot_:%=profile-do--mobile--%): profile-do--mobile--%: profile-do--build--%
$(_boot_:%=profile-do--mobile_static--%): profile-do--mobile_static--%: profile-do--build--%
$(_boot_:%=profile-do--net_2_0--%): profile-do--net_2_0--%: profile-do--build--%
$(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--%

View File

@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "3.10.0.0";
public const string MonoVersion = "3.12.0.0";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";

View File

@ -107,7 +107,7 @@ namespace Commons.Xml.Relaxng.Rnc
public RelaxngPattern Parse (TextReader source, string baseUri, string defaultNamespace)
{
this.defaultNamespace = defaultNamespace;
this.defaultNamespace = defaultNamespace ?? string.Empty;
if (defaultNamespace != null && defaultNamespace.Length != 0)
nsmgr.AddNamespace (String.Empty, defaultNamespace);
try {

View File

@ -13,7 +13,7 @@ using System.Xml;
using Commons.Xml.Nvdl;
using NUnit.Framework;
namespace MonoTests.Commons.Xml.Nvdl
namespace MonoTests.Commons.Xml.Relaxng
{
[TestFixture]
public class NvdlValidatingReaderTests

View File

@ -95,5 +95,19 @@ start = mine";
r.Close ();
}
}
[Test]
public void SimpleDefaultNamespace ()
{
var g = RncParser.ParseRnc (new StringReader ("element e { empty }"));
var x = XmlReader.Create (new StringReader ("<e/>"));
var r = new RelaxngValidatingReader (x, g);
try {
while (!r.EOF)
r.Read ();
} finally {
r.Close ();
}
}
}
}

View File

@ -40,6 +40,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.COMException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComMemberType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComSourceInterfacesAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComInterfaceType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IStream))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STATSTG))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CriticalHandle))]

View File

@ -106,7 +106,7 @@ net_2_0_only_dirs := \
pcl_facade_dirs := Facades
mobile_dirs := \
mobile_common_dirs := \
corlib \
System \
System.Core \
@ -134,19 +134,27 @@ mobile_dirs := \
System.Net \
System.Windows \
System.Xml.Serialization \
$(pcl_facade_dirs)
monodroid_dirs := \
Mono.CompilerServices.SymbolWriter \
Mono.CSharp \
Microsoft.CSharp \
$(pcl_facade_dirs)
mobile_static_dirs := \
$(mobile_common_dirs) \
Mono.Dynamic.Interpreter
mobile_dynamic_dirs := \
$(mobile_common_dirs) \
Mono.CompilerServices.SymbolWriter \
System.Net.Http
xammac_dirs := \
Mono.CompilerServices.SymbolWriter \
Mono.CSharp \
Microsoft.CSharp \
System.Net.Http
$(mobile_dynamic_dirs)
monodroid_dirs := \
$(mobile_dynamic_dirs)
monotouch_dirs := \
$(mobile_static_dirs)
monotouch_runtime_dirs := \
corlib \
@ -155,11 +163,6 @@ monotouch_runtime_dirs := \
System.XML \
Mono.CSharp
monotouch_dirs := \
Mono.CSharp \
Microsoft.CSharp \
Mono.Dynamic.Interpreter
net_4_0_dirs := \
System.Numerics \
Microsoft.CSharp \
@ -229,12 +232,12 @@ xbuild_4_0_dirs := \
Microsoft.Build
net_2_0_SUBDIRS := $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler
monodroid_SUBDIRS := $(mobile_dirs) $(monodroid_dirs)
monotouch_SUBDIRS := $(mobile_dirs) $(monotouch_dirs)
monodroid_SUBDIRS := $(monodroid_dirs)
monotouch_SUBDIRS := $(monotouch_dirs)
monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
mobile_static_SUBDIRS := $(mobile_dirs)
mobile_SUBDIRS := $(mobile_dirs)
xammac_SUBDIRS := $(mobile_dirs) $(xammac_dirs)
mobile_static_SUBDIRS := $(mobile_static_dirs)
mobile_SUBDIRS := $(mobile_dynamic_dirs)
xammac_SUBDIRS := $(xammac_dirs)
net_3_5_SUBDIRS := $(xbuild_2_0_dirs)
net_4_0_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(xbuild_4_0_dirs)
net_4_5_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
@ -242,7 +245,7 @@ xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
include ../build/rules.make
SUBDIRS = $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_dirs) $(monotouch_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
SUBDIRS = $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
DIST_ONLY_SUBDIRS = dlr aot-compiler $(xbuild_4_0_dirs)

View File

@ -175,7 +175,7 @@ namespace System.Windows.Forms {
Rectangle text_rectangle;
Rectangle image_rectangle;
ThemeEngine.Current.CalculateButtonTextAndImageLayout (this, out text_rectangle, out image_rectangle);
ThemeEngine.Current.CalculateButtonTextAndImageLayout (pevent.Graphics, this, out text_rectangle, out image_rectangle);
// Draw our button
if (this.FlatStyle == FlatStyle.Standard)

View File

@ -1 +1 @@
f7075e8ef8f7cfbc0c67a85dbedc54b114523b38
3af4684710ade1ef9420d2e56c7319fc0e32c4cd

View File

@ -259,10 +259,18 @@ namespace System.Windows.Forms
Size retval;
int proposedWidth;
if (proposedSize.Width == 0)
proposedWidth = Int32.MaxValue;
else {
proposedWidth = proposedSize.Width;
if ((flags & TextFormatFlags.NoPadding) == 0)
proposedWidth -= 9;
}
if (dc is Graphics)
retval = (dc as Graphics).MeasureString (text, font, proposedSize.Width == 0 ? Int32.MaxValue : proposedSize.Width, sf).ToSize ();
retval = (dc as Graphics).MeasureString (text, font, proposedWidth, sf).ToSize ();
else
retval = TextRenderer.MeasureString (text, font, proposedSize.Width == 0 ? Int32.MaxValue : proposedSize.Width, sf).ToSize ();
retval = TextRenderer.MeasureString (text, font, proposedWidth, sf).ToSize ();
if (retval.Width > 0 && (flags & TextFormatFlags.NoPadding) == 0)
retval.Width += 9;

View File

@ -698,7 +698,7 @@ namespace System.Windows.Forms
#region Button
public abstract Size CalculateButtonAutoSize (Button button);
public abstract void CalculateButtonTextAndImageLayout (ButtonBase b, out Rectangle textRectangle, out Rectangle imageRectangle);
public abstract void CalculateButtonTextAndImageLayout (Graphics g, ButtonBase b, out Rectangle textRectangle, out Rectangle imageRectangle);
public abstract void DrawButton (Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle);
public abstract void DrawFlatButton (Graphics g, ButtonBase b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle);
public abstract void DrawPopupButton (Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle);

View File

@ -1 +1 @@
522dec40ec616af384bc431f1c9406aabdaec3fb
29921942b4eddbcd9cdbc0b9c29b4e12a60804a8

View File

@ -1 +1 @@
1f3af25846450af900f33b95ed551929392ee807
657a42457c9f222751c977278db272df8f1f1caf

View File

@ -1018,13 +1018,27 @@ namespace Microsoft.Build.BuildEngine
if (!StartHandlerHasExecuted)
return;
if (EventArgs is ProjectStartedEventArgs)
ConsoleLogger.ProjectFinishedHandler (Sender, finished_args as ProjectFinishedEventArgs);
else if (EventArgs is TargetStartedEventArgs)
ConsoleLogger.TargetFinishedHandler (Sender, finished_args as TargetFinishedEventArgs);
else if (EventArgs is TaskStartedEventArgs)
ConsoleLogger.TaskFinishedHandler (Sender, finished_args as TaskFinishedEventArgs);
else if (!(EventArgs is BuildStartedEventArgs))
if (EventArgs is ProjectStartedEventArgs) {
var pfa = finished_args as ProjectFinishedEventArgs;
// FIXME: BuildFinishedHandlerActual sends us BuildFinishedEventArgs via PopEvent
if (pfa == null)
return;
ConsoleLogger.ProjectFinishedHandler (Sender, pfa);
} else if (EventArgs is TargetStartedEventArgs) {
var fa = finished_args as TargetFinishedEventArgs;
// FIXME: BuildFinishedHandlerActual sends us BuildFinishedEventArgs via PopEvent
if (fa == null)
return;
ConsoleLogger.TargetFinishedHandler (Sender, fa);
} else if (EventArgs is TaskStartedEventArgs) {
// FIXME: BuildFinishedHandlerActual sends us BuildFinishedEventArgs via PopEvent
if (!(finished_args is TaskFinishedEventArgs))
return;
ConsoleLogger.TaskFinishedHandler (Sender, (TaskFinishedEventArgs) finished_args);
} else if (!(EventArgs is BuildStartedEventArgs))
throw new InvalidOperationException ("Unexpected event on the stack, type: " + EventArgs.GetType ());
}
}

View File

@ -1,12 +1,14 @@
//
// ToolTask.cs: Base class for command line tool tasks.
//
// Author:
// Authors:
// Marek Sieradzki (marek.sieradzki@gmail.com)
// Ankit Jain (jankit@novell.com)
// Marek Safar (marek.safar@gmail.com)
//
// (C) 2005 Marek Sieradzki
// Copyright 2009 Novell, Inc (http://www.novell.com)
// Copyright 2014 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@ -90,12 +92,45 @@ namespace Microsoft.Build.Utilities
return true;
}
string CreateToolPath ()
{
string tp;
if (string.IsNullOrEmpty (ToolPath)) {
tp = GenerateFullPathToTool ();
if (string.IsNullOrEmpty (tp))
return null;
//
// GenerateFullPathToTool can return path including tool name
//
if (string.IsNullOrEmpty (ToolExe))
return tp;
tp = Path.GetDirectoryName (tp);
} else {
tp = ToolPath;
}
var path = Path.Combine (tp, ToolExe);
if (!File.Exists (path)) {
if (Log != null)
Log.LogError ("Tool executable '{0}' could not be found", path);
return null;
}
return path;
}
public override bool Execute ()
{
if (SkipTaskExecution ())
return true;
exitCode = ExecuteTool (GenerateFullPathToTool (), GenerateResponseFileCommands (),
var tool_path = CreateToolPath ();
if (tool_path == null)
return false;
exitCode = ExecuteTool (tool_path, GenerateResponseFileCommands (),
GenerateCommandLineCommands ());
// HandleTaskExecutionErrors is called only if exitCode != 0
@ -289,14 +324,14 @@ namespace Microsoft.Build.Utilities
protected virtual string GenerateCommandLineCommands ()
{
return null;
return "";
}
protected abstract string GenerateFullPathToTool ();
protected virtual string GenerateResponseFileCommands ()
{
return null;
return "";
}
protected virtual string GetResponseFileSwitch (string responseFilePath)

View File

@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@ -424,6 +425,53 @@ namespace MonoTests.Microsoft.Build.Utilities {
Assert.AreEqual (a.ToolPath, "Bar", "#5");
a.ToolPath = "";
Assert.AreEqual (a.ToolPath, "", "#6");
a.Execute ();
}
[Test]
public void Execute_1 ()
{
var t = new TestExecuteToolTask ();
t.OnExecuteTool = delegate { Assert.Fail ("#1"); };
t.BuildEngine = new MockBuildEngine ();
Assert.IsFalse (t.Execute (), "result");
}
[Test]
public void Execute_2 ()
{
var t = new TestExecuteToolTask ();
t.BuildEngine = new MockBuildEngine ();
t.ToolPath = Directory.GetCurrentDirectory ();
t.ToolExe = "Makefile";
t.OnExecuteTool = (pathToTool, responseFileCommands, commandLineCommands) => {
Assert.AreEqual (Path.Combine (Directory.GetCurrentDirectory (), "Makefile"), pathToTool, "#1");
Assert.AreEqual ("", responseFileCommands, "#2");
Assert.AreEqual ("", commandLineCommands, "#3");
};
Assert.IsTrue (t.Execute (), "result");
}
[Test]
public void Execute_3 ()
{
var t = new TestExecuteToolTask ();
t.FullPathToTool = "fpt";
t.BuildEngine = new MockBuildEngine ();
t.ToolExe = "Makefile.mk";
t.OnExecuteTool = (pathToTool, responseFileCommands, commandLineCommands) => {
Assert.AreEqual ("Makefile.mk", pathToTool, "#1");
Assert.AreEqual ("", responseFileCommands, "#2");
Assert.AreEqual ("", commandLineCommands, "#3");
};
Assert.IsFalse (t.Execute (), "result");
}
}
@ -549,8 +597,85 @@ namespace MonoTests.Microsoft.Build.Utilities {
protected override string GenerateFullPathToTool ()
{
return "";
}
}
class MockBuildEngine : IBuildEngine
{
public int ColumnNumberOfTaskNode {
get {
return 0;
}
}
public bool ContinueOnError {
get {
throw new NotImplementedException ();
}
}
public int LineNumberOfTaskNode {
get {
return 0;
}
}
public string ProjectFileOfTaskNode {
get {
return "ProjectFileOfTaskNode";
}
}
public bool BuildProjectFile (string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs)
{
throw new NotImplementedException ();
}
public void LogCustomEvent (CustomBuildEventArgs e)
{
}
public void LogErrorEvent (BuildErrorEventArgs e)
{
Console.WriteLine (e.Message);
}
public void LogMessageEvent (BuildMessageEventArgs e)
{
}
public void LogWarningEvent (BuildWarningEventArgs e)
{
}
}
class TestExecuteToolTask : ToolTask
{
public Action<string, string, string> OnExecuteTool;
public string FullPathToTool;
protected override string ToolName {
get { return "TestTool.exe"; }
}
protected override bool CallHostObjectToExecute ()
{
return base.CallHostObjectToExecute ();
}
protected override string GenerateFullPathToTool ()
{
return FullPathToTool;
}
protected override int ExecuteTool (string pathToTool, string responseFileCommands, string commandLineCommands)
{
if (OnExecuteTool != null)
OnExecuteTool (pathToTool, responseFileCommands, commandLineCommands);
return 0;
}
}
}

View File

@ -6,7 +6,9 @@ LIBRARY = Mono.CSharp.dll
LIB_MCS_FLAGS = -r:System.Core.dll -r:System.Xml.dll -r:System.dll
ifeq (monotouch, $(PROFILE))
MOBILE_STATIC := $(filter mobile_static monotouch, $(PROFILE))
ifdef MOBILE_STATIC
LIB_MCS_FLAGS += -d:IOS_REFLECTION
endif

View File

@ -0,0 +1,13 @@
#include Mono.CSharp.dll.sources
../corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
../corlib/System.Reflection.Emit/FlowControl.cs
../corlib/System.Reflection.Emit/OpCode.cs
../corlib/System.Reflection.Emit/OpCodeNames.cs
../corlib/System.Reflection.Emit/OpCodes.cs
../corlib/System.Reflection.Emit/OpCodeType.cs
../corlib/System.Reflection.Emit/OperandType.cs
../corlib/System.Reflection.Emit/PEFileKinds.cs
../corlib/System.Reflection.Emit/Label.cs
../corlib/System.Reflection.Emit/MethodToken.cs
../corlib/System.Reflection.Emit/StackBehaviour.cs
monotouch.cs

View File

@ -1,13 +1,2 @@
#include Mono.CSharp.dll.sources
../corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
../corlib/System.Reflection.Emit/FlowControl.cs
../corlib/System.Reflection.Emit/OpCode.cs
../corlib/System.Reflection.Emit/OpCodeNames.cs
../corlib/System.Reflection.Emit/OpCodes.cs
../corlib/System.Reflection.Emit/OpCodeType.cs
../corlib/System.Reflection.Emit/OperandType.cs
../corlib/System.Reflection.Emit/PEFileKinds.cs
../corlib/System.Reflection.Emit/Label.cs
../corlib/System.Reflection.Emit/MethodToken.cs
../corlib/System.Reflection.Emit/StackBehaviour.cs
#include mobile_static_Mono.CSharp.dll.sources
monotouch.cs

View File

@ -41,7 +41,9 @@ using System.ComponentModel;
using System.Diagnostics;
using System.Net.Sockets;
using System.Globalization;
using System.Security;
using System.Text;
using System.Runtime.InteropServices;
namespace Mono.Data.Tds.Protocol
{
@ -1468,7 +1470,7 @@ namespace Mono.Data.Tds.Protocol
t3.Domain = this.connectionParms.DefaultDomain;
t3.Host = this.connectionParms.Hostname;
t3.Username = this.connectionParms.User;
t3.Password = this.connectionParms.Password;
t3.Password = GetPlainPassword(this.connectionParms.Password);
Comm.StartPacket (TdsPacketType.SspAuth); // 0x11
Comm.Append (t3.GetBytes ());
@ -1919,6 +1921,20 @@ namespace Mono.Data.Tds.Protocol
comm.Skip(4);
}
public static string GetPlainPassword(SecureString secPass)
{
IntPtr plainString = IntPtr.Zero;
try
{
plainString = Marshal.SecureStringToGlobalAllocUnicode(secPass);
return Marshal.PtrToStringUni(plainString);
}
finally
{
Marshal.ZeroFreeGlobalAllocUnicode(plainString);
}
}
#endregion // Private Methods
#if NET_2_0

View File

@ -29,6 +29,7 @@
//
using System;
using System.Security;
namespace Mono.Data.Tds.Protocol {
public sealed class Tds42 : Tds
@ -77,7 +78,7 @@ namespace Mono.Data.Tds.Protocol {
Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
// password (offset 62 0x3e)
tmp = Comm.Append (connectionParameters.Password, 30, pad);
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 30, pad);
Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
// hostproc (offset 93 0x5d)
@ -145,7 +146,7 @@ namespace Mono.Data.Tds.Protocol {
// remote passwords
Comm.Append (empty, 2, pad);
tmp = Comm.Append (connectionParameters.Password, 253, pad);
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 253, pad);
Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
// tds version

View File

@ -31,6 +31,7 @@
using Mono.Data.Tds;
using System;
using System.Text;
using System.Security;
namespace Mono.Data.Tds.Protocol
{
@ -118,7 +119,7 @@ namespace Mono.Data.Tds.Protocol
// password (offset 62 0x3e)
// 62-92
tmp = Comm.Append (connectionParameters.Password, 30, pad);
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 30, pad);
Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
// hostproc (offset 93 0x5d)
@ -187,7 +188,7 @@ namespace Mono.Data.Tds.Protocol
// remote passwords
// 202-457
Comm.Append (empty, 2, pad);
tmp = Comm.Append (connectionParameters.Password, 253, pad);
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 253, pad);
Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
// tds version

View File

@ -37,6 +37,7 @@
using System;
using System.Globalization;
using System.Text;
using System.Security;
using Mono.Security.Protocol.Ntlm;
@ -392,11 +393,12 @@ namespace Mono.Data.Tds.Protocol
return IsConnected;
}
private static string EncryptPassword (string pass)
private static string EncryptPassword (SecureString secPass)
{
int xormask = 0x5a5a;
int len = pass.Length;
int len = secPass.Length;
char[] chars = new char[len];
string pass = GetPlainPassword(secPass);
for (int i = 0; i < len; ++i) {
int c = ((int) (pass[i])) ^ xormask;
@ -488,6 +490,19 @@ namespace Mono.Data.Tds.Protocol
Comm.Append ((byte) 0x00); // no param meta data name
Comm.Append ((byte) 0x00); // no status flags
// Convert BigNVarChar values larger than 4000 chars to nvarchar(max)
// Need to do this here so WritePreparedParameterInfo emit the
// correct data type
foreach (TdsMetaParameter param2 in parameters) {
var colType = param2.GetMetaType ();
if (colType == TdsColumnType.BigNVarChar) {
int size = param2.GetActualSize ();
if ((size >> 1) > 4000)
param2.Size = -1;
}
}
// Write sql as a parameter value - UCS2
TdsMetaParameter param = new TdsMetaParameter ("sql",
sql.Length > 4000 ? "ntext":"nvarchar",

View File

@ -31,6 +31,7 @@
//
using System;
using System.Security;
namespace Mono.Data.Tds.Protocol
{
@ -42,7 +43,8 @@ namespace Mono.Data.Tds.Protocol
public string Hostname;
public string Language;
public string LibraryName;
public string Password;
public SecureString Password;
public bool PasswordSet;
public string ProgName;
public string User;
public bool DomainLogin;
@ -62,7 +64,8 @@ namespace Mono.Data.Tds.Protocol
Hostname = System.Net.Dns.GetHostName();
Language = String.Empty;
LibraryName = "Mono";
Password = String.Empty;
Password = new SecureString();
PasswordSet = false;
ProgName = "Mono";
User = String.Empty;
DomainLogin = false;

View File

@ -27,11 +27,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace bug4786test
namespace MonoTests.Mono.Data.Tds
{
using NUnit.Framework;
using Mono.Data.Tds.Protocol;
using global::Mono.Data.Tds.Protocol;
using System;
using System.Net;
using System.Net.Sockets;

View File

@ -155,11 +155,12 @@ namespace Mono.Debugger.Soft
[Flags]
enum InvokeFlags {
NONE = 0x0,
DISABLE_BREAKPOINTS = 0x1,
SINGLE_THREADED = 0x2,
OUT_THIS = 0x4,
OUT_ARGS = 0x8,
NONE = 0,
DISABLE_BREAKPOINTS = 1,
SINGLE_THREADED = 2,
OUT_THIS = 4,
OUT_ARGS = 8,
VIRTUAL = 16,
}
enum ElementType {
@ -416,7 +417,7 @@ namespace Mono.Debugger.Soft
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
internal const int MINOR_VERSION = 35;
internal const int MINOR_VERSION = 38;
enum WPSuspendPolicy {
NONE = 0,
@ -584,7 +585,8 @@ namespace Mono.Debugger.Soft
enum CmdStackFrame {
GET_VALUES = 1,
GET_THIS = 2,
SET_VALUES = 3
SET_VALUES = 3,
GET_DOMAIN = 4,
}
enum CmdArrayRef {
@ -2377,6 +2379,10 @@ namespace Mono.Debugger.Soft
SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.SET_VALUES, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteInt (len).WriteInts (pos).WriteValues (values));
}
internal long StackFrame_GetDomain (long thread_id, long id) {
return SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_DOMAIN, new PacketWriter ().WriteId (thread_id).WriteId (id)).ReadId ();
}
/*
* ARRAYS
*/

View File

@ -22,6 +22,11 @@ namespace Mono.Debugger.Soft
/*
* Return the values of out arguments
*/
ReturnOutArgs = 8
ReturnOutArgs = 8,
/*
* Do a virtual invoke
* Since protocol version 2.37
*/
Virtual = 16
}
}

View File

@ -307,6 +307,8 @@ namespace Mono.Debugger.Soft
f |= InvokeFlags.OUT_THIS;
if ((options & InvokeOptions.ReturnOutArgs) != 0)
f |= InvokeFlags.OUT_ARGS;
if ((options & InvokeOptions.Virtual) != 0)
f |= InvokeFlags.VIRTUAL;
InvokeAsyncResult r = new InvokeAsyncResult { AsyncState = state, AsyncWaitHandle = new ManualResetEvent (false), VM = vm, Thread = thread, Callback = callback };
thread.InvalidateFrames ();

View File

@ -7,6 +7,7 @@ namespace Mono.Debugger.Soft
public class StackFrame : Mirror
{
ThreadMirror thread;
AppDomainMirror domain;
MethodMirror method;
int il_offset;
Location location;
@ -32,6 +33,16 @@ namespace Mono.Debugger.Soft
}
}
public AppDomainMirror Domain {
get {
vm.CheckProtocolVersion (2, 38);
if (domain == null)
domain = vm.GetDomain (vm.conn.StackFrame_GetDomain (thread.Id, Id));
return domain;
}
}
public MethodMirror Method {
get {
return method;

View File

@ -22,6 +22,10 @@ public class TestsBase
static string base_static_s = "C";
#pragma warning restore 0414
#pragma warning restore 0169
public virtual string virtual_method () {
return "V1";
}
}
public enum AnEnum {
@ -1365,6 +1369,10 @@ public class Tests : TestsBase, ITest2
j = 5;
set_ip_2 ();
}
public override string virtual_method () {
return "V2";
}
}
class TypeLoadClass {

View File

@ -2137,6 +2137,11 @@ public class DebuggerTests
v = this_obj.InvokeMethod (e.Thread, m, null);
AssertValue (42, v);
// virtual call
m = t.BaseType.GetMethod ("virtual_method");
v = this_obj.InvokeMethod (e.Thread, m, null, InvokeOptions.Virtual);
AssertValue ("V2", v);
#if NET_4_5
// instance
m = t.GetMethod ("invoke_pass_ref");
@ -2864,8 +2869,10 @@ public class DebuggerTests
var frames = e.Thread.GetFrames ();
Assert.AreEqual ("invoke_in_domain", frames [0].Method.Name);
Assert.AreEqual (domain, frames [0].Domain);
Assert.AreEqual ("invoke", frames [1].Method.Name);
Assert.AreEqual ("domains", frames [2].Method.Name);
Assert.AreEqual (vm.RootDomain, frames [2].Domain);
// Test breakpoints on already JITted methods in other domains
m = entry_point.DeclaringType.GetMethod ("invoke_in_domain_2");

View File

@ -9,7 +9,9 @@ LIB_MCS_FLAGS = -r:System.dll -r:System.Core.dll \
-d:MONO_INTERPRETER \
-delaysign -keyfile:../mono.pub
ifeq (monotouch, $(subst _runtime,,$(PROFILE)))
MOBILE_STATIC := $(filter mobile_static monotouch monotouch_runtime, $(PROFILE))
ifdef MOBILE_STATIC
mono_dynamic_interpreter_deps = $(the_libdir_base)plaincore/System.Core.dll
LIB_MCS_FLAGS += -lib:$(the_libdir_base)plaincore
endif

View File

@ -39,7 +39,7 @@ using NUnit.Framework;
#if NDESK_OPTIONS
namespace Tests.NDesk.Options
#else
namespace Tests.Mono.Options
namespace MonoTests.Mono.Options
#endif
{
[TestFixture]

View File

@ -46,7 +46,7 @@ using NUnit.Framework;
#if NDESK_OPTIONS
namespace Tests.NDesk.Options
#else
namespace Tests.Mono.Options
namespace MonoTests.Mono.Options
#endif
{
class FooConverter : TypeConverter {

View File

@ -39,7 +39,7 @@ using NUnit.Framework;
#if NDESK_OPTIONS
namespace Tests.NDesk.Options
#else
namespace Tests.Mono.Options
namespace MonoTests.Mono.Options
#endif
{
class DefaultOption : Option {

View File

@ -31,7 +31,7 @@ using System;
#if NDESK_OPTIONS
namespace Tests.NDesk.Options
#else
namespace Tests.Mono.Options
namespace MonoTests.Mono.Options
#endif
{
static class Utils {

View File

@ -221,15 +221,13 @@ namespace Mono.Security.Cryptography {
string msg = Locale.GetText ("Could not create user key store '{0}'.");
throw new CryptographicException (String.Format (msg, _userPath), e);
}
if (!ProtectUser (_userPath)) {
string msg = Locale.GetText ("Could not secure user key store '{0}'.");
throw new IOException (String.Format (msg, _userPath));
}
_userPathExists = true;
}
}
if (!IsUserProtected (_userPath) && !ProtectUser (_userPath)) {
string msg = Locale.GetText ("Could not secure user key store '{0}'.");
throw new IOException (String.Format (msg, _userPath));
}
}
// is it properly protected ?
if (!IsUserProtected (_userPath)) {
@ -258,15 +256,13 @@ namespace Mono.Security.Cryptography {
string msg = Locale.GetText ("Could not create machine key store '{0}'.");
throw new CryptographicException (String.Format (msg, _machinePath), e);
}
if (!ProtectMachine (_machinePath)) {
string msg = Locale.GetText ("Could not secure machine key store '{0}'.");
throw new IOException (String.Format (msg, _machinePath));
}
_machinePathExists = true;
}
}
if (!IsMachineProtected (_machinePath) && !ProtectMachine (_machinePath)) {
string msg = Locale.GetText ("Could not secure machine key store '{0}'.");
throw new IOException (String.Format (msg, _machinePath));
}
}
// is it properly protected ?
if (!IsMachineProtected (_machinePath)) {

View File

@ -97,10 +97,26 @@ namespace Mono.Security.X509 {
// methods
public void Clear ()
{
/*
* Both _certificates and _crls extend CollectionBase, whose Clear() method calls OnClear() and
* OnClearComplete(), which should be overridden in derivative classes. So we should not worry about
* other threads that might be holding references to _certificates or _crls. They should be smart enough
* to handle this gracefully. And if not, it's their own fault.
*/
ClearCertificates ();
ClearCrls ();
}
void ClearCertificates()
{
if (_certificates != null)
_certificates.Clear ();
_certificates = null;
}
void ClearCrls ()
{
if (_crls != null)
_crls.Clear ();
_crls = null;
@ -117,6 +133,7 @@ namespace Mono.Security.X509 {
fs.Write (data, 0, data.Length);
fs.Close ();
}
ClearCertificates (); // We have modified the store on disk. So forget the old state.
}
#if !NET_2_1
// Try to save privateKey if available..
@ -141,6 +158,7 @@ namespace Mono.Security.X509 {
byte[] data = crl.RawData;
fs.Write (data, 0, data.Length);
}
ClearCrls (); // We have modified the store on disk. So forget the old state.
}
}
@ -149,6 +167,7 @@ namespace Mono.Security.X509 {
string filename = Path.Combine (_storePath, GetUniqueName (certificate));
if (File.Exists (filename)) {
File.Delete (filename);
ClearCertificates (); // We have modified the store on disk. So forget the old state.
}
}
@ -157,6 +176,7 @@ namespace Mono.Security.X509 {
string filename = Path.Combine (_storePath, GetUniqueName (crl));
if (File.Exists (filename)) {
File.Delete (filename);
ClearCrls (); // We have modified the store on disk. So forget the old state.
}
}
@ -236,8 +256,13 @@ namespace Mono.Security.X509 {
cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
KeyPairPersistence kpp = new KeyPairPersistence (cspParams);
try {
if (!kpp.Load ())
return cert;
}
catch {
return cert;
}
if (cert.RSA != null)
cert.RSA = new RSACryptoServiceProvider (cspParams);

View File

@ -12,7 +12,7 @@ CLEAN_FILES += $(STRING_MESSAGES)
EXTRA_DISTFILES = \
src/ComponentModel/Strings.resx
VALID_PROFILE := $(filter net_4_0 net_4_5 monotouch monodroid xammac mobile_static, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.ComponentModel.Composition.dll
NO_INSTALL = yes

View File

@ -18,7 +18,7 @@ endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
# This is a .NET 3.5+ assembly
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5 monotouch monodroid xammac mobile_static, $(PROFILE))
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.ComponentModel.DataAnnotations.dll
NO_INSTALL = yes

View File

@ -0,0 +1 @@
#include net_4_5_System.ComponentModel.DataAnnotations.dll.sources

View File

@ -10,17 +10,16 @@ ifneq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720
endif
ifeq (monodroid, $(PROFILE))
LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,ANDROID
endif
MOBILE_DYNAMIC := $(filter monodroid xammac mobile, $(PROFILE))
MOBILE_STATIC := $(filter mobile_static monotouch monotouch_runtime, $(PROFILE))
ifeq (xammac, $(PROFILE))
ifdef MOBILE_DYNAMIC
LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT
endif
system_core_plain_libdir = $(the_libdir_base)plaincore
ifeq (monotouch, $(subst _runtime,,$(PROFILE)))
ifdef MOBILE_STATIC
extra_test_flags := -exclude:NotWorkingInterpreter
system_core_library_deps = $(the_libdir_base)Mono.Dynamic.Interpreter.dll $(system_core_plain_libdir)/System.Core.dll
LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR

View File

@ -24,13 +24,16 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
#if INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace System
{
public sealed partial class TimeZoneInfo {
#if NET_4_0 || !INSIDE_CORLIB
public
#endif
sealed partial class TimeZoneInfo {
[SerializableAttribute]
#if MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]

View File

@ -453,29 +453,29 @@ namespace System {
: db.GetAvailableIds ();
}
static TimeZoneInfo _GetTimeZone (string name)
static TimeZoneInfo _GetTimeZone (string id, string name)
{
if (db == null)
return null;
byte[] buffer = db.GetTimeZoneData (name);
if (buffer == null)
return null;
return TimeZoneInfo.ParseTZBuffer (name, buffer, buffer.Length);
return TimeZoneInfo.ParseTZBuffer (id, buffer, buffer.Length);
}
internal static TimeZoneInfo GetTimeZone (string id)
internal static TimeZoneInfo GetTimeZone (string id, string name)
{
if (id != null) {
if (id == "GMT" || id == "UTC")
return new TimeZoneInfo (id, TimeSpan.FromSeconds (0), id, id, id, null, true);
if (id.StartsWith ("GMT"))
if (name != null) {
if (name == "GMT" || name == "UTC")
return new TimeZoneInfo (id, TimeSpan.FromSeconds (0), id, name, name, null, disableDaylightSavingTime:true);
if (name.StartsWith ("GMT"))
return new TimeZoneInfo (id,
TimeSpan.FromSeconds (ParseNumericZone (id)),
id, id, id, null, true);
TimeSpan.FromSeconds (ParseNumericZone (name)),
id, name, name, null, disableDaylightSavingTime:true);
}
try {
return _GetTimeZone (id);
return _GetTimeZone (id, name);
} catch (Exception) {
return null;
}
@ -533,12 +533,13 @@ namespace System {
static readonly object _lock = new object ();
static TimeZoneInfo defaultZone;
internal static TimeZoneInfo Default {
internal static TimeZoneInfo Local {
get {
lock (_lock) {
if (defaultZone != null)
return defaultZone;
return defaultZone = GetTimeZone (GetDefaultTimeZoneName ());
var id = GetDefaultTimeZoneName ();
return defaultZone = GetTimeZone (id, id);
}
}
}
@ -553,7 +554,10 @@ namespace System {
{
IntPtr value = IntPtr.Zero;
int n = 0;
string defaultTimeZone;
string defaultTimeZone = Environment.GetEnvironmentVariable ("__XA_OVERRIDE_TIMEZONE_ID__");
if (!string.IsNullOrEmpty (defaultTimeZone))
return defaultTimeZone;
// Used by the tests
if (Environment.GetEnvironmentVariable ("__XA_USE_JAVA_DEFAULT_TIMEZONE_ID__") == null)
@ -576,16 +580,20 @@ namespace System {
#if SELF_TEST
/*
* Compile:
* mcs /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
* mcs /debug+ /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" ../corlib/System/AndroidPlatform.cs System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
* Prep:
* mkdir -p usr/share/zoneinfo
* mkdir -p misc/zoneinfo/zoneinfo
* android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
* android_data=`adb shell echo '$ANDROID_DATA' | tr -d "\r"`
* adb pull $android_root/usr/share/zoneinfo usr/share/zoneinfo
* adb pull $android_data/misc/zoneinfo/tzdata misc/zoneinfo
* Run:
* ANDROID_ROOT=`pwd` mono tzi.exe
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe --offset=1969-01-01
*/
static void Main (string[] args)
{
DateTime? offset = null;
Func<IAndroidTimeZoneDB> c = () => GetDefaultTimeZoneDB ();
Mono.Options.OptionSet p = null;
p = new Mono.Options.OptionSet () {
@ -595,6 +603,10 @@ namespace System {
{ "Z=", "Create ZoneInfoDB from {DIR}.", v => {
c = () => new ZoneInfoDB (v);
} },
{ "offset=", "Show timezone info offset for DateTime {OFFSET}.", v => {
offset = DateTime.Parse (v);
Console.WriteLine ("Using DateTime Offset: {0}", offset);
} },
{ "help", "Show this message and exit", v => {
p.WriteOptionDescriptions (Console.Out);
Environment.Exit (0);
@ -606,9 +618,13 @@ namespace System {
foreach (var id in GetAvailableIds ()) {
Console.Write ("name={0,-40}", id);
try {
TimeZoneInfo zone = _GetTimeZone (id);
if (zone != null)
Console.Write (" {0}", zone);
TimeZoneInfo zone = _GetTimeZone (id, id);
if (zone != null) {
Console.Write (" {0,-40}", zone);
if (offset.HasValue) {
Console.Write ("From Offset: {0}", zone.GetUtcOffset (offset.Value));
}
}
else {
Console.Write (" ERROR:null");
}

View File

@ -24,7 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
#if INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
using System.Collections.Generic;
using System.Globalization;
@ -33,7 +33,10 @@ using System.Text;
namespace System
{
public partial class TimeZoneInfo
#if NET_4_0 || !INSIDE_CORLIB
public
#endif
partial class TimeZoneInfo
{
public static TimeZoneInfo FromSerializedString (string source)
{

View File

@ -24,14 +24,17 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
#if INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace System
{
public sealed partial class TimeZoneInfo
#if NET_4_0 || !INSIDE_CORLIB
public
#endif
sealed partial class TimeZoneInfo
{
[SerializableAttribute]
#if MOBILE

View File

@ -35,7 +35,7 @@ using System.Threading;
[assembly:TypeForwardedTo (typeof(TimeZoneInfo))]
#elif (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
#elif INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -57,7 +57,10 @@ namespace System
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
#endif
[SerializableAttribute]
public sealed partial class TimeZoneInfo : IEquatable<TimeZoneInfo>, ISerializable, IDeserializationCallback
#if NET_4_0 || !INSIDE_CORLIB
public
#endif
sealed partial class TimeZoneInfo : IEquatable<TimeZoneInfo>, ISerializable, IDeserializationCallback
{
TimeSpan baseUtcOffset;
public TimeSpan BaseUtcOffset {
@ -100,15 +103,31 @@ namespace System
}
}
/*
TimeZone transitions are stored when there is a change on the base offset.
*/
private List<KeyValuePair<DateTime, TimeType>> transitions;
static TimeZoneInfo CreateLocal ()
{
#if MONODROID
return AndroidTimeZones.Default;
return AndroidTimeZones.Local;
#elif MONOTOUCH
using (Stream stream = GetMonoTouchData (null)) {
return BuildFromStream ("Local", stream);
}
#elif LIBC
var tz = Environment.GetEnvironmentVariable ("TZ");
if (tz != null) {
if (tz == String.Empty)
return Utc;
try {
return FindSystemTimeZoneByFileName (tz, Path.Combine (TimeZoneDirectory, tz));
} catch {
return Utc;
}
}
try {
return FindSystemTimeZoneByFileName ("Local", "/etc/localtime");
} catch {
@ -332,8 +351,7 @@ namespace System
if (dateTime.Kind == DateTimeKind.Utc)
return dateTime;
//FIXME: do not rely on DateTime implementation !
return DateTime.SpecifyKind (dateTime.ToUniversalTime (), DateTimeKind.Utc);
return ConvertTimeToUtc (dateTime, TimeZoneInfo.Local);
}
public static DateTime ConvertTimeToUtc (DateTime dateTime, TimeZoneInfo sourceTimeZone)
@ -350,15 +368,9 @@ namespace System
if (sourceTimeZone.IsInvalidTime (dateTime))
throw new ArgumentException ("dateTime parameter is an invalid time");
if (dateTime.Kind == DateTimeKind.Utc && sourceTimeZone == TimeZoneInfo.Utc)
return dateTime;
if (dateTime.Kind == DateTimeKind.Utc)
return dateTime;
if (dateTime.Kind == DateTimeKind.Local)
return ConvertTimeToUtc (dateTime);
if (sourceTimeZone.IsAmbiguousTime (dateTime) || !sourceTimeZone.IsDaylightSavingTime (dateTime))
return DateTime.SpecifyKind (dateTime - sourceTimeZone.BaseUtcOffset, DateTimeKind.Utc);
else {
@ -414,12 +426,6 @@ namespace System
return FromRegistryKey(id, key);
}
#endif
#if MONODROID
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id);
if (timeZoneInfo == null)
throw new TimeZoneNotFoundException ();
return timeZoneInfo;
#else
// Local requires special logic that already exists in the Local property (bug #326)
if (id == "Local")
return Local;
@ -427,12 +433,16 @@ namespace System
using (Stream stream = GetMonoTouchData (id)) {
return BuildFromStream (id, stream);
}
#elif MONODROID
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id, id);
if (timeZoneInfo == null)
throw new TimeZoneNotFoundException ();
return timeZoneInfo;
#elif LIBC
string filepath = Path.Combine (TimeZoneDirectory, id);
return FindSystemTimeZoneByFileName (id, filepath);
#else
throw new NotImplementedException ();
#endif
#endif
}
@ -644,7 +654,7 @@ namespace System
#endif
#if MONODROID
foreach (string id in AndroidTimeZones.GetAvailableIds ()) {
var tz = AndroidTimeZones.GetTimeZone (id);
var tz = AndroidTimeZones.GetTimeZone (id, id);
if (tz != null)
systemTimeZones.Add (tz);
}
@ -684,13 +694,8 @@ namespace System
public TimeSpan GetUtcOffset (DateTime dateTime)
{
if (IsDaylightSavingTime (dateTime)) {
AdjustmentRule rule = GetApplicableRule (dateTime);
if (rule != null)
return BaseUtcOffset + rule.DaylightDelta;
}
return BaseUtcOffset;
bool isDST;
return GetUtcOffset (dateTime, out isDST);
}
public TimeSpan GetUtcOffset (DateTimeOffset dateTimeOffset)
@ -698,6 +703,82 @@ namespace System
throw new NotImplementedException ();
}
private TimeSpan GetUtcOffset (DateTime dateTime, out bool isDST)
{
isDST = false;
TimeZoneInfo tz = this;
if (dateTime.Kind == DateTimeKind.Utc)
tz = TimeZoneInfo.Utc;
if (dateTime.Kind == DateTimeKind.Local)
tz = TimeZoneInfo.Local;
bool isTzDst;
var tzOffset = GetUtcOffset (dateTime, tz, out isTzDst);
if (tz == this) {
isDST = isTzDst;
return tzOffset;
}
var utcTicks = dateTime.Ticks - tzOffset.Ticks;
if (utcTicks < 0 || utcTicks > DateTime.MaxValue.Ticks)
return BaseUtcOffset;
var utcDateTime = new DateTime (utcTicks, DateTimeKind.Utc);
return GetUtcOffset (utcDateTime, this, out isDST);
}
private static TimeSpan GetUtcOffset (DateTime dateTime, TimeZoneInfo tz, out bool isDST)
{
if (dateTime.Kind == DateTimeKind.Local && tz != TimeZoneInfo.Local)
throw new Exception ();
isDST = false;
if (tz == TimeZoneInfo.Utc)
return TimeSpan.Zero;
TimeSpan offset;
if (tz.TryGetTransitionOffset(dateTime, out offset, out isDST))
return offset;
if (dateTime.Kind == DateTimeKind.Utc) {
var utcRule = tz.GetApplicableRule (dateTime);
if (utcRule != null && tz.IsInDST (utcRule, dateTime)) {
isDST = true;
return tz.BaseUtcOffset + utcRule.DaylightDelta;
}
return tz.BaseUtcOffset;
}
var stdTicks = dateTime.Ticks - tz.BaseUtcOffset.Ticks;
if (stdTicks < 0 || stdTicks > DateTime.MaxValue.Ticks)
return tz.BaseUtcOffset;
var stdUtcDateTime = new DateTime (stdTicks, DateTimeKind.Utc);
var tzRule = tz.GetApplicableRule (stdUtcDateTime);
DateTime dstUtcDateTime = DateTime.MinValue;
if (tzRule != null) {
var dstTicks = stdUtcDateTime.Ticks - tzRule.DaylightDelta.Ticks;
if (dstTicks < 0 || dstTicks > DateTime.MaxValue.Ticks)
return tz.BaseUtcOffset;
dstUtcDateTime = new DateTime (dstTicks, DateTimeKind.Utc);
}
if (tzRule != null && tz.IsInDST (tzRule, stdUtcDateTime) && tz.IsInDST (tzRule, dstUtcDateTime)) {
isDST = true;
return tz.BaseUtcOffset + tzRule.DaylightDelta;
}
return tz.BaseUtcOffset;
}
public bool HasSameRules (TimeZoneInfo other)
{
if (other == null)
@ -752,6 +833,16 @@ namespace System
throw new NotImplementedException ();
}
private bool IsInDST (AdjustmentRule rule, DateTime dateTime)
{
// Check whether we're in the dateTime year's DST period
if (IsInDSTForYear (rule, dateTime, dateTime.Year))
return true;
// We might be in the dateTime previous year's DST period
return IsInDSTForYear (rule, dateTime, dateTime.Year - 1);
}
bool IsInDSTForYear (AdjustmentRule rule, DateTime dateTime, int year)
{
DateTime DST_start = TransitionPoint (rule.DaylightTransitionStart, year);
@ -775,24 +866,10 @@ namespace System
if (!SupportsDaylightSavingTime)
return false;
//FIXME: do not rely on DateTime implementation !
if ((dateTime.Kind == DateTimeKind.Local || dateTime.Kind == DateTimeKind.Unspecified) && this == TimeZoneInfo.Local)
return dateTime.IsDaylightSavingTime ();
bool isDst;
GetUtcOffset (dateTime, out isDst);
//FIXME: do not rely on DateTime implementation !
if (dateTime.Kind == DateTimeKind.Local && this != TimeZoneInfo.Utc)
return IsDaylightSavingTime (DateTime.SpecifyKind (dateTime.ToUniversalTime (), DateTimeKind.Utc));
AdjustmentRule rule = GetApplicableRule (dateTime.Date);
if (rule == null)
return false;
// Check whether we're in the dateTime year's DST period
if (IsInDSTForYear (rule, dateTime, dateTime.Year))
return true;
// We might be in the dateTime previous year's DST period
return IsInDSTForYear (rule, dateTime, dateTime.Year - 1);
return isDst;
}
public bool IsDaylightSavingTime (DateTimeOffset dateTimeOffset)
@ -969,6 +1046,40 @@ namespace System
return null;
}
private bool TryGetTransitionOffset (DateTime dateTime, out TimeSpan offset,out bool isDst)
{
offset = BaseUtcOffset;
isDst = false;
if (transitions == null)
return false;
//Transitions are always in standard time
DateTime date = dateTime;
if (dateTime.Kind == DateTimeKind.Local && this != TimeZoneInfo.Local)
date = date.ToUniversalTime () + BaseUtcOffset;
if (dateTime.Kind == DateTimeKind.Utc && this != TimeZoneInfo.Utc)
date = date + BaseUtcOffset;
for (var i = transitions.Count - 1; i >= 0; i--) {
var pair = transitions [i];
DateTime ttime = pair.Key;
TimeType ttype = pair.Value;
if (ttime > date)
continue;
offset = new TimeSpan (0, 0, ttype.Offset);
isDst = ttype.IsDst;
return true;
}
return false;
}
private static DateTime TransitionPoint (TransitionTime transition, int year)
{
if (transition.IsFixedDateRule)
@ -1059,6 +1170,7 @@ namespace System
bool dst_observed = false;
DateTime dst_start = DateTime.MinValue;
List<AdjustmentRule> adjustmentRules = new List<AdjustmentRule> ();
bool storeTransition = false;
for (int i = 0; i < transitions.Count; i++) {
var pair = transitions [i];
@ -1069,6 +1181,8 @@ namespace System
standardDisplayName = ttype.Name;
daylightDisplayName = null;
baseUtcOffset = new TimeSpan (0, 0, ttype.Offset);
if (adjustmentRules.Count > 0) // We ignore AdjustmentRules but store transitions.
storeTransition = true;
adjustmentRules = new List<AdjustmentRule> ();
dst_observed = false;
}
@ -1110,16 +1224,22 @@ namespace System
}
}
if (adjustmentRules.Count == 0) {
TimeZoneInfo tz;
if (adjustmentRules.Count == 0 && !storeTransition) {
TimeType t = (TimeType)time_types [0];
if (standardDisplayName == null) {
standardDisplayName = t.Name;
baseUtcOffset = new TimeSpan (0, 0, t.Offset);
}
return CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName);
tz = CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName);
} else {
return CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName, daylightDisplayName, ValidateRules (adjustmentRules).ToArray ());
tz = CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName, daylightDisplayName, ValidateRules (adjustmentRules).ToArray ());
}
if (storeTransition)
tz.transitions = transitions;
return tz;
}
static Dictionary<int, string> ParseAbbreviations (byte [] buffer, int index, int count)

View File

@ -401,9 +401,14 @@ namespace MonoTests.System.Threading
{
var v = new ReaderWriterLockSlim ();
int local = 10;
int ready_count = 0;
int entered_count = 0;
const int thread_count = 10;
var r = from i in Enumerable.Range (1, 10) select new Thread (() => {
var r = from i in Enumerable.Range (1, thread_count) select new Thread (() => {
Interlocked.Increment (ref ready_count);
v.EnterReadLock ();
Interlocked.Increment (ref entered_count);
Assert.AreEqual (11, local);
});
@ -415,12 +420,16 @@ namespace MonoTests.System.Threading
t.Start ();
}
Thread.Sleep (200);
while (ready_count != thread_count)
Thread.Sleep (10);
/* Extra up to 2s of sleep to ensure all threads got the chance to enter the lock */
for (int i = 0; i < 200 && v.WaitingReadCount != thread_count; ++i)
Thread.Sleep (10);
local = 11;
// FIXME: Don't rely on Thread.Sleep (200)
Assert.AreEqual (0, v.WaitingWriteCount, "in waiting write");
Assert.AreEqual (10, v.WaitingReadCount, "in waiting read");
Assert.AreEqual (thread_count, v.WaitingReadCount, "in waiting read");
Assert.AreEqual (0, v.WaitingUpgradeCount, "in waiting upgrade");
v.ExitWriteLock ();

View File

@ -232,7 +232,7 @@ namespace MonoTests.System
DateTime afterDST = new DateTime (2007, 10, 28, 2, 0, 0, DateTimeKind.Unspecified);
Assert.IsFalse (london.IsDaylightSavingTime (beforeDST), "Just before DST");
Assert.IsTrue (london.IsDaylightSavingTime (startDST), "the first seconds of DST");
Assert.IsTrue (london.IsDaylightSavingTime (endDST), "The last seconds of DST");
Assert.IsFalse (london.IsDaylightSavingTime (endDST), "The last seconds of DST");
Assert.IsFalse (london.IsDaylightSavingTime (afterDST), "Just after DST");
}
@ -804,6 +804,143 @@ namespace MonoTests.System
Assert.IsTrue (london.Equals (deserialized));
}
}
[TestFixture]
public class MultipleDaylightSavingTimeTests {
private TimeZoneInfo cairo;
private DateTime dst1Start;
private DateTime dst1End;
private DateTime dst2Start;
private DateTime dst2End;
private TimeSpan baseUtcOffset;
private TimeSpan dstUtcOffset;
private TimeSpan dstOffset;
[SetUp]
public void CreateTimeZones ()
{
/*
From 1/1/2014 12:00:00 AM to 6/30/2014 12:00:00 AM
Delta: 01:00:00
Begins at 12:00 AM on 16 May
Ends at 1:00 AM on 29 June
From 7/1/2014 12:00:00 AM to 12/31/2014 12:00:00 AM
Delta: 01:00:00
Begins at 12:00 AM on 29 July
Ends at 12:00 AM on 26 September
*/
dst1Start = new DateTime (2014, 5, 16);
dst1End = new DateTime (2014, 6, 29);
dst2Start = new DateTime (2014, 7, 29);
dst2End = new DateTime (2014, 9, 26);
baseUtcOffset = new TimeSpan (2, 0, 0);
dstUtcOffset = new TimeSpan (3, 0, 0);
dstOffset = dstUtcOffset - baseUtcOffset;
var rule1 = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule (
new DateTime (2014, 1, 1), new DateTime (2014, 6, 30), dstOffset,
CreateFixedDateRule (dst1Start), CreateFixedDateRule (dst1End));
var rule2 = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule (
new DateTime (2014, 7, 1), new DateTime (2014, 12, 31), dstOffset,
CreateFixedDateRule (dst2Start), CreateFixedDateRule (dst2End));
cairo = TimeZoneInfo.CreateCustomTimeZone ("Africa/Cairo", baseUtcOffset, "Africa/Cairo", "EET", "EEST",
new [] {rule1, rule2});
}
private static TimeZoneInfo.TransitionTime CreateFixedDateRule (DateTime dateTime)
{
var time = new DateTime (dateTime.Ticks - dateTime.Date.Ticks);
return TimeZoneInfo.TransitionTime.CreateFixedDateRule (time, dateTime.Month, dateTime.Day);
}
[Test]
public void GetUtcOffset_FromUTC ()
{
var d = dst1Start.Add (-baseUtcOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst1End.Add (-baseUtcOffset-dstOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst2Start.Add (-baseUtcOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst2End.Add (-baseUtcOffset-dstOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
}
[Test]
public void GetUtcOffset_FromLocal ()
{
var d = dst1Start.Add (-baseUtcOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
d = d.ToLocalTime ();
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst1End.Add (-baseUtcOffset-dstOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
d = d.ToLocalTime ();
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst2Start.Add (-baseUtcOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
d = d.ToLocalTime ();
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst2End.Add (-baseUtcOffset-dstOffset);
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
d = d.ToLocalTime ();
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
}
[Test]
public void GetUtcOffset_FromUnspecified ()
{
var d = dst1Start.Add (dstOffset);
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst1End.Add (-dstOffset);
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst2Start.Add (dstOffset);
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
d = dst2End.Add (-dstOffset);
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
}
}
}
}
#endif

View File

@ -1,109 +1,4 @@
Assembly/AssemblyInfo.cs
System/Actions.cs
System/Funcs.cs
System/InvalidTimeZoneException.cs
System/TimeZoneInfo.AdjustmentRule.cs
System/TimeZoneInfo.cs
System/TimeZoneInfo.Serialization.cs
System/TimeZoneInfo.TransitionTime.cs
System/TimeZoneNotFoundException.cs
System/Util.cs
System.Runtime.CompilerServices/DynamicAttribute.cs
System.Runtime.CompilerServices/ExecutionScope.cs
System.Runtime.CompilerServices/ExtensionAttribute.cs
System.Runtime.CompilerServices/IStrongBox.cs
System.Runtime.CompilerServices/StrongBox_T.cs
System.Linq/Check.cs
System.Linq/Enumerable.cs
System.Linq/QueryableEnumerable.cs
System.Linq/QueryableTransformer.cs
System.Linq/Grouping.cs
System.Linq/IGrouping.cs
System.Linq/IOrderedQueryable.cs
System.Linq/IOrderedQueryable_T.cs
System.Linq/IOrderedEnumerable_T.cs
System.Linq/IQueryable.cs
System.Linq/IQueryable_T.cs
System.Linq/Lookup.cs
System.Linq/ILookup_T.cs
System.Linq/OrderedEnumerable.cs
System.Linq/OrderedSequence.cs
System.Linq/Queryable.cs
System.Linq/QuickSort.cs
System.Linq/SortContext.cs
System.Linq/SortDirection.cs
System.Linq/SortSequenceContext.cs
System.Linq/IQueryProvider.cs
System.Collections.Generic/HashSet.cs
System.Security.Cryptography/Aes.cs
System.Threading/LockRecursionPolicy.cs
System.Threading/ReaderWriterLockSlim.cs
System.Threading/ThreadLockState.cs
System.Threading/ReaderWriterLockSlimExtensions.cs
System.Linq.Parallel.QueryNodes/QueryBaseNode.cs
System.Linq.Parallel.QueryNodes/QueryCastNode.cs
System.Linq.Parallel.QueryNodes/QueryChildNode.cs
System.Linq.Parallel.QueryNodes/QueryConcatNode.cs
System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs
System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs
System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs
System.Linq.Parallel.QueryNodes/QueryJoinNode.cs
System.Linq.Parallel.QueryNodes/QueryMuxNode.cs
System.Linq.Parallel.QueryNodes/QueryOptionNode.cs
System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs
System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs
System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs
System.Linq.Parallel.QueryNodes/QueryReverseNode.cs
System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs
System.Linq.Parallel.QueryNodes/QuerySelectNode.cs
System.Linq.Parallel.QueryNodes/QuerySetNode.cs
System.Linq.Parallel.QueryNodes/QueryStartNode.cs
System.Linq.Parallel.QueryNodes/QueryStreamNode.cs
System.Linq.Parallel.QueryNodes/QueryWhereNode.cs
System.Linq.Parallel.QueryNodes/QueryZipNode.cs
System.Linq.Parallel.QueryNodes/SetInclusion.cs
System.Linq.Parallel.QueryNodes/WrapHelper.cs
System.Linq.Parallel/AggregationList.cs
System.Linq.Parallel/ConcurrentGrouping.cs
System.Linq.Parallel/ConcurrentLookup.cs
System.Linq.Parallel/INodeVisitor.cs
System.Linq.Parallel/IVisitableNode.cs
System.Linq.Parallel/OrderingEnumerator.cs
System.Linq.Parallel/ParallelExecuter.cs
System.Linq.Parallel/ParallelPartitioner.cs
System.Linq.Parallel/ParallelQueryEnumerator.cs
System.Linq.Parallel/ParallelQuickSort.cs
System.Linq.Parallel/QueryCheckerVisitor.cs
System.Linq.Parallel/QueryIsOrderedVisitor.cs
System.Linq.Parallel/QueryOptions.cs
System.Linq.Parallel/RangeList.cs
System.Linq.Parallel/RepeatList.cs
System.Linq.Parallel/ReverseList.cs
System.Linq.Parallel/StripPartitioner.cs
System.Linq.Parallel/TemporaryArea.cs
System.Linq/EnumerableExecutor.cs
System.Linq/EnumerableExecutor_T.cs
System.Linq/EnumerableQuery.cs
System.Linq/EnumerableQuery_T.cs
System.Linq/OrderedParallelQuery.cs
System.Linq/ParallelEnumerable.cs
System.Linq/ParallelExecutionMode.cs
System.Linq/ParallelMergeOptions.cs
System.Linq/ParallelQuery.cs
System.IO.MemoryMappedFiles/MemoryMappedFile.cs
System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
System.IO/HandleInheritability.cs
System.Threading.Tasks/TaskExtensions.cs
System.Linq.Expressions/Extensions.cs
System.Linq.Expressions/ExpressionTransformer.cs
../dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs
../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs
System.Linq.Expressions/DynamicExpressionVisitor.cs
#include mobile_common_System.Core.dll.sources
#include dynamic_System.Core.dll.sources

View File

@ -0,0 +1,108 @@
Assembly/AssemblyInfo.cs
System/Actions.cs
System/Funcs.cs
System/InvalidTimeZoneException.cs
System/TimeZoneInfo.AdjustmentRule.cs
System/TimeZoneInfo.cs
System/TimeZoneInfo.Serialization.cs
System/TimeZoneInfo.TransitionTime.cs
System/TimeZoneNotFoundException.cs
System/Util.cs
System.Runtime.CompilerServices/DynamicAttribute.cs
System.Runtime.CompilerServices/ExecutionScope.cs
System.Runtime.CompilerServices/ExtensionAttribute.cs
System.Runtime.CompilerServices/IStrongBox.cs
System.Runtime.CompilerServices/StrongBox_T.cs
System.Linq/Check.cs
System.Linq/Enumerable.cs
System.Linq/QueryableEnumerable.cs
System.Linq/QueryableTransformer.cs
System.Linq/Grouping.cs
System.Linq/IGrouping.cs
System.Linq/IOrderedQueryable.cs
System.Linq/IOrderedQueryable_T.cs
System.Linq/IOrderedEnumerable_T.cs
System.Linq/IQueryable.cs
System.Linq/IQueryable_T.cs
System.Linq/Lookup.cs
System.Linq/ILookup_T.cs
System.Linq/OrderedEnumerable.cs
System.Linq/OrderedSequence.cs
System.Linq/Queryable.cs
System.Linq/QuickSort.cs
System.Linq/SortContext.cs
System.Linq/SortDirection.cs
System.Linq/SortSequenceContext.cs
System.Linq/IQueryProvider.cs
System.Collections.Generic/HashSet.cs
System.Security.Cryptography/Aes.cs
System.Threading/LockRecursionPolicy.cs
System.Threading/ReaderWriterLockSlim.cs
System.Threading/ThreadLockState.cs
System.Threading/ReaderWriterLockSlimExtensions.cs
System.Linq.Parallel.QueryNodes/QueryBaseNode.cs
System.Linq.Parallel.QueryNodes/QueryCastNode.cs
System.Linq.Parallel.QueryNodes/QueryChildNode.cs
System.Linq.Parallel.QueryNodes/QueryConcatNode.cs
System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs
System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs
System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs
System.Linq.Parallel.QueryNodes/QueryJoinNode.cs
System.Linq.Parallel.QueryNodes/QueryMuxNode.cs
System.Linq.Parallel.QueryNodes/QueryOptionNode.cs
System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs
System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs
System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs
System.Linq.Parallel.QueryNodes/QueryReverseNode.cs
System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs
System.Linq.Parallel.QueryNodes/QuerySelectNode.cs
System.Linq.Parallel.QueryNodes/QuerySetNode.cs
System.Linq.Parallel.QueryNodes/QueryStartNode.cs
System.Linq.Parallel.QueryNodes/QueryStreamNode.cs
System.Linq.Parallel.QueryNodes/QueryWhereNode.cs
System.Linq.Parallel.QueryNodes/QueryZipNode.cs
System.Linq.Parallel.QueryNodes/SetInclusion.cs
System.Linq.Parallel.QueryNodes/WrapHelper.cs
System.Linq.Parallel/AggregationList.cs
System.Linq.Parallel/ConcurrentGrouping.cs
System.Linq.Parallel/ConcurrentLookup.cs
System.Linq.Parallel/INodeVisitor.cs
System.Linq.Parallel/IVisitableNode.cs
System.Linq.Parallel/OrderingEnumerator.cs
System.Linq.Parallel/ParallelExecuter.cs
System.Linq.Parallel/ParallelPartitioner.cs
System.Linq.Parallel/ParallelQueryEnumerator.cs
System.Linq.Parallel/ParallelQuickSort.cs
System.Linq.Parallel/QueryCheckerVisitor.cs
System.Linq.Parallel/QueryIsOrderedVisitor.cs
System.Linq.Parallel/QueryOptions.cs
System.Linq.Parallel/RangeList.cs
System.Linq.Parallel/RepeatList.cs
System.Linq.Parallel/ReverseList.cs
System.Linq.Parallel/StripPartitioner.cs
System.Linq.Parallel/TemporaryArea.cs
System.Linq/EnumerableExecutor.cs
System.Linq/EnumerableExecutor_T.cs
System.Linq/EnumerableQuery.cs
System.Linq/EnumerableQuery_T.cs
System.Linq/OrderedParallelQuery.cs
System.Linq/ParallelEnumerable.cs
System.Linq/ParallelExecutionMode.cs
System.Linq/ParallelMergeOptions.cs
System.Linq/ParallelQuery.cs
System.IO.MemoryMappedFiles/MemoryMappedFile.cs
System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
System.IO/HandleInheritability.cs
System.Threading.Tasks/TaskExtensions.cs
System.Linq.Expressions/Extensions.cs
System.Linq.Expressions/ExpressionTransformer.cs
../dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs
../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs
System.Linq.Expressions/DynamicExpressionVisitor.cs

View File

@ -0,0 +1,2 @@
#include mobile_common_System.Core.dll.sources
#include interpreter_System.Core.dll.sources

View File

@ -1,4 +1,4 @@
#include mobile_System.Core.dll.sources
#include mobile_common_System.Core.dll.sources
#include dynamic_System.Core.dll.sources

View File

@ -1,3 +1,3 @@
#include mobile_System.Core.dll.sources
#include mobile_common_System.Core.dll.sources
#include interpreter_System.Core.dll.sources
System/TimeZoneInfo.MonoTouch.cs

View File

@ -1,4 +1,4 @@
#include mobile_System.Core.dll.sources
#include mobile_common_System.Core.dll.sources
#include dynamic_System.Core.dll.sources

View File

@ -830,9 +830,12 @@ namespace DbLinq.Data.Linq
}
}
private static MethodInfo _WhereMethod = typeof(Queryable).GetMethods().First(m => m.Name == "Where");
private static MethodInfo _WhereMethod;
internal object GetOtherTableQuery(Expression predicate, ParameterExpression parameter, Type otherTableType, IQueryable otherTable)
{
if (_WhereMethod == null)
System.Threading.Interlocked.CompareExchange (ref _WhereMethod, typeof(Queryable).GetMethods().First(m => m.Name == "Where"), null);
//predicate: other.EmployeeID== "WARTH"
Expression lambdaPredicate = Expression.Lambda(predicate, parameter);
//lambdaPredicate: other=>other.EmployeeID== "WARTH"

View File

@ -95,7 +95,7 @@ namespace System.Data.OracleClient.Oci
IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -111,7 +111,7 @@ namespace System.Data.OracleClient.Oci
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -127,7 +127,7 @@ namespace System.Data.OracleClient.Oci
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -142,7 +142,7 @@ namespace System.Data.OracleClient.Oci
IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -157,7 +157,7 @@ namespace System.Data.OracleClient.Oci
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -172,7 +172,7 @@ namespace System.Data.OracleClient.Oci
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -193,8 +193,8 @@ namespace System.Data.OracleClient.Oci
IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U4)] OciDataType dty,
ref short indp,
ref short rlenp,
IntPtr indp,
IntPtr rlenp,
IntPtr rcodep,
uint mode);
@ -206,8 +206,8 @@ namespace System.Data.OracleClient.Oci
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U4)] OciDataType dty,
ref short indp,
ref short rlenp,
IntPtr indp,
IntPtr rlenp,
IntPtr rcodep,
uint mode);
@ -547,7 +547,7 @@ namespace System.Data.OracleClient.Oci
IntPtr valuep,
int value_sz,
OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -558,7 +558,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIBindByName", "OCI");
#endif
return OciNativeCalls.OCIBindByName (stmtp, out bindpp, errhp, placeholder, placeh_len, valuep,
value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByNameRef (IntPtr stmtp,
@ -569,7 +569,7 @@ namespace System.Data.OracleClient.Oci
ref IntPtr valuep,
int value_sz,
OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -580,7 +580,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIBindByName", "OCI");
#endif
return OciNativeCalls.OCIBindByNameRef (stmtp, out bindpp, errhp, placeholder, placeh_len, ref valuep,
value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByNameBytes (IntPtr stmtp,
@ -591,7 +591,7 @@ namespace System.Data.OracleClient.Oci
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -602,7 +602,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIBindByName", "OCI");
#endif
return OciNativeCalls.OCIBindByNameBytes (stmtp, out bindpp, errhp, placeholder, placeh_len, valuep,
value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByPos (IntPtr stmtp,
@ -612,7 +612,7 @@ namespace System.Data.OracleClient.Oci
IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -623,7 +623,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIBindByPos", "OCI");
#endif
return OciNativeCalls.OCIBindByPos (stmtp, out bindpp, errhp, position, valuep,
value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByPosRef (IntPtr stmtp,
@ -633,7 +633,7 @@ namespace System.Data.OracleClient.Oci
ref IntPtr valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -644,7 +644,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIBindByPos", "OCI");
#endif
return OciNativeCalls.OCIBindByPosRef (stmtp, out bindpp, errhp, position, ref valuep,
value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
internal static int OCIBindByPosBytes (IntPtr stmtp,
@ -654,7 +654,7 @@ namespace System.Data.OracleClient.Oci
byte[] valuep,
int value_sz,
[MarshalAs (UnmanagedType.U2)] OciDataType dty,
ref short indp,
IntPtr indp,
IntPtr alenp,
IntPtr rcodep,
uint maxarr_len,
@ -665,7 +665,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIBindByPos", "OCI");
#endif
return OciNativeCalls.OCIBindByPosBytes (stmtp, out bindpp, errhp, position, valuep,
value_sz, dty, ref indp, alenp, rcodep, maxarr_len, curelp, mode);
value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
}
[DllImport ("oci")]
@ -723,8 +723,8 @@ namespace System.Data.OracleClient.Oci
IntPtr valuep,
int value_sz,
OciDataType dty,
ref short indp,
ref short rlenp,
IntPtr indp,
IntPtr rlenp,
IntPtr rcodep,
uint mode)
{
@ -732,7 +732,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIDefineByPos", "OCI");
#endif
return OciNativeCalls.OCIDefineByPos (stmtp, out defnpp, errhp, position, valuep,
value_sz, dty, ref indp, ref rlenp, rcodep, mode);
value_sz, dty, indp, rlenp, rcodep, mode);
}
internal static int OCIDefineByPosPtr (IntPtr stmtp,
@ -742,8 +742,8 @@ namespace System.Data.OracleClient.Oci
ref IntPtr valuep,
int value_sz,
OciDataType dty,
ref short indp,
ref short rlenp,
IntPtr indp,
IntPtr rlenp,
IntPtr rcodep,
uint mode)
{
@ -751,7 +751,7 @@ namespace System.Data.OracleClient.Oci
Trace.WriteLineIf(traceOci, "OCIDefineByPosPtr", "OCI");
#endif
return OciNativeCalls.OCIDefineByPosPtr (stmtp, out defnpp, errhp, position, ref valuep,
value_sz, dty, ref indp, ref rlenp, rcodep, mode);
value_sz, dty, indp, rlenp, rcodep, mode);
}
internal static int OCIDescriptorFree (IntPtr hndlp,

View File

@ -32,16 +32,16 @@ namespace System.Data.OracleClient.Oci
//IntPtr handle;
IntPtr value;
short indicator;
IntPtr indicator;
//OracleType type;
OciDataType ociType;
OciDataType definedType;
int definedSize;
short rlenp = 0;
IntPtr rlenp;
//short precision;
short scale;
Type fieldType;
//string name;
string name;
// Oracle defines the LONG VARCHAR and LONG VARRAW to have a size of 2 to the 31 power - 5
// see DefineLongVarChar and DefineLongVarRaw
@ -70,11 +70,13 @@ namespace System.Data.OracleClient.Oci
{
OciParameterDescriptor parameter = ((OciStatementHandle) Parent).GetParameter (position);
//name = parameter.GetName ();
name = parameter.GetName ();
definedType = parameter.GetDataType ();
definedSize = parameter.GetDataSize ();
//precision = parameter.GetPrecision ();
scale = parameter.GetScale ();
rlenp = OciCalls.AllocateClear (sizeof(short));
indicator = OciCalls.AllocateClear (sizeof(short));
Define (position, connection);
@ -103,7 +105,7 @@ namespace System.Data.OracleClient.Oci
}
internal bool IsNull {
get { return (indicator == -1); }
get { return (Indicator == -1); }
}
internal short Scale {
@ -111,7 +113,13 @@ namespace System.Data.OracleClient.Oci
}
internal short Size {
get { return rlenp; }
get { return(Marshal.ReadInt16(rlenp)); }
set { Marshal.WriteInt16(rlenp, value); }
}
internal short Indicator {
get { return(Marshal.ReadInt16(indicator)); }
set { Marshal.WriteInt16(indicator, value); }
}
internal IntPtr Value {
@ -192,8 +200,8 @@ namespace System.Data.OracleClient.Oci
ref value,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero,
0);
@ -222,8 +230,8 @@ namespace System.Data.OracleClient.Oci
value,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero,
0);
@ -261,11 +269,11 @@ namespace System.Data.OracleClient.Oci
value,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero, 0);
rlenp = (short) definedSize;
Size = (short) definedSize;
if (status != 0) {
OciErrorInfo info = ErrorHandle.HandleError ();
@ -291,8 +299,8 @@ namespace System.Data.OracleClient.Oci
value,
maxByteCount,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero,
0);
OciErrorHandle.ThrowExceptionIfError (ErrorHandle, status);
@ -312,10 +320,10 @@ namespace System.Data.OracleClient.Oci
ErrorHandle,
position + 1,
value,
definedSize * 2,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero,
0);
@ -357,8 +365,8 @@ namespace System.Data.OracleClient.Oci
ref value,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero,
0);
@ -386,8 +394,8 @@ namespace System.Data.OracleClient.Oci
value,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero, 0);
if (status != 0) {
@ -415,8 +423,8 @@ namespace System.Data.OracleClient.Oci
value,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero, 0);
if (status != 0) {
@ -459,8 +467,8 @@ namespace System.Data.OracleClient.Oci
ref value,
definedSize,
ociType,
ref indicator,
ref rlenp,
indicator,
rlenp,
IntPtr.Zero,
0);
@ -487,6 +495,8 @@ namespace System.Data.OracleClient.Oci
}
disposed = true;
} finally {
Marshal.FreeHGlobal (indicator);
Marshal.FreeHGlobal (rlenp);
base.Dispose (disposing);
value = IntPtr.Zero;
}

View File

@ -39,10 +39,11 @@ namespace System.Data.OracleClient
[TypeConverter (typeof(OracleParameter.OracleParameterConverter))]
public sealed class OracleParameter :
#if NET_2_0
DbParameter, IDbDataParameter, ICloneable
DbParameter, IDbDataParameter, ICloneable,
#else
MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable,
#endif
IDisposable
{
#region Fields
@ -66,6 +67,7 @@ namespace System.Data.OracleClient
object value = DBNull.Value;
OciLobLocator lobLocator; // only if Blob or Clob
IntPtr bindOutValue = IntPtr.Zero;
IntPtr indicator = IntPtr.Zero;
OciDateTimeDescriptor dateTimeDesc;
IntPtr cursor = IntPtr.Zero;
@ -77,7 +79,6 @@ namespace System.Data.OracleClient
bool useRef;
OciDataType bindType;
short indicator;
int bindSize;
bool sizeManuallySet;
@ -104,6 +105,7 @@ namespace System.Data.OracleClient
this.value = value.value;
this.lobLocator = value.lobLocator;
this.oracleTypeSet = value.oracleTypeSet;
this.indicator = OciCalls.AllocateClear (sizeof(short));
}
public OracleParameter ()
@ -119,6 +121,7 @@ namespace System.Data.OracleClient
this.srcVersion = DataRowVersion.Current;
this.value = null;
this.oracleTypeSet = false;
this.indicator = OciCalls.AllocateClear (sizeof(short));
}
public OracleParameter (string name, object value)
@ -129,6 +132,7 @@ namespace System.Data.OracleClient
srcColumn = string.Empty;
SourceVersion = DataRowVersion.Current;
InferOracleType (value);
this.indicator = OciCalls.AllocateClear (sizeof(short));
#if NET_2_0
// Find the OciType before inferring for the size
if (value != null && value != DBNull.Value) {
@ -173,6 +177,7 @@ namespace System.Data.OracleClient
OracleType = oracleType;
SourceColumn = sourceColumn;
SourceVersion = sourceVersion;
this.indicator = OciCalls.AllocateClear (sizeof(short));
}
#endif
@ -199,6 +204,12 @@ namespace System.Data.OracleClient
OracleType = oracleType;
SourceColumn = srcColumn;
SourceVersion = srcVersion;
this.indicator = OciCalls.AllocateClear (sizeof(short));
}
~OracleParameter ()
{
Dispose(false);
}
#endregion // Constructors
@ -210,6 +221,11 @@ namespace System.Data.OracleClient
set { container = value; }
}
internal short Indicator {
get { return (Marshal.ReadInt16(indicator)); }
set { Marshal.WriteInt16(indicator, value); }
}
#if !NET_2_0
[Browsable (false)]
[RefreshProperties (RefreshProperties.All)]
@ -453,7 +469,6 @@ namespace System.Data.OracleClient
}
if (isnull == true && direction == ParameterDirection.Input) {
indicator = 0;
bindType = OciDataType.VarChar2;
bindSize = 0;
} else {
@ -465,7 +480,6 @@ namespace System.Data.OracleClient
case OciDataType.CharZ:
case OciDataType.OciString:
bindType = OciDataType.String;
indicator = 0;
svalue = "\0";
// convert value from managed type to type to marshal
if (direction == ParameterDirection.Input ||
@ -558,7 +572,7 @@ namespace System.Data.OracleClient
dt = DateTime.MinValue;
sDate = "";
if (isnull)
indicator = -1;
Indicator = -1;
else if (v is String) {
sDate = (string) v;
dt = DateTime.Parse (sDate);
@ -594,7 +608,7 @@ namespace System.Data.OracleClient
case OciDataType.Float:
case OciDataType.Number:
bindType = OciDataType.String;
indicator = 0;
Indicator = 0;
svalue = "\0";
// convert value from managed type to type to marshal
if (direction == ParameterDirection.Input ||
@ -638,7 +652,7 @@ namespace System.Data.OracleClient
bindSize = Size + 5; // 4 bytes prepended for length, bytes, 1 byte NUL character
indicator = 0;
Indicator = 0;
svalue = "\0";
// convert value from managed type to type to marshal
if (direction == ParameterDirection.Input ||
@ -758,7 +772,7 @@ namespace System.Data.OracleClient
case OciDataType.VarRaw:
bindType = OciDataType.VarRaw;
bindSize = Size + 2; // include 2 bytes prepended to hold the length
indicator = 0;
Indicator = 0;
bytes = new byte [bindSize];
if (direction == ParameterDirection.Input ||
direction == ParameterDirection.InputOutput) {
@ -784,7 +798,7 @@ namespace System.Data.OracleClient
case OciDataType.LongVarRaw:
bindType = OciDataType.LongVarRaw;
bindSize = Size + 4; // include 4 bytes prepended to hold the length
indicator = 0;
Indicator = 0;
bytes = new byte [bindSize];
if (direction == ParameterDirection.Input ||
direction == ParameterDirection.InputOutput) {
@ -854,7 +868,7 @@ namespace System.Data.OracleClient
ref bindValue,
bindSize,
bindType,
ref indicator,
indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
@ -870,7 +884,7 @@ namespace System.Data.OracleClient
ref bindValue,
bindSize,
bindType,
ref indicator,
indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
@ -887,7 +901,7 @@ namespace System.Data.OracleClient
ref cursor,
bindSize,
bindType,
ref indicator,
indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
@ -903,7 +917,7 @@ namespace System.Data.OracleClient
bytes,
bindSize,
bindType,
ref indicator,
indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
@ -919,7 +933,7 @@ namespace System.Data.OracleClient
bindValue,
bindSize,
bindType,
ref indicator,
indicator,
IntPtr.Zero,
IntPtr.Zero,
0,
@ -1251,7 +1265,7 @@ namespace System.Data.OracleClient
// used to update the parameter value
// for Output, the output of InputOutput, and Return parameters
value = DBNull.Value;
if (indicator == -1)
if (Indicator == -1)
return;
int rsize = 0;
@ -1453,6 +1467,22 @@ namespace System.Data.OracleClient
return buffer;
}
public void Dispose ()
{
Dispose (true);
}
void Dispose (bool disposing)
{
if (disposing) {
GC.SuppressFinalize(this);
}
if (indicator != IntPtr.Zero) {
Marshal.FreeHGlobal (indicator);
indicator = IntPtr.Zero;
}
}
#endregion // Methods
internal sealed class OracleParameterConverter : ExpandableObjectConverter

View File

@ -1,2 +1 @@
#include System.Data.Services.Client.dll.sources
./Client/AssemblyAttributes.cs
#include net_4_5_System.Data.Services.Client.dll.sources

View File

@ -26,9 +26,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data.Services;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class ChangeInterceptorAttributeTests {
[Test]

View File

@ -26,9 +26,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data.Services;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class DataServiceExceptionTests {
[Test]

View File

@ -26,9 +26,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data.Services;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class DataServiceTests {
[Test]

View File

@ -26,10 +26,12 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data.Services;
using System.Linq;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class ETagAttributeTests {
[Test]

View File

@ -26,10 +26,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Data.Services;
using System.Linq.Expressions;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class ExpandSegmentCollectionTests {
[Test]

View File

@ -26,10 +26,12 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data.Services;
using System.Linq.Expressions;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class ExpandSegmentTests {
[Test]

View File

@ -26,10 +26,12 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data.Services;
using System.Linq;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class IgnorePropertiesAttributeTests {
[Test]

View File

@ -26,9 +26,10 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Data.Services;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class MimeTypeAttributeTests {
[Test]

View File

@ -26,9 +26,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data.Services;
using NUnit.Framework;
namespace System.Data.Services.Tests {
namespace MonoTests.System.Data.Services {
[TestFixture]
public class QueryInterceptorAttributeTests {
[Test]

View File

@ -43,7 +43,6 @@ namespace System.Data.Common {
readonly IDataReader reader;
readonly bool closeReader;
readonly SchemaInfo [] schema;
readonly object [] values;
#endregion // Fields
@ -58,7 +57,6 @@ namespace System.Data.Common {
{
this.reader = reader;
this.closeReader = closeReader;
this.values = new object [reader.FieldCount];
this.schema = LoadSchema (reader);
}
@ -68,7 +66,12 @@ namespace System.Data.Common {
public object Current {
get {
// DbDataRecordImpl does not do copy of the array
// and MoveNext would overwrite any previously filled data
var values = new object [reader.FieldCount];
reader.GetValues (values);
// TODO: Should not allocate on every property call
return new DbDataRecordImpl (schema, values);
}
}

View File

@ -56,6 +56,7 @@ using System.Xml;
#if NET_2_0
using System.Collections.Generic;
#endif
using System.Security;
namespace System.Data.SqlClient
{
@ -93,6 +94,9 @@ namespace System.Data.SqlClient
// The connection string that identifies this connection
string connectionString;
// The connection credentials
SqlCredential credentials;
// The transaction object for the current transaction
SqlTransaction transaction;
@ -133,6 +137,12 @@ namespace System.Data.SqlClient
ConnectionString = connectionString;
}
public SqlConnection (string connectionString, SqlCredential cred)
{
ConnectionString = connectionString;
Credentials = cred;
}
#endregion // Constructors
#region Properties
@ -155,6 +165,15 @@ namespace System.Data.SqlClient
}
}
public SqlCredential Credentials {
get {
return credentials;
}
set {
credentials = value;
}
}
#if !NET_2_0
[DataSysDescription ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")]
#endif
@ -563,6 +582,16 @@ namespace System.Data.SqlClient
if (!tds.IsConnected) {
try {
if (Credentials != null) {
if (parms.User != String.Empty)
throw new ArgumentException("UserID already specified");
if (parms.PasswordSet)
throw new ArgumentException("Password already specified");
if (parms.DomainLogin != false)
throw new ArgumentException("Cannot use credentials with DomainLogin");
parms.User = Credentials.UserId;
parms.Password = Credentials.Password;
}
tds.Connect (parms);
} catch {
if (pooling)
@ -879,7 +908,10 @@ namespace System.Data.SqlClient
break;
case "password" :
case "pwd" :
parms.Password = value;
parms.Password = new SecureString();
foreach (char c in value)
parms.Password.AppendChar(c);
parms.PasswordSet = true;
break;
case "persistsecurityinfo" :
case "persist security info" :

View File

@ -0,0 +1,76 @@
//
// System.Data.SqlClient.SqlCredential.cs
//
// Author:
// Neale Ferguson (neale@sinenomine.net)
//
// Copyright (C) Neale Ferguson, 2014
//
//
// 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.Data;
using System.Runtime.InteropServices;
using System.Security;
namespace System.Data.SqlClient {
/// <summary>
/// Describes an error from a SQL database.
/// </summary>
[Serializable]
public sealed class SqlCredential
{
#region Fields
string uid = "";
SecureString pwd = null;
#endregion // Fields
#region Constructors
public SqlCredential (string user, SecureString password)
{
if (user == null)
throw new ArgumentNullException("UserID");
if (password == null)
throw new ArgumentNullException("Password");
this.uid = user;
this.pwd = password;
}
#endregion // Constructors
#region Properties
public string UserId {
get { return uid; }
}
public SecureString Password {
get { return pwd; }
}
#endregion
}
}

View File

@ -289,6 +289,7 @@ System.Data.SqlClient/SqlCommand.cs
System.Data.SqlClient/SqlCommandBuilder.cs
System.Data.SqlClient/SqlConnection.cs
System.Data.SqlClient/SqlConnectionStringBuilder.cs
System.Data.SqlClient/SqlCredential.cs
System.Data.SqlClient/SqlDataAdapter.cs
System.Data.SqlClient/SqlDataReader.cs
System.Data.SqlClient/SqlDataSourceConverter.cs

View File

@ -118,11 +118,11 @@ namespace System.Data {
/// </summary>
public bool HasErrors {
get {
if (RowError != string.Empty)
if (!string.IsNullOrEmpty (RowError))
return true;
foreach (String columnError in ColumnErrors) {
if (columnError != null && columnError != string.Empty)
if (!string.IsNullOrEmpty (columnError))
return true;
}
return false;
@ -509,7 +509,7 @@ namespace System.Data {
/// </summary>
public string RowError {
get { return rowError; }
set { rowError = value; }
set { rowError = value ?? string.Empty; }
}
internal int IndexFromVersion (DataRowVersion version)

View File

@ -31,7 +31,7 @@ using System.Data;
using System.Data.Common;
using System.IO;
namespace Test.System.Data.Common
namespace MonoTests.System.Data.Common
{
internal class DbDataReaderMock : DbDataReader
{

View File

@ -32,7 +32,7 @@ using System.Data;
using System.Data.Common;
using System.IO;
namespace Test.System.Data.Common
namespace MonoTests.System.Data.Common
{
[TestFixture]
public class DbDataReaderTest

View File

@ -12,6 +12,8 @@ using System.Threading;
using NUnit.Framework;
namespace MonoTests.System.Data
{
[TestFixture]
public class BinarySerializationTest
{
@ -751,3 +753,4 @@ public class BinarySerializationTest
}
#endif
}

View File

@ -33,7 +33,7 @@ using System.IO;
using System.Data;
using MonoTests.System.Data.Utils;
namespace MonoTests_System.Data
namespace MonoTests.System.Data
{
[TestFixture] public class ConstraintExceptionTest
{

View File

@ -31,7 +31,7 @@ using System.Data;
using NUnit.Framework;
namespace MonoTests_System.Data
namespace MonoTests.System.Data
{
[TestFixture]
public class DBConcurrencyExceptionTest

View File

@ -739,6 +739,21 @@ namespace MonoTests.System.Data
Assert.AreEqual(true , dr.HasErrors , "DRW48");
}
[Test] public void HasErrorsWithNullError()
{
DataTable dt = new DataTable("myTable");
DataRow dr = dt.NewRow();
// HasErrors (default)
Assert.AreEqual(false, dr.HasErrors, "DRW47.2");
dr.RowError = null;
// HasErrors (set/get)
Assert.AreEqual(string.Empty , dr.RowError , "DRW48.2");
Assert.AreEqual(false , dr.HasErrors , "DRW49.2");
}
[Test] public void HasVersion_ByDataRowVersion()
{
DataTable t = new DataTable("atable");

Some files were not shown because too many files have changed in this diff Show More