Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -78,6 +78,9 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo ("System.Numerics, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")]
#if MONOTOUCH
#if MONOTOUCH_TV
[assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]

View File

@@ -1,5 +1,5 @@
//
// SecRandom.cs: based on Mono's System.Security.Cryptography.RNGCryptoServiceProvider
// RngCryptoServiceProvider.cryptor.cs: based on Mono's System.Security.Cryptography.RNGCryptoServiceProvider
//
// Authors:
// Mark Crichton (crichton@gimp.org)
@@ -32,6 +32,8 @@
using Crimson.CommonCrypto;
// http://developer.apple.com/library/ios/#DOCUMENTATION/Security/Reference/RandomizationReference/Reference/reference.html
// we need to use the CommonCrypto implementation instead of the runtime-supported RNGCryptoServiceProvider
// since we have no guarantee (on iOS) about /dev/[u]random availability or quality
#if MONOTOUCH || XAMMAC
namespace System.Security.Cryptography {
public class RNGCryptoServiceProvider : RandomNumberGenerator {
@@ -54,14 +56,6 @@ namespace System.Security.Cryptography {
~RNGCryptoServiceProvider ()
{
}
#else
using System;
using System.Security.Cryptography;
namespace Crimson.Security.Cryptography {
public class SecRandom : RandomNumberGenerator {
#endif
public override void GetBytes (byte[] data)
{
@@ -90,4 +84,5 @@ namespace Crimson.Security.Cryptography {
}
}
}
}
}
#endif

View File

@@ -1,3 +1,4 @@
#if MONO_FEATURE_APPLETLS || MONO_FEATURE_APPLE_X509
using System;
using System.Runtime.InteropServices;
@@ -108,3 +109,4 @@ namespace XamMac.CoreFoundation
}
}
}
#endif

View File

@@ -11,21 +11,24 @@ LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%)
#LIBRARY_USE_INTERMEDIATE_FILE = yes
ifeq (2, $(FRAMEWORK_VERSION_MAJOR))
LIB_MCS_FLAGS += --runtime:v4
LIB_MCS_FLAGS += -runtimemetadataversion:v4.0.30319
else
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
LIB_MCS_FLAGS += --runtime:v4
LIB_MCS_FLAGS += -runtimemetadataversion:v4.0.30319
else
$(error Unknown framework version)
endif
endif
ifeq ($(PROFILE),build)
CSC_RUNTIME_FLAGS=--profile=aot:output=$(topdir)/class/lib/build/csc.aotprofile
CSC_RUNTIME_FLAGS=--profile=aot:output=$(topdir)/class/lib/$(PROFILE)/csc.$(LIBRARY).aotprofile
endif
RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt
RESX_RESOURCE_STRING = \
../../../external/corert/src/System.Private.CoreLib/src/Resources/Strings.resx
LIBRARY_COMPILE = $(BOOT_COMPILE)
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
@@ -39,13 +42,13 @@ RESOURCE_FILES = \
resources/collation.cjkKO.bin \
resources/collation.cjkKOlv2.bin
REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS
ifndef MOBILE_PROFILE
REFERENCE_SOURCES_FLAGS += -d:FEATURE_MACL
endif
ifndef MOBILE_STATIC
ifndef AOT_FRIENDLY_PROFILE
REFERENCE_SOURCES_FLAGS += -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY
endif
@@ -64,15 +67,33 @@ REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_MULTIPLE_APPDOMAINS
TEST_MCS_FLAGS += -d:MONO_FEATURE_MULTIPLE_APPDOMAINS
endif
ifndef NO_CONSOLE
LIB_MCS_FLAGS += -d:MONO_FEATURE_CONSOLE
endif
ifdef MONO_FEATURE_APPLETLS
LIB_MCS_FLAGS += -d:MONO_FEATURE_APPLETLS
endif
ifdef ONLY_APPLETLS
LIB_MCS_FLAGS += -d:ONLY_APPLETLS
endif
ifdef MONO_FEATURE_APPLE_X509
LIB_MCS_FLAGS += -d:MONO_FEATURE_APPLE_X509
endif
WARNING_ABOUT_DISABLED_WARNING=1635
LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618,$(WARNING_ABOUT_DISABLED_WARNING) -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS)
DEFAULT_REFERENCES =
TEST_LIB_REFS = System.Core System
ifndef MOBILE_STATIC
ifndef AOT_FRIENDLY_PROFILE
ifneq ($(PROFILE),testing_aot_hybrid)
TEST_LIB_REFS += Mono.Posix
endif
endif
# System.IO/DirectoryInfoTest.cs needs Mono.Posix
TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe \

View File

@@ -30,7 +30,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if WIN_PLATFORM
using System;
using System.Text;

View File

