Imported Upstream version 5.12.0.220

Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-04-24 09:31:23 +00:00
parent 8bd104cef2
commit 8fc30896db
1200 changed files with 29534 additions and 26161 deletions

View File

@@ -75,7 +75,6 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo ("System, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
[assembly: InternalsVisibleTo ("System.Core, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
[assembly: InternalsVisibleTo ("System.Numerics, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")]

View File

@@ -171,6 +171,7 @@
<type fullname="System.Exception" preserve="fields">
<!-- used in mini-exceptions.c (if trace is enabled) -->
<method name="get_Message" />
<method name="FixRemotingException" feature="remoting" />
</type>
<!-- exception.c (mono_get_exception_execution_engine) -->
@@ -229,6 +230,9 @@
<method signature="System.Void .ctor(System.String)" />
</type>
<!-- reflection.c mono_get_reflection_missing_object -->
<type fullname="System.Missing" preserve="fields" />
<type fullname="System.MarshalByRefObject" preserve="fields" feature="remoting" />
<type fullname="System.MethodAccessException">
@@ -464,6 +468,11 @@
<method name=".ctor" />
</type>
<!-- console-unix.c: do_console_cancel_event -->
<type fullname="System.Console">
<method name="DoConsoleCancelEventInBackground" />
</type>
<!-- icalls - but (at least parts of them) are used thru interfaces at runtime and cannot be linked out -->
<type fullname="System.Globalization.DateTimeFormatInfo" preserve="fields" />
<type fullname="System.Globalization.CompareInfo" preserve="fields" />

View File

@@ -6,7 +6,7 @@ export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib
LIBRARY = corlib.dll
LIBRARY_NAME = mscorlib.dll
LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%) -nowarn:3019
LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%)
LIBRARY_WARN_AS_ERROR = yes
#LIBRARY_USE_INTERMEDIATE_FILE = yes
@@ -114,6 +114,11 @@ endif
TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe \
-define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%) -resource:LinkerDescriptor/mscorlib_test.xml,$(test_lib:.dll=.xml)
ifeq ($(PROFILE),net_4_x)
LIB_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE
TEST_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE
endif
CC_PROFILE := $(filter monotouch% xammac, $(PROFILE))
ifdef CC_PROFILE

View File

@@ -535,8 +535,8 @@ ENC ("x-x-big5", 950),
MapCodePageDataItem( 500, 1252, "IBM500", 0), // "IBM EBCDIC (International)"
MapCodePageDataItem( 708, 1256, "ASMO-708", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (ASMO 708)"
// MapCodePageDataItem( 720, 1256, "DOS-720", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (DOS)"
// MapCodePageDataItem( 737, 1253, "ibm737", 0), // "Greek (DOS)"
// MapCodePageDataItem( 775, 1257, "ibm775", 0), // "Baltic (DOS)"
MapCodePageDataItem( 737, 1253, "ibm737", 0), // "Greek (DOS)"
MapCodePageDataItem( 775, 1257, "ibm775", 0), // "Baltic (DOS)"
MapCodePageDataItem( 850, 1252, "ibm850", 0), // "Western European (DOS)"
MapCodePageDataItem( 852, 1250, "ibm852", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Central European (DOS)"
MapCodePageDataItem( 855, 1252, "IBM855", 0), // "OEM Cyrillic"

View File

@@ -354,7 +354,7 @@ namespace System
throw new ArgumentOutOfRangeException("indexB", Environment.GetResourceString("ArgumentOutOfRange_Index"));
return CompareOrdinalUnchecked (strA, indexA, count, strB, indexB, count);
}
}
unsafe String ReplaceInternal (char oldChar, char newChar)
{
@@ -501,7 +501,7 @@ namespace System
while (p < end) {
*p++ = paddingChar;
}
} else {
} else {
char *p = dest;
char *end = p + totalWidth - m_stringLength;
while (p < end) {
@@ -768,5 +768,16 @@ namespace System
return result;
}
[IndexerName ("Chars")]
public char this [int index] {
[IntrinsicAttribute]
get {
if ((uint)index >= m_stringLength)
ThrowHelper.ThrowIndexOutOfRangeException ();
return Unsafe.Add (ref m_firstChar, index);
}
}
}
}

View File

