Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -97,6 +97,10 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
#endif
#if MONODROID
[assembly: InternalsVisibleTo ("Mono.Android, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
#endif
[assembly: InternalsVisibleTo ("System.Net.Http, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]

View File

@@ -395,7 +395,7 @@
<!-- domain.c: mono_defaults.string_class -->
<type fullname="System.String" preserve="fields">
<!-- method-to-ir.c: mini_redirect_call -->
<method name="InternalAllocateStr" />
<method name="FastAllocateString" />
<!-- method-to-it.c: mini_emit_initobj -->
<method name="memset" />
<!-- mini-generic-sharing.c: class_type_info
@@ -843,9 +843,6 @@
-->
<type fullname="Mono.Runtime" preserve="nothing" />
<!-- marshal-ilgen.c (emit_native_icall_wrapper_ilgen) -->
<type fullname="Mono.RuntimeStructs/MonoError" />
<type fullname="System.Threading.WasmRuntime"/>
<!-- mini-generic-sharing.c -->

View File

@@ -48,14 +48,6 @@ namespace Mono {
internal IntPtr* data;
internal int len;
}
// mono-error.h MonoError
struct MonoError {
ushort error_code;
ushort hidden_0;
IntPtr hidden_1, hidden_2, hidden_3, hidden_4, hidden_5, hidden_6, hidden_7, hidden_8;
IntPtr hidden_11, hidden_12, hidden_13, hidden_14, hidden_15, hidden_16, hidden_17, hidden_18;
}
}
//Maps to metadata-internals.h:: MonoAssemblyName

View File

@@ -18,7 +18,12 @@ namespace Mono {
IntPtr marshaled_string;
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static IntPtr StringToUtf8 (string str);
extern static IntPtr StringToUtf8_icall (ref string str);
public static IntPtr StringToUtf8 (string str)
{
return StringToUtf8_icall (ref str);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static void GFree (IntPtr ptr);

View File

@@ -2,7 +2,7 @@ using System.Diagnostics;
namespace System
{
internal enum LogLevel {
internal enum BCLDebugLogLevel {
Trace = 0,
Status = 20,
Warning= 40,
@@ -33,7 +33,7 @@ namespace System
}
[Conditional("_DEBUG")]
public static void Log (string switchName, LogLevel level, params object[] messages)
public static void Log (string switchName, BCLDebugLogLevel level, params object[] messages)
{
}

View File

@@ -820,8 +820,9 @@ namespace System
public override string FullName {
get {
// https://bugzilla.xamarin.com/show_bug.cgi?id=57938
if (IsGenericType && ContainsGenericParameters && !IsGenericTypeDefinition)
// See https://github.com/mono/mono/issues/18180 and
// https://github.com/dotnet/runtime/blob/f23e2796ab5f6fea71c9fdacac024822280253db/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs#L1468-L1472
if (ContainsGenericParameters && !GetRootElementType().IsGenericTypeDefinition)
return null;
string fullName;

View File

@@ -100,7 +100,12 @@ namespace System.Diagnostics
/// A string representing the message to show.
/// </param>
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void Log(int level, string category, string message);
static extern void Log_icall (int level, ref string category, ref string message);
public static void Log (int level, string category, string message)
{
Log_icall (level, ref category, ref message);
}
public static void NotifyOfCrossThreadDependency ()
{

View File

@@ -1000,11 +1000,17 @@ namespace System {
}
#if MONO_FEATURE_MULTIPLE_APPDOMAINS
#if MONODROID
[Obsolete ("AppDomain.CreateDomain will no longer be supported in .NET 5 and later. Consider AssemblyLoadContext when it becomes available https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext")]
#endif
public static AppDomain CreateDomain (string friendlyName)
{
return CreateDomain (friendlyName, null, null);
}
#if MONODROID
[Obsolete ("AppDomain.CreateDomain will no longer be supported in .NET 5 and later. Consider AssemblyLoadContext when it becomes available https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext")]
#endif
public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo)
{
return CreateDomain (friendlyName, securityInfo, null);
@@ -1015,6 +1021,9 @@ namespace System {
[MonoLimitationAttribute ("Currently it does not allow the setup in the other domain")]
[SecurityPermission (SecurityAction.Demand, ControlAppDomain = true)]
#if MONODROID
[Obsolete ("AppDomain.CreateDomain will no longer be supported in .NET 5 and later. Consider AssemblyLoadContext when it becomes available https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext")]
#endif
public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup info)
{
if (friendlyName == null)

View File

@@ -110,6 +110,7 @@ namespace System
int length = this.Length;
for (int i = 0; i < length; i++) {
T value;
// Do not change this to call GetGenericValue_icall directly, due to special casing in the runtime.
GetGenericValueImpl (i, out value);
if (item == null){
if (value == null) {
@@ -138,6 +139,7 @@ namespace System
throw new ArgumentOutOfRangeException ("index");
T value;
// Do not change this to call GetGenericValue_icall directly, due to special casing in the runtime.
GetGenericValueImpl (index, out value);
return value;
}
@@ -165,6 +167,7 @@ namespace System
int length = this.Length;
for (int i = 0; i < length; i++) {
T value;
// Do not change this to call GetGenericValue_icall directly, due to special casing in the runtime.
GetGenericValueImpl (i, out value);
if (item == null){
if (value == null)
@@ -190,6 +193,7 @@ namespace System
throw new ArgumentOutOfRangeException ("index");
T value;
// Do not change this to call GetGenericValue_icall directly, due to special casing in the runtime.
GetGenericValueImpl (index, out value);
return value;
}
@@ -204,16 +208,31 @@ namespace System
oarray [index] = (object)item;
return;
}
// Do not change this to call SetGenericValue_icall directly, due to special casing in the runtime.
SetGenericValueImpl (index, ref item);
}
// CAUTION! No bounds checking!
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern void GetGenericValueImpl<T> (int pos, out T value);
extern static void GetGenericValue_icall<T> (ref Array self, int pos, out T value);
// CAUTION! No bounds checking!
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern void SetGenericValueImpl<T> (int pos, ref T value);
extern static void SetGenericValue_icall<T> (ref Array self, int pos, ref T value);
// This is a special case in the runtime.
internal void GetGenericValueImpl<T> (int pos, out T value)
{
var self = this;
GetGenericValue_icall (ref self, pos, out value);
}
// This is a special case in the runtime.
internal void SetGenericValueImpl<T> (int pos, ref T value)
{
var self = this;
SetGenericValue_icall (ref self, pos, ref value);
}
internal struct InternalEnumerator<T> : IEnumerator<T>
{

View File

@@ -195,76 +195,81 @@ namespace System {
lock (initLock){
if (inited)
return;
inited = true;
/* This should not happen any more, since it is checked for in Console */
if (!ConsoleDriver.IsConsole)
throw new IOException ("Not a tty.");
ConsoleDriver.SetEcho (false);
string endString = null;
keypadXmit = reader.Get (TermInfoStrings.KeypadXmit);
keypadLocal = reader.Get (TermInfoStrings.KeypadLocal);
if (keypadXmit != null) {
WriteConsole (keypadXmit); // Needed to get the arrows working
if (keypadLocal != null)
endString += keypadLocal;
}
origPair = reader.Get (TermInfoStrings.OrigPair);
origColors = reader.Get (TermInfoStrings.OrigColors);
setfgcolor = reader.Get (TermInfoStrings.SetAForeground);
setbgcolor = reader.Get (TermInfoStrings.SetABackground);
maxColors = reader.Get (TermInfoNumbers.MaxColors);
maxColors = Math.Max (Math.Min (maxColors, 16), 1);
string resetColors = (origColors == null) ? origPair : origColors;
if (resetColors != null)
endString += resetColors;
unsafe {
if (!ConsoleDriver.TtySetup (keypadXmit, endString, out control_characters, out native_terminal_size)){
control_characters = new byte [17];
native_terminal_size = null;
//throw new IOException ("Error initializing terminal.");
try {
/* This should not happen any more, since it is checked for in Console */
if (!ConsoleDriver.IsConsole)
throw new IOException ("Not a tty.");
ConsoleDriver.SetEcho (false);
string endString = null;
keypadXmit = reader.Get (TermInfoStrings.KeypadXmit);
keypadLocal = reader.Get (TermInfoStrings.KeypadLocal);
if (keypadXmit != null) {
WriteConsole (keypadXmit); // Needed to get the arrows working
if (keypadLocal != null)
endString += keypadLocal;
}
origPair = reader.Get (TermInfoStrings.OrigPair);
origColors = reader.Get (TermInfoStrings.OrigColors);
setfgcolor = reader.Get (TermInfoStrings.SetAForeground);
setbgcolor = reader.Get (TermInfoStrings.SetABackground);
maxColors = reader.Get (TermInfoNumbers.MaxColors);
maxColors = Math.Max (Math.Min (maxColors, 16), 1);
string resetColors = (origColors == null) ? origPair : origColors;
if (resetColors != null)
endString += resetColors;
unsafe {
if (!ConsoleDriver.TtySetup (keypadXmit, endString, out control_characters, out native_terminal_size)){
control_characters = new byte [17];
native_terminal_size = null;
//throw new IOException ("Error initializing terminal.");
}
}
stdin = new StreamReader (Console.OpenStandardInput (0), Console.InputEncoding);
clear = reader.Get (TermInfoStrings.ClearScreen);
bell = reader.Get (TermInfoStrings.Bell);
if (clear == null) {
clear = reader.Get (TermInfoStrings.CursorHome);
clear += reader.Get (TermInfoStrings.ClrEos);
}
csrVisible = reader.Get (TermInfoStrings.CursorNormal);
if (csrVisible == null)
csrVisible = reader.Get (TermInfoStrings.CursorVisible);
csrInvisible = reader.Get (TermInfoStrings.CursorInvisible);
if (term == "cygwin" || term == "linux" || (term != null && term.StartsWith ("xterm")) ||
term == "rxvt" || term == "dtterm") {
titleFormat = "\x1b]0;{0}\x7"; // icon + window title
} else if (term == "iris-ansi") {
titleFormat = "\x1bP1.y{0}\x1b\\"; // not tested
} else if (term == "sun-cmd") {
titleFormat = "\x1b]l{0}\x1b\\"; // not tested
}
cursorAddress = reader.Get (TermInfoStrings.CursorAddress);
GetCursorPosition ();
#if DEBUG
logger.WriteLine ("noGetPosition: {0} left: {1} top: {2}", noGetPosition, cursorLeft, cursorTop);
logger.Flush ();
#endif
if (noGetPosition) {
WriteConsole (clear);
cursorLeft = 0;
cursorTop = 0;
}
} finally {
inited = true;
}
stdin = new StreamReader (Console.OpenStandardInput (0), Console.InputEncoding);
clear = reader.Get (TermInfoStrings.ClearScreen);
bell = reader.Get (TermInfoStrings.Bell);
if (clear == null) {
clear = reader.Get (TermInfoStrings.CursorHome);
clear += reader.Get (TermInfoStrings.ClrEos);
}
csrVisible = reader.Get (TermInfoStrings.CursorNormal);
if (csrVisible == null)
csrVisible = reader.Get (TermInfoStrings.CursorVisible);
csrInvisible = reader.Get (TermInfoStrings.CursorInvisible);
if (term == "cygwin" || term == "linux" || (term != null && term.StartsWith ("xterm")) ||
term == "rxvt" || term == "dtterm") {
titleFormat = "\x1b]0;{0}\x7"; // icon + window title
} else if (term == "iris-ansi") {
titleFormat = "\x1bP1.y{0}\x1b\\"; // not tested
} else if (term == "sun-cmd") {
titleFormat = "\x1b]l{0}\x1b\\"; // not tested
}
cursorAddress = reader.Get (TermInfoStrings.CursorAddress);
GetCursorPosition ();
#if DEBUG
logger.WriteLine ("noGetPosition: {0} left: {1} top: {2}", noGetPosition, cursorLeft, cursorTop);
logger.Flush ();
#endif
if (noGetPosition) {
WriteConsole (clear);
cursorLeft = 0;
cursorTop = 0;
}
}
}

View File

@@ -73,11 +73,11 @@ namespace System {
}
[DllImport ("__Internal")]
extern static IntPtr xamarin_timezone_get_names (ref int count);
extern static IntPtr xamarin_timezone_get_names (ref uint count);
static ReadOnlyCollection<string> GetMonoTouchNames ()
{
int count = 0;
uint count = 0;
IntPtr array = xamarin_timezone_get_names (ref count);
string [] names = new string [count];
for (int i = 0, offset = 0; i < count; i++, offset += IntPtr.Size) {
@@ -90,11 +90,11 @@ namespace System {
}
[DllImport ("__Internal")]
extern static IntPtr xamarin_timezone_get_data (string name, ref int size);
extern static IntPtr xamarin_timezone_get_data (string name, ref uint size);
static Stream GetMonoTouchData (string name, bool throw_on_error = true)
{
int size = 0;
uint size = 0;
IntPtr data = xamarin_timezone_get_data (name, ref size);
if (size <= 0) {
if (throw_on_error)

View File

@@ -419,6 +419,24 @@ public class BinaryWriterTest {
Assert.AreEqual (0, bytes [45], "test#47");
Assert.AreEqual (0, bytes [46], "test#48");
}
[Test]
public void WriteDecimalAndReadBack()
{
// This value is the same used in BinaryReader.ReadDecimal, which will be
// problematic if BinaryWriter or BinaryReader are endianness-confused.
Decimal writeDec = -18295873486192640;
using (var ms = new MemoryStream(32)) {
using (var bw = new BinaryWriter(ms, new UTF8Encoding(), true)) {
bw.Write(writeDec);
}
ms.Position = 0;
using (var br = new BinaryReader(ms)) {
Decimal readDec = br.ReadDecimal();
Assert.AreEqual (readDec, writeDec, "test#01");
}
}
}
[Test]
public void WriteFloat ()

View File

@@ -250,7 +250,7 @@ namespace MonoTests.System.IO
DirectoryInfo info = new DirectoryInfo (path);
Assert.IsFalse (info.Exists, "#1");
info.Create ();
Assert.IsFalse (info.Exists, "#2");
Assert.IsTrue (info.Exists, "#2");
info = new DirectoryInfo (path);
Assert.IsTrue (info.Exists, "#3");
} finally {

View File

@@ -282,14 +282,20 @@ namespace MonoTests.System {
[Test]
public void MemoryCopy_Simple ()
{
int a = 0xBC614E;
int b = 1;
uint a = 0xAABBCCDD;
uint b = 0;
unsafe {
Buffer.MemoryCopy (&a, &b, 4, 2);
}
Assert.AreEqual (0xBC614E, a, "#1");
Assert.AreEqual (0x614E, b, "#2");
Assert.AreEqual (0xAABBCCDD, a, "#1");
// Byte order affects this test; it determines if we
// copy the low (0xCCDD) or high (0xAABB) bytes.
if (BitConverter.IsLittleEndian) {
Assert.AreEqual (0x0000CCDD, b, "#2");
} else {
Assert.AreEqual (0xAABB0000, b, "#2");
}
}
}
}

View File

@@ -1 +1 @@
cfe087d7016cf448a122fee6dfccd92e7bae902c
94504b058a7249a3827d712dd6201a2676c5b6e2