Imported Upstream version 4.4.0.142

Former-commit-id: 08ca4d6ded648b2ac2eb817c12d5723b52edbb16
This commit is contained in:
Xamarin Public Jenkins 2016-04-28 08:44:23 -04:00
parent d444f0caa4
commit 67cc8417df
39 changed files with 187 additions and 47 deletions

View File

@ -1 +1 @@
25ac5dd52e897440dac529dfcfe2034bdae89d53
da368cb9ffc9b4bfa0f5e04be9f4f6089f689736

View File

@ -1 +1 @@
3decb1ccc1162ebbe9663424f20f2ace97e2921f
fbb4acce7d31b7351f3c4b42e6f718441d9408c4

View File

@ -141,10 +141,16 @@ namespace System.Security.Cryptography
static Utils()
{
}
#if MONO
// The default provider value must remain '1' for Mono, otherwise we won't be able
// to locate keypairs that were serialized by Mono versions 4.0 and lower.
// (The ProviderType property in the CspParameters class affects serialization)
internal const int DefaultRsaProviderType = 1;
#else
// Provider type to use by default for RSA operations. We want to use RSA-AES CSP
// since it enables access to SHA-2 operations. All currently supported OSes support RSA-AES.
internal const int DefaultRsaProviderType = Constants.PROV_RSA_AES;
#endif
#if !MONO
#if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO

View File

@ -424,6 +424,10 @@ namespace MonoTests.Mono.Unix {
foreach (Thread t in threads)
t.Join ();
AssertCountSet (usignals);
// signal delivery might take some time, wait a bit before closing
// the UnixSignal so we can ignore it and not terminate the process
// when a SIGHUP/SIGTERM arrives afterwards
Thread.Sleep (1000);
CloseSignals (usignals);
}

View File

@ -6,6 +6,9 @@ LIBRARY = System.Net.Http.dll
LIB_REFS = System.Core System
LIB_MCS_FLAGS = $(EXTRA_LIB_MCS_FLAGS)
ifeq (monodroid,$(PROFILE))
LIB_MCS_FLAGS += -d:XAMARIN_MODERN
endif
TEST_MCS_FLAGS = -r:System.dll -r:System.Core.dll

View File

@ -0,0 +1,38 @@
using System;
using System.Reflection;
namespace System.Net.Http {
public partial class HttpClient {
public HttpClient ()
: this (GetDefaultHandler (), true)
{
}
static HttpMessageHandler GetDefaultHandler ()
{
Type type = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android");
if (type == null)
return GetFallback ("Invalid Mono.Android assembly? Cannot find Android.Runtime.AndroidEnvironment");
MethodInfo method = type.GetMethod ("GetHttpMessageHandler", BindingFlags.Static | BindingFlags.NonPublic);
if (method == null)
return GetFallback ("Your Xamarin.Android version does not support obtaining of the custom HttpClientHandler");
object ret = method.Invoke (null, null);
if (ret == null)
return GetFallback ("Xamarin.Android returned no custom HttpClientHandler");
var handler = ret as HttpMessageHandler;
if (handler == null)
return GetFallback ($"{ret?.GetType()} is not a valid HttpMessageHandler");
return handler;
}
static HttpMessageHandler GetFallback (string message)
{
Console.WriteLine (message + ". Defaulting to System.Net.Http.HttpClientHandler");
return new HttpClientHandler ();
}
}
}

View File

@ -0,0 +1,2 @@
#include System.Net.Http.dll.sources
System.Net.Http/HttpClient.android.cs

View File

@ -507,11 +507,15 @@ namespace System.Runtime.Serialization
} else {
var typeHandleValue = Type.GetTypeHandle (memberValue);
var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (memberValue, memberType, Globals.TypeOfObject));
if (isNullableOfT)
if (isNullableOfT) {
ctx.InternalSerialize (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
else
ctx.InternalSerializeReference (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
//InternalSerialize((isNullableOfT ? XmlFormatGeneratorStatics.InternalSerializeMethod : XmlFormatGeneratorStatics.InternalSerializeReferenceMethod), () => memberValue, memberType, writeXsiType);
} else if (memberType == Globals.TypeOfObject) {
var dataContract = DataContract.GetDataContract (memberValue.GetType());
writer.WriteAttributeQualifiedName (Globals.XsiPrefix, DictionaryGlobals.XsiTypeLocalName, DictionaryGlobals.SchemaInstanceNamespace, dataContract.Name, dataContract.Namespace);
ctx.InternalSerializeReference (writer, memberValue, false, false, -1, typeHandleValue);
} else {
ctx.InternalSerializeReference (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
}
}
}
}

View File

@ -122,5 +122,17 @@ namespace MonoTests.System.Runtime.Serialization
Assert.IsTrue (s.Contains ("<Flags>All</Flags>"));
}
}
// Bug #37116
[Test]
public void KeyPairOfAny ()
{
var dict = new Dictionary<string, object> ();
dict.Add ("test", new List<string> () { "test entry" });
var dcs = new DataContractSerializer (typeof(Dictionary<string, object>));
dcs.WriteObject (new MemoryStream (), dict);
// Should not throw exception.
}
}
}

View File