@@ -56,6 +56,7 @@ namespace System.Diagnostics {
}
public const int METHODS_TO_SKIP = 0;
const string prefix = " at ";
private StackFrame[] frames;
readonly StackTrace[] captured_traces;
@@ -198,31 +199,25 @@ namespace System.Diagnostics {
bool AddFrames (StringBuilder sb)
{
string debugInfo, indentation;
string unknown = Locale.GetText ("<unknown method>");
bool any_frame = false;
indentation = " ";
debugInfo = Locale.GetText (" in {0}:{1} ");
var newline = String.Format ("{0}{1}{2} ", Environment.NewLine, indentation,
Locale.GetText ("at"));
int i;
for (i = 0; i < FrameCount; i++) {
for (int i = 0; i < FrameCount; i++) {
StackFrame frame = GetFrame (i);
if (i == 0)
sb.AppendFormat ("{0}{1} ", indentation, Locale.GetText ("at"));
else
sb.Append (newline);
if (frame.GetMethod () == null) {
if (any_frame)
sb.Append (Environment.NewLine);
sb.Append (prefix);
string internal_name = frame.GetInternalMethodName ();
if (internal_name != null)
sb.Append (internal_name);
else
sb.AppendFormat ("<0x{0:x5} + 0x{1:x5}> {2}", frame.GetMethodAddress (), frame.GetNativeOffset (), unknown);
sb.AppendFormat ("<0x{0:x5} + 0x{1:x5}> <unknown method>", frame.GetMethodAddress (), frame.GetNativeOffset ());
} else {
GetFullNameForStackTrace (sb, frame.GetMethod ());
GetFullNameForStackTrace (sb, frame.GetMethod (), any_frame, out var skipped);
if (skipped)
continue;
if (frame.GetILOffset () == -1) {
sb.AppendFormat (" <0x{0:x5} + 0x{1:x5}>", frame.GetMethodAddress (), frame.GetNativeOffset ());
@@ -243,34 +238,48 @@ namespace System.Diagnostics {
}
}
sb.AppendFormat (debugInfo, filename, frame.GetFileLineNumber ());
sb.AppendFormat (" in {0}:{1} ", filename, frame.GetFileLineNumber ());
}
any_frame = true;
}
return i != 0;
return any_frame;
}
internal void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi)
void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi, bool needsNewLine, out bool skipped)
{
var declaringType = mi.DeclaringType;
if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition)
declaringType = declaringType.GetGenericTypeDefinition ();
// Get generic definition
const BindingFlags bindingflags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
foreach (var m in declaringType.GetMethods (bindingflags)) {
if (m.MetadataToken == mi.MetadataToken) {
mi = m;
break;
if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition) {
declaringType = declaringType.GetGenericTypeDefinition ();
const BindingFlags bindingflags = BindingFlags.Instance | BindingFlags.Static |
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
foreach (var m in declaringType.GetMethods (bindingflags)) {
if (m.MetadataToken == mi.MetadataToken) {
mi = m;
break;
}
}
}
skipped = mi.IsDefined (typeof(StackTraceHiddenAttribute)) || declaringType.IsDefined (typeof(StackTraceHiddenAttribute));
if (skipped)
return;
if (needsNewLine)
sb.Append (Environment.NewLine);
sb.Append (prefix);
sb.Append (declaringType.ToString ());
sb.Append (".");
sb.Append (mi.Name);
if (mi.IsGenericMethod) {
mi = ((MethodInfo)mi).GetGenericMethodDefinition ();
Type[] gen_params = mi.GetGenericArguments ();
sb.Append ("[");
for (int j = 0; j < gen_params.Length; j++) {
@@ -300,7 +309,7 @@ namespace System.Diagnostics {
}
}
sb.Append (")");
}
}
public override string ToString ()
{

View File

@@ -810,12 +810,19 @@ namespace System.IO.IsolatedStorage {
DirectoryInfo[] subdirs = directory.GetDirectories (path);
// we're looking for a single result, identical to path (no pattern here)
// we're also looking for something under the current path (not outside isolated storage)
if ((subdirs.Length == 1) && (subdirs [0].Name == path) && (subdirs [0].FullName.IndexOf (directory.FullName) >= 0)) {
afi = subdirs [0].GetFiles (pattern);
} else {
// CAS, even in FullTrust, normally enforce IsolatedStorage
throw new SecurityException ();
}
if (subdirs.Length != 1)
throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage
//the base directory must be the prefix of the subdir
if (!subdirs [0].FullName.StartsWith (directory.FullName))
throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage
//the subdir suffix must be equal to the provided one
var subdir_suffix = subdirs [0].FullName.Substring (directory.FullName.Length + 1); //skip the dir separator
if (subdir_suffix != path)
throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage
afi = subdirs [0].GetFiles (pattern);
}
return GetNames (afi);

View File

@@ -456,7 +456,10 @@ namespace System.Reflection {
return (cultureinfo == null)? null : cultureinfo.Name;
}
set {
throw new NotImplementedException ();
if (value == null)
cultureinfo = null;
else
cultureinfo = new CultureInfo (value);
}
}