@@ -43,7 +43,7 @@ using Microsoft.Win32.SafeHandles;
namespace Microsoft.Win32
{
#if MOBILE
#if MOBILE && !WIN_PLATFORM
public sealed class RegistryKey : IDisposable
{
internal RegistryKey (RegistryHive hiveId)

View File

@@ -27,7 +27,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if WIN_PLATFORM
namespace Microsoft.Win32
{
public enum RegistryKeyPermissionCheck

View File

@@ -37,7 +37,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if WIN_PLATFORM
using System;
using System.Collections;

View File

@@ -33,7 +33,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if WIN_PLATFORM
using System;
using System.Collections;
@@ -92,14 +92,17 @@ namespace Microsoft.Win32
[DllImport ("advapi32.dll", CharSet=CharSet.Unicode, EntryPoint="RegDeleteValue")]
private static extern int RegDeleteValue (IntPtr keyHandle, string valueName);
[DllImport ("advapi32.dll", CharSet=CharSet.Unicode, EntryPoint="RegEnumKey")]
private static extern int RegEnumKey (IntPtr keyBase, int index, StringBuilder nameBuffer, int bufferLength);
[DllImport ("advapi32.dll", CharSet=CharSet.Unicode, EntryPoint="RegEnumKeyExW")]
internal unsafe static extern int RegEnumKeyEx (IntPtr keyHandle, int dwIndex,
char* lpName, ref int lpcbName, int[] lpReserved,
[Out]StringBuilder lpClass, int[] lpcbClass,
long[] lpftLastWriteTime);
[DllImport ("advapi32.dll", CharSet=CharSet.Unicode, EntryPoint="RegEnumValue")]
private static extern int RegEnumValue (IntPtr keyBase,
int index, StringBuilder nameBuffer,
ref int nameLength, IntPtr reserved,
ref RegistryValueKind type, IntPtr data, IntPtr dataLength);
internal unsafe static extern int RegEnumValue (IntPtr hKey, int dwIndex,
char* lpValueName, ref int lpcbValueName,
IntPtr lpReserved_MustBeZero, int[] lpType, byte[] lpData,
int[] lpcbData);
// [DllImport ("advapi32.dll", CharSet=CharSet.Unicode, EntryPoint="RegSetValueEx")]
// private static extern int RegSetValueEx (IntPtr keyBase,
@@ -146,6 +149,14 @@ namespace Microsoft.Win32
string valueName, IntPtr reserved, ref RegistryValueKind type,
ref long data, ref int dataSize);
[DllImport ("advapi32.dll", CharSet = CharSet.Unicode, EntryPoint="RegQueryInfoKeyW")]
internal static extern int RegQueryInfoKey (IntPtr hKey, [Out]StringBuilder lpClass,
int[] lpcbClass, IntPtr lpReserved_MustBeZero, ref int lpcSubKeys,
int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen,
ref int lpcValues, int[] lpcbMaxValueNameLen,
int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor,
int[] lpftLastWriteTime);
// Returns our handle from the RegistryKey
public IntPtr GetHandle (RegistryKey key)
{
@@ -355,59 +366,54 @@ namespace Microsoft.Win32
return result;
}
// Arbitrary max size for key/values names that can be fetched.
// .NET framework SDK docs say that the max name length that can
// be used is 255 characters, we'll allow for a bit more.
const int BufferMaxLength = 1024;
// MSDN defines the following limits for registry key names & values:
// Key Name: 255 characters
// Value name: 16,383 Unicode characters
// Value: either 1 MB or current available memory, depending on registry format.
private const int MaxKeyLength = 255;
private const int MaxValueLength = 16383;
public int SubKeyCount (RegistryKey rkey)
{
int index;
StringBuilder stringBuffer = new StringBuilder (BufferMaxLength);
IntPtr handle = GetHandle (rkey);
for (index = 0; true; index ++) {
int result = RegEnumKey (handle, index, stringBuffer,
stringBuffer.Capacity);
int subkeys = 0;
int junk = 0;
int ret = RegQueryInfoKey (GetHandle (rkey),
null,
null,
IntPtr.Zero,
ref subkeys, // subkeys
null,
null,
ref junk, // values
null,
null,
null,
null);
if (result == Win32ResultCode.Success)
continue;
if (result == Win32ResultCode.NoMoreEntries)
break;
// something is wrong!!
GenerateException (result);
}
return index;
if (ret != Win32ResultCode.Success)
GenerateException (ret);
return subkeys;
}
public int ValueCount (RegistryKey rkey)
{
int index, result, bufferCapacity;
RegistryValueKind type;
StringBuilder buffer = new StringBuilder (BufferMaxLength);
IntPtr handle = GetHandle (rkey);
for (index = 0; true; index ++) {
type = 0;
bufferCapacity = buffer.Capacity;
result = RegEnumValue (handle, index,
buffer, ref bufferCapacity,
IntPtr.Zero, ref type,
IntPtr.Zero, IntPtr.Zero);
if (result == Win32ResultCode.Success || result == Win32ResultCode.MoreData)
continue;
if (result == Win32ResultCode.NoMoreEntries)
break;
// something is wrong
GenerateException (result);
}
return index;
int values = 0;
int junk = 0;
int ret = RegQueryInfoKey (GetHandle (rkey),
null,
null,
IntPtr.Zero,
ref junk, // subkeys
null,
null,
ref values, // values
null,
null,
null,
null);
if (ret != Win32ResultCode.Success)
GenerateException (ret);
return values;
}
public RegistryKey OpenRemoteBaseKey (RegistryHive hKey, string machineName)
@@ -536,57 +542,70 @@ namespace Microsoft.Win32
GenerateException (result);
}
public string [] GetSubKeyNames (RegistryKey rkey)
public unsafe string [] GetSubKeyNames (RegistryKey rkey)
{
IntPtr handle = GetHandle (rkey);
StringBuilder buffer = new StringBuilder (BufferMaxLength);
var keys = new List<string> ();
for (int index = 0; true; index ++) {
int result = RegEnumKey (handle, index, buffer, buffer.Capacity);
int subkeys = SubKeyCount (rkey);
var names = new string [subkeys]; // Returns 0-length array if empty.
if (result == Win32ResultCode.Success) {
keys.Add (buffer.ToString ());
buffer.Length = 0;
continue;
if (subkeys > 0) {
var hkey = GetHandle (rkey);
char[] name = new char [MaxKeyLength + 1];
int namelen;
fixed (char* namePtr = &name [0]) {
for (int i = 0; i < subkeys; i++) {
namelen = name.Length; // Don't remove this. The API's doesn't work if this is not properly initialised.
int ret = RegEnumKeyEx (hkey,
i,
namePtr,
ref namelen,
null,
null,
null,
null);
if (ret != 0)
GenerateException (ret);
names [i] = new String (namePtr);
}
}
if (result == Win32ResultCode.NoMoreEntries)
break;
// should not be here!
GenerateException (result);
}
return keys.ToArray ();
return names;
}
public string [] GetValueNames (RegistryKey rkey)
public unsafe string [] GetValueNames (RegistryKey rkey)
{
IntPtr handle = GetHandle (rkey);
var values = new List<string> ();
for (int index = 0; true; index ++)
{
StringBuilder buffer = new StringBuilder (BufferMaxLength);
int bufferCapacity = buffer.Capacity;
RegistryValueKind type = 0;
int result = RegEnumValue (handle, index, buffer, ref bufferCapacity,
IntPtr.Zero, ref type, IntPtr.Zero, IntPtr.Zero);
int values = ValueCount (rkey);
String[] names = new String [values];
if (result == Win32ResultCode.Success || result == Win32ResultCode.MoreData) {
values.Add (buffer.ToString ());
continue;
if (values > 0) {
IntPtr hkey = GetHandle (rkey);
char[] name = new char [MaxValueLength + 1];
int namelen;
fixed (char* namePtr = &name [0]) {
for (int i = 0; i < values; i++) {
namelen = name.Length;
int ret = RegEnumValue (hkey,
i,
namePtr,
ref namelen,
IntPtr.Zero,
null,
null,
null);
if (ret != Win32ResultCode.Success && ret != Win32Native.ERROR_MORE_DATA)
GenerateException (ret);
names [i] = new String (namePtr);
}
}
if (result == Win32ResultCode.NoMoreEntries)
break;
GenerateException (result);
}
return values.ToArray ();
return names;
}
private void CheckResult (int result)

View File

@@ -30,7 +30,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if WIN_PLATFORM
using System;
using System.Runtime.InteropServices;

View File

@@ -60,6 +60,6 @@ namespace Mono {
}
[MethodImpl (MethodImplOptions.InternalCall)]
internal static extern void FreeAssemblyName (ref MonoAssemblyName name);
internal static extern void FreeAssemblyName (ref MonoAssemblyName name, bool freeStruct);
}
}

View File

@@ -6,11 +6,6 @@ namespace System {
public partial class AppDomain
{
internal String GetTargetFrameworkName()
{
return ".NETFramework,Version=v4.5";
}
internal static bool IsAppXModel ()
{
return false;

View File

@@ -0,0 +1,8 @@
namespace System.Runtime.Versioning
{
static class BinaryCompatibility
{
public static readonly bool TargetsAtLeast_Desktop_V4_5 = true;
public static readonly bool TargetsAtLeast_Desktop_V4_5_1 = true;
}
}

View File

@@ -30,7 +30,7 @@ namespace System
{
static class CompatibilitySwitches
{
public const bool IsAppEarlierThanSilverlight4 = false;
public const bool IsAppEarlierThanWindowsPhone8 = false;
public static readonly bool IsAppEarlierThanSilverlight4 = false;
public static readonly bool IsAppEarlierThanWindowsPhone8 = false;
}
}

View File

@@ -6,5 +6,10 @@ namespace System.IO
{
return false;
}
public static bool HasIllegalCharacters (string path, bool checkAdditional)
{
return path.IndexOfAny (Path.InvalidPathChars) != -1;
}
}
}

View File

@@ -140,15 +140,15 @@ namespace System
internal Object CreateInstanceSlow(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark)
{
bool bNeedSecurityCheck = true;
bool bCanBeCached = false;
bool bSecurityCheckOff = false;
//bool bNeedSecurityCheck = true;
//bool bCanBeCached = false;
//bool bSecurityCheckOff = false;
if (!skipCheckThis)
CreateInstanceCheckThis();
if (!fillCache)
bSecurityCheckOff = true;
//if (!fillCache)
// bSecurityCheckOff = true;
return CreateInstanceMono (!publicOnly);
}

View File

@@ -345,15 +345,13 @@ namespace System
unsafe String ReplaceInternal (char oldChar, char newChar)
{
#if !BOOTSTRAP_BASIC
if (this.m_stringLength == 0 || oldChar == newChar)
return this;
#endif
int start_pos = IndexOfUnchecked (oldChar, 0, this.m_stringLength);
#if !BOOTSTRAP_BASIC
if (start_pos == -1)
return this;
#endif
if (start_pos < 4)
start_pos = 0;
@@ -391,11 +389,8 @@ namespace System
throw new ArgumentException ("oldValue is the empty string.");
if (this.Length == 0)
#if BOOTSTRAP_BASIC
throw new NotImplementedException ("BOOTSTRAP_BASIC");
#else
return this;
#endif
if (newValue == null)
newValue = Empty;
@@ -405,11 +400,7 @@ namespace System
private unsafe String ReplaceUnchecked (String oldValue, String newValue)
{
if (oldValue.m_stringLength > m_stringLength)
#if BOOTSTRAP_BASIC
throw new NotImplementedException ("BOOTSTRAP_BASIC");
#else
return this;
#endif
if (oldValue.m_stringLength == 1 && newValue.m_stringLength == 1) {
return Replace (oldValue[0], newValue[0]);
@@ -434,11 +425,8 @@ namespace System
i = found + oldValue.m_stringLength;
}
if (count == 0)
#if BOOTSTRAP_BASIC
throw new NotImplementedException ("BOOTSTRAP_BASIC");
#else
return this;
#endif
return this;
int nlen = 0;
checked {
try {
@@ -488,11 +476,8 @@ namespace System
if (totalWidth < 0)
throw new ArgumentOutOfRangeException ("totalWidth", "Non-negative number required");
if (totalWidth <= m_stringLength)
#if BOOTSTRAP_BASIC
throw new NotImplementedException ("BOOTSTRAP_BASIC");
#else
return this;
#endif
string result = FastAllocateString (totalWidth);
fixed (char *dest = result, src = &m_firstChar) {
@@ -518,11 +503,7 @@ namespace System
internal bool StartsWithOrdinalUnchecked (String value)
{
#if BOOTSTRAP_BASIC
throw new NotImplementedException ("BOOTSTRAP_BASIC");
#else
return m_stringLength >= value.m_stringLength && CompareOrdinalUnchecked (this, 0, value.m_stringLength, value, 0, value.m_stringLength) == 0;
#endif
}
internal unsafe bool IsAscii ()

View File

@@ -102,6 +102,12 @@ namespace System
return UnderlyingSystemType;
}
// Called from the runtime to return the corresponding finished Type object
internal virtual Type RuntimeResolve ()
{
throw new NotImplementedException ();
}
internal virtual bool IsUserType {
get {
return true;

View File

@@ -1,14 +0,0 @@
namespace System.Reflection.Emit
{
abstract class TypeBuilderInstantiation : TypeInfo
{
internal static Type MakeGenericType (Type type, Type[] typeArguments)
{
#if FULL_AOT_RUNTIME
throw new NotSupportedException ("User types are not supported under full aot");
#else
return new MonoGenericClass (type, typeArguments);
#endif
}
}
}

View File

@@ -1,4 +1,6 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace Microsoft.Win32
{
@@ -71,5 +73,11 @@ namespace Microsoft.Win32
{
}
internal class WIN32_FIND_DATA
{
internal int dwFileAttributes = 0;
internal String cFileName = null;
}
}
}

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