@ -101,16 +101,17 @@ namespace System.Security.Cryptography.X509Certificates {
}
}
static IntPtr GetCertificate (X509Certificate certificate, out IntPtr dataPtr)
static IntPtr GetCertificate (X509Certificate certificate)
{
var handle = certificate.Handle;
var handle = certificate.Impl.GetNativeAppleCertificate ();
if (handle != IntPtr.Zero) {
dataPtr = IntPtr.Zero;
CFRetain (handle);
return handle;
}
dataPtr = MakeCFData (certificate.GetRawCertData ());
return SecCertificateCreateWithData (IntPtr.Zero, dataPtr);
var dataPtr = MakeCFData (certificate.GetRawCertData ());
handle = SecCertificateCreateWithData (IntPtr.Zero, dataPtr);
CFRelease (dataPtr);
return handle;
}
public static SecTrustResult TrustEvaluateSsl (XX509CertificateCollection certificates, XX509CertificateCollection anchors, string host)
@ -129,9 +130,7 @@ namespace System.Security.Cryptography.X509Certificates {
{
int certCount = certificates.Count;
int anchorCount = anchors != null ? anchors.Count : 0;
IntPtr [] cfDataPtrs = new IntPtr [certCount];
IntPtr [] secCerts = new IntPtr [certCount];
IntPtr [] cfDataAnchorPtrs = new IntPtr [anchorCount];
IntPtr [] secCertAnchors = new IntPtr [anchorCount];
IntPtr certArray = IntPtr.Zero;
IntPtr anchorArray = IntPtr.Zero;
@ -142,13 +141,13 @@ namespace System.Security.Cryptography.X509Certificates {
try {
for (int i = 0; i < certCount; i++) {
secCerts [i] = GetCertificate (certificates [i], out cfDataPtrs [i]);
secCerts [i] = GetCertificate (certificates [i]);
if (secCerts [i] == IntPtr.Zero)
return SecTrustResult.Deny;
}
for (int i = 0; i < anchorCount; i++) {
secCertAnchors [i] = GetCertificate (anchors [i], out cfDataAnchorPtrs [i]);
secCertAnchors [i] = GetCertificate (anchors [i]);
if (secCertAnchors [i] == IntPtr.Zero)
return SecTrustResult.Deny;
}
@ -170,14 +169,6 @@ namespace System.Security.Cryptography.X509Certificates {
code = SecTrustEvaluate (sectrust, out result);
return result;
} finally {
for (int i = 0; i < certCount; i++)
if (cfDataPtrs [i] != IntPtr.Zero)
CFRelease (cfDataPtrs [i]);
for (int i = 0; i < anchorCount; i++)
if (cfDataAnchorPtrs [i] != IntPtr.Zero)
CFRelease (cfDataAnchorPtrs [i]);
if (certArray != IntPtr.Zero)
CFRelease (certArray);

View File

@ -72,6 +72,11 @@ namespace System.Security.Cryptography.X509Certificates
get { return IntPtr.Zero; }
}
public override IntPtr GetNativeAppleCertificate ()
{
return IntPtr.Zero;
}
internal X509Certificate2ImplMono (MX.X509Certificate cert)
{
this._cert = cert;

View File

@ -37,6 +37,11 @@ namespace System.Security.Cryptography.X509Certificates
get;
}
/*
* This is used in System.dll's OSX509Certificates.cs
*/
public abstract IntPtr GetNativeAppleCertificate ();
protected void ThrowIfContextInvalid ()
{
if (!IsValid)

View File

@ -34,7 +34,7 @@ using MX = Mono.Security.X509;
namespace System.Security.Cryptography.X509Certificates
{
class X509CertificateImplMono : X509CertificateImpl
sealed class X509CertificateImplMono : X509CertificateImpl
{
MX.X509Certificate x509;
@ -51,6 +51,11 @@ namespace System.Security.Cryptography.X509Certificates
get { return IntPtr.Zero; }
}
public override IntPtr GetNativeAppleCertificate ()
{
return IntPtr.Zero;
}
public override X509CertificateImpl Clone ()
{
ThrowIfContextInvalid ();

View File

@ -39,7 +39,7 @@ namespace MonoTests.System.Security.Cryptography {
public void Ctor ()
{
var cp = new CspParameters ();
Assert.AreEqual (24, cp.ProviderType);
Assert.AreEqual (1, cp.ProviderType);
}
}
}

View File

@ -1 +1 @@
8e64e5a6758d73dbf3d8c6fb3eb48c076357b70d
d75327e36d7b32dc9109603a62412b3e8aa159fe

View File

@ -1 +1 @@
5de7e54e585f6b49306081a2d825a268eae55a8b
d59fb29c1b13df4116b62d402850b1a5280b854b

View File

@ -1 +1 @@
7b90f739b90808c54955991f2ee7ade80d218166
dd524703971ceb5b9e38a37927cbf400b8445a80

View File

@ -1 +1 @@
bfba44fbb8c656079254fc346737ea8a4af5fd3e
f649c2b1ac18409b8acd361e63e55ffa77ad5bd3

46
mcs/tests/dtest-064.cs Normal file
View File

@ -0,0 +1,46 @@
using System;
public class A
{
public A (Action action)
{
}
}
public class B : A
{
public B ()
: base (() => {
dynamic d = 1;
Test (d);
})
{
}
static decimal Test (dynamic arg)
{
return 3m;
}
}
public class B2
{
public Action a = () => {
dynamic d = 1;
Test (d);
};
static decimal Test (dynamic arg)
{
return 3m;
}
}
class M
{
static void Main ()
{
new B ();
new B2 ();
}
}

View File

@ -1 +1 @@
de9fea39fc570d60a08eeeba6e5eef06352b9197
d7429bd8b329499d480f33072157e4c6b7cde1d2

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