View File

@@ -111,19 +111,15 @@ namespace System.Security.Cryptography.X509Certificates {
internal X509Certificate (X509CertificateImpl impl)
{
if (impl == null)
throw new ArgumentNullException ("impl");
this.impl = X509Helper.InitFromCertificate (impl);
}
public X509Certificate (System.Security.Cryptography.X509Certificates.X509Certificate cert)
public X509Certificate (X509Certificate cert)
{
if (cert == null)
throw new ArgumentNullException ("cert");
impl = X509Helper.InitFromCertificate (cert);
hideDates = false;
}
internal void ImportHandle (X509CertificateImpl impl)
@@ -134,7 +130,6 @@ namespace System.Security.Cryptography.X509Certificates {
internal X509CertificateImpl Impl {
get {
X509Helper.ThrowIfContextInvalid (impl);
return impl;
}
}

View File

@@ -136,7 +136,9 @@ namespace System.Security.Cryptography.X509Certificates
public static X509CertificateImpl InitFromCertificate (X509CertificateImpl impl)
{
ThrowIfContextInvalid (impl);
if (impl == null)
return null;
var copy = impl.Clone ();
if (copy != null)
return copy;

View File

@@ -30,7 +30,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if FULL_AOT_RUNTIME
#if !FEATURE_CRYPTO_CONFIGURABLE
// This is a special version of CryptoConfig that is not configurable and
// every "choice" is statiscally compiled. As long as CreateFromName is not
@@ -38,17 +38,13 @@
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Collections.Generic;
namespace System.Security.Cryptography {
[ComVisible (true)]
public partial class CryptoConfig {
public static void AddAlgorithm (Type algorithm, params string[] names)
{
throw new PlatformNotSupportedException ();
}
public static void AddOID (string oid, params string[] names)
{
throw new PlatformNotSupportedException ();
@@ -61,12 +57,12 @@ namespace System.Security.Cryptography {
return CreateFromName (name, null);
}
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
public static object CreateFromName (string name, params object[] args)
{
if (name == null)
throw new ArgumentNullException ("name");
// TODO: These ignore args
switch (name.ToLowerInvariant ()) {
case "system.security.cryptography.dsacryptoserviceprovider":
case "system.security.cryptography.dsa":
@@ -94,6 +90,7 @@ namespace System.Security.Cryptography {
case "system.security.cryptography.hmac":
case "system.security.cryptography.hmacsha1":
case "hmacsha1":
case "http://www.w3.org/2000/09/xmldsig#hmac-sha1":
return new HMACSHA1 ();
case "system.security.cryptography.hmacsha256":
case "hmacsha256":
@@ -155,8 +152,8 @@ namespace System.Security.Cryptography {
case "system.security.cryptography.hashalgorithm":
case "system.security.cryptography.sha1":
case "system.security.cryptography.sha1cryptoserviceprovider":
case "system.security.cryptography.sha1cng":
case "sha1":
case "system.security.cryptography.sha1cng":
case "sha":
case "http://www.w3.org/2000/09/xmldsig#sha1":
return new SHA1CryptoServiceProvider ();
@@ -192,23 +189,47 @@ namespace System.Security.Cryptography {
case "tripledes":
case "3des":
return new TripleDESCryptoServiceProvider ();
// These are not yet linker friendly
case "x509chain":
name = "System.Security.Cryptography.X509Certificates.X509Chain, System";
break;
case "2.5.29.15":
name = "System.Security.Cryptography.X509Certificates.X509KeyUsageExtension, System";
break;
case "2.5.29.19":
name = "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension, System";
break;
case "2.5.29.14":
name = "System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension, System";
break;
case "2.5.29.37":
name = "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension, System";
break;
case "aes":
#if FULL_AOT_DESKTOP // TODO: why is this special cased? we could use AesManaged like other full AOT profiles
name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core";
#else
#if MONOTOUCH || XAMMAC
name = "System.Security.Cryptography.AesManaged, System.Core";
#else
name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core";
#endif
break;
}
lock (lockObject) {
Type algoClass = null;
if (algorithms?.TryGetValue (name, out algoClass) == true) {
try {
return Activator.CreateInstance (algoClass, args);
} catch {
}
}
}
try {
// last resort, the request type might be available (if care is taken for the type not to be linked
// away) and that can allow some 3rd party code to work (e.g. extra algorithms) and make a few more
// unit tests happy
return Activator.CreateInstance (Type.GetType (name));
return Activator.CreateInstance (Type.GetType (name), args);
}
catch {
// method doesn't throw any exception
@@ -271,6 +292,11 @@ namespace System.Security.Cryptography {
return null;
}
}
static void Initialize ()
{
algorithms = new Dictionary<string, Type> (StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@@ -29,9 +29,43 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.Generic;
namespace System.Security.Cryptography {
public partial class CryptoConfig {
public partial class CryptoConfig
{
static readonly object lockObject = new object ();
static Dictionary<string,Type> algorithms;
public static void AddAlgorithm (Type algorithm, params string[] names)
{
if (algorithm == null)
throw new ArgumentNullException (nameof (algorithm));
if (!algorithm.IsVisible)
throw new ArgumentException ("Algorithms added to CryptoConfig must be accessable from outside their assembly.", nameof (algorithm));
if (names == null)
throw new ArgumentNullException (nameof (names));
var algorithmNames = new string [names.Length];
Array.Copy (names, algorithmNames, algorithmNames.Length);
foreach (string name in algorithmNames) {
if (string.IsNullOrEmpty (name)) {
throw new ArgumentException ("CryptoConfig cannot add a mapping for a null or empty name.");
}
}
lock (lockObject) {
if (algorithms == null) {
Initialize ();
}
foreach (string name in algorithmNames) {
algorithms [name] = algorithm;
}
}
}
public static byte[] EncodeOID (string str)
{

View File

@@ -30,7 +30,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !FULL_AOT_RUNTIME
#if FEATURE_CRYPTO_CONFIGURABLE
using System.Collections;
using System.Collections.Generic;
@@ -50,8 +50,6 @@ namespace System.Security.Cryptography {
[ComVisible (true)]
public partial class CryptoConfig {
static private object lockObject;
static private Dictionary<string,Type> algorithms;
static private Dictionary<string,string> unresolved_algorithms;
static private Dictionary<string,string> oids;
@@ -204,6 +202,7 @@ public partial class CryptoConfig {
private const string urlSHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
private const string urlSHA384 = "http://www.w3.org/2001/04/xmldsig-more#sha384";
private const string urlSHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
private const string urlHMACSHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
private const string urlHMACSHA256 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256";
private const string urlHMACSHA384 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384";
private const string urlHMACSHA512 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";
@@ -280,12 +279,6 @@ public partial class CryptoConfig {
// SHA512 provider
const string nameSHA512Provider = "System.Security.Cryptography.SHA512CryptoServiceProvider";
const string defaultSHA512Provider = "System.Security.Cryptography.SHA512CryptoServiceProvider" + system_core_assembly;
static CryptoConfig ()
{
// lock(this) is bad
// http://msdn.microsoft.com/library/en-us/dnaskdr/html/askgui06032003.asp?frame=true
lockObject = new object ();
}
private static void Initialize ()
{
@@ -384,6 +377,7 @@ public partial class CryptoConfig {
algorithms.Add (urlSHA256, defaultSHA256);
algorithms.Add (urlSHA384, defaultSHA384);
algorithms.Add (urlSHA512, defaultSHA512);
algorithms.Add (urlHMACSHA1, defaultHMAC);
algorithms.Add (urlHMACSHA256, defaultHMACSHA256);
algorithms.Add (urlHMACSHA384, defaultHMACSHA384);
algorithms.Add (urlHMACSHA512, defaultHMACSHA512);
@@ -560,20 +554,6 @@ public partial class CryptoConfig {
return result;
}
public static void AddAlgorithm (Type algorithm, params string[] names)
{
if (algorithm == null)
throw new ArgumentNullException ("algorithm");
if (names == null)
throw new ArgumentNullException ("names");
foreach (string name in names) {
if (String.IsNullOrWhiteSpace (name))
throw new ArithmeticException ("names");
algorithms [name] = algorithm;
}
}
public static void AddOID (string oid, params string[] names)
{
if (oid == null)

View File

@@ -311,7 +311,7 @@ namespace System.Threading {
// Returns the system thread handle
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern IntPtr Thread_internal (MulticastDelegate start);
private extern bool Thread_internal (MulticastDelegate start);
private Thread (InternalThread it) {
internal_thread = it;
@@ -484,7 +484,7 @@ namespace System.Threading {
#endif
// Thread_internal creates and starts the new thread,
if (Thread_internal(m_Delegate) == IntPtr.Zero)
if (!Thread_internal(m_Delegate))
throw new SystemException ("Thread creation failed.");
m_ThreadStartArg = null;

View File

@@ -47,12 +47,68 @@ namespace System.Threading
internal const int MaxWaitHandles = 64;
// We rely on the reference source implementation of WaitHandle, and it delegates to a function named
// WaitOneNative to perform the actual operation of waiting on a handle.
// This native operation actually has to call back into managed code and invoke .Wait
// on the current SynchronizationContext. As such, our implementation of this "native" method
// is actually managed code, and the real native icall being used is Wait_internal.
static int WaitOneNative (SafeHandle waitableSafeHandle, uint millisecondsTimeout, bool hasThreadAffinity, bool exitContext)
{
bool release = false;
#if !MONODROID
var context = SynchronizationContext.Current;
#endif
try {
waitableSafeHandle.DangerousAddRef (ref release);
#if !DISABLE_REMOTING
if (exitContext)
SynchronizationAttribute.ExitContext ();
#endif
#if !MONODROID
// HACK: Documentation (and public posts by experts like Joe Duffy) suggests that
// users must first call SetWaitNotificationRequired to flag that a given synchronization
// context overrides .Wait. Because invoking the Wait method is somewhat expensive, we use
// the notification-required flag to determine whether or not we should invoke the managed
// wait method.
// Another option would be to check whether this context uses the default Wait implementation,
// but I don't know of a cheap way to do this that handles derived types correctly.
// If the thread does not have a synchronization context set at all, we can safely just
// jump directly to invoking Wait_internal.
if ((context != null) && context.IsWaitNotificationRequired ()) {
return context.Wait (
new IntPtr[] { waitableSafeHandle.DangerousGetHandle () },
false,
(int)millisecondsTimeout
);
} else
#endif
{
unsafe {
IntPtr handle = waitableSafeHandle.DangerousGetHandle ();
return Wait_internal (&handle, 1, false, (int)millisecondsTimeout);
}
}
} finally {
if (release)
waitableSafeHandle.DangerousRelease ();
#if !DISABLE_REMOTING
if (exitContext)
SynchronizationAttribute.EnterContext ();
#endif
}
}
static int WaitMultiple(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext, bool WaitAll)
{
if (waitHandles.Length > MaxWaitHandles)
return WAIT_FAILED;
int release_last = -1;
var context = SynchronizationContext.Current;
try {
#if !DISABLE_REMOTING
@@ -70,45 +126,31 @@ namespace System.Threading
}
}
unsafe {
IntPtr* handles = stackalloc IntPtr[waitHandles.Length];
if ((context != null) && context.IsWaitNotificationRequired ()) {
IntPtr[] handles = new IntPtr[waitHandles.Length];
for (int i = 0; i < waitHandles.Length; ++i)
handles[i] = waitHandles[i].SafeWaitHandle.DangerousGetHandle ();
return Wait_internal(handles, waitHandles.Length, WaitAll, millisecondsTimeout);
return context.Wait (
handles,
false,
(int)millisecondsTimeout
);
} else {
unsafe {
IntPtr* handles = stackalloc IntPtr[waitHandles.Length];
for (int i = 0; i < waitHandles.Length; ++i)
handles[i] = waitHandles[i].SafeWaitHandle.DangerousGetHandle ();
return Wait_internal (handles, waitHandles.Length, WaitAll, millisecondsTimeout);
}
}
} finally {
for (int i = release_last; i >= 0; --i) {
waitHandles [i].SafeWaitHandle.DangerousRelease ();
}
#if !DISABLE_REMOTING
if (exitContext)
SynchronizationAttribute.EnterContext ();
#endif
}
}
static int WaitOneNative (SafeHandle waitableSafeHandle, uint millisecondsTimeout, bool hasThreadAffinity, bool exitContext)
{
bool release = false;
try {
#if !DISABLE_REMOTING
if (exitContext)
SynchronizationAttribute.ExitContext ();
#endif
waitableSafeHandle.DangerousAddRef (ref release);
unsafe {
IntPtr handle = waitableSafeHandle.DangerousGetHandle();
return Wait_internal(&handle, 1, false, (int)millisecondsTimeout);
}
} finally {
if (release)
waitableSafeHandle.DangerousRelease ();
#if !DISABLE_REMOTING
if (exitContext)
SynchronizationAttribute.EnterContext ();
@@ -117,7 +159,7 @@ namespace System.Threading
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe static extern int Wait_internal(IntPtr* handles, int numHandles, bool waitAll, int ms);
internal unsafe static extern int Wait_internal(IntPtr* handles, int numHandles, bool waitAll, int ms);
static int SignalAndWaitOne (SafeWaitHandle waitHandleToSignal,SafeWaitHandle waitHandleToWaitOn, int millisecondsTimeout, bool hasThreadAffinity, bool exitContext)
{

View File

@@ -36,6 +36,7 @@ using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
namespace System
{
@@ -751,16 +752,12 @@ namespace System
}
}
delegate void InternalCancelHandler ();
#pragma warning disable 414
//
// Used by console-io.c
//
static readonly InternalCancelHandler cancel_handler = new InternalCancelHandler (DoConsoleCancelEvent);
#pragma warning restore 414
static void DoConsoleCancelEventInBackground ()
{
ThreadPool.UnsafeQueueUserWorkItem (_ => DoConsoleCancelEvent(), null);
}
internal static void DoConsoleCancelEvent ()
static void DoConsoleCancelEvent ()
{
bool exit = true;
if (cancel_event != null) {

View File

@@ -134,6 +134,8 @@ namespace System
if (!match) {
if (delArgType.IsEnum && Enum.GetUnderlyingType (delArgType) == argType)
match = true;
else if (argType.IsEnum && Enum.GetUnderlyingType (argType) == delArgType)
match = true;
}
return match;

View File

@@ -266,11 +266,12 @@ namespace System
}
}
#if LIBC
const string DefaultTimeZoneDirectory = "/usr/share/zoneinfo";
static string timeZoneDirectory;
static string TimeZoneDirectory {
get {
if (timeZoneDirectory == null)
timeZoneDirectory = "/usr/share/zoneinfo";
timeZoneDirectory = readlink (DefaultTimeZoneDirectory) ?? DefaultTimeZoneDirectory;
return timeZoneDirectory;
}
set {

View File

@@ -1 +1 @@
a038b6c7fdad81fce73b4e0580c8b1d0159a7920
ea5e716e270682aa982464368bc77d8d447869c8

View File

@@ -29,6 +29,8 @@ using MonoTests.System.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using NUnit;
using NUnit.Framework;
@@ -67,6 +69,7 @@ namespace MonoTests.System.Collections.Concurrent
}
[Test]
[Category ("MultiThreaded")]
public void AddParallelWithoutDuplicateTest ()
{
ParallelTestHelper.Repeat (delegate {
@@ -98,6 +101,7 @@ namespace MonoTests.System.Collections.Concurrent
}
[Test]
[Category ("MultiThreaded")]
public void RemoveParallelTest ()
{
ParallelTestHelper.Repeat (delegate {
@@ -362,5 +366,20 @@ namespace MonoTests.System.Collections.Concurrent
Assert.IsTrue (dict.Contains (validKeyPair));
Assert.IsFalse (dict.Contains (wrongKeyPair));
}
[Test]
public void SerializationRoundTrip ()
{
var bf = new BinaryFormatter();
var cd = new ConcurrentDictionary<int, int>();
cd[0] = 42;
var ms = new MemoryStream();
bf.Serialize(ms, cd);
ms.Seek(0, SeekOrigin.Begin);
var result = (ConcurrentDictionary<int, int>) bf.Deserialize(ms);
Assert.AreEqual (42, result [0]);
}
}
}

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