Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Esme Povirk committed Sep 4, 2020
2 parents cfb51b6 + 2a3e6d1 commit bec33a5
Show file tree
Hide file tree
Showing 174 changed files with 15,413 additions and 10,961 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ Please paste the stack trace here if available.
```

<!--
You can join us at https://gitter.im/mono/mono to discuss your reported issue
You can join us on Discord (https://aka.ms/dotnet-discord) in the #monovm channel to discuss your reported issue
-->
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ standards for C# and the Common Language Runtime.

The Mono project is part of the [.NET Foundation](https://www.dotnetfoundation.org/)

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mono/mono?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Join us on [Discord](https://aka.ms/dotnet-discord) in the `#monovm` channel:

<a href="https://aka.ms/dotnet-discord">
<img src="https://img.shields.io/discord/732297728826277939?style=flat-square&label=Discord&logo=discord&logoColor=white&color=7289DA">
</a>

### Contents

1. [Compilation and Installation](#compilation-and-installation)
2. [Using Mono](#using-mono)
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ AC_ARG_ENABLE(visibility-hidden,
WARN=''
if test x"$GCC" = xyes; then
WARN='-Wall -Wunused -Wmissing-declarations -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes'
CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length"
CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wc++-compat"

# We require C99 with some GNU extensions, e.g. `linux` macro
CFLAGS="$CFLAGS -std=gnu99"
Expand Down Expand Up @@ -1420,7 +1420,7 @@ if test x$with_runtime_preset = xnetcore; then
mono_feature_disable_perfcounters='yes'
mono_feature_disable_attach='yes'
mono_feature_disable_cfgdir_config='yes'
if test "x$enable_monodroid" = "x" -a "x$enable_monotouch" = "x"; then
if test "x$enable_monodroid" = "xno" -a "x$enable_monotouch" = "xno"; then
mono_feature_disable_dllmap='yes' # FIXME: the mobile products use this
fi
disable_mono_native=yes
Expand Down
2 changes: 1 addition & 1 deletion external/corefx
5 changes: 2 additions & 3 deletions mcs/class/I18N/CJK/GB18030Encoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,9 @@ public unsafe override int GetBytesImpl (char* chars, int charCount, byte* bytes
}
#else

public override int GetByteCount(char[] chars, int index, int count, bool refresh)
public override int GetByteCount(char[] chars, int start, int count, bool refresh)
{
int start = 0;
int end = count;
int end = start + count;
int ret = 0;
while (start < end)
{
Expand Down
8 changes: 8 additions & 0 deletions mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,14 @@ public class Tests : TestsBase, ITest2

#pragma warning restore 0414

public string BreakInField
{
get {
Debugger.Break ();
return "Foo";
}
}

public class NestedClass {
}

Expand Down
19 changes: 18 additions & 1 deletion mcs/class/Mono.Debugger.Soft/Test/dtest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ public void TypeInfo () {
t = frame.Method.GetParameters ()[7].ParameterType;

var props = t.GetProperties ();
Assert.AreEqual (3, props.Length);
Assert.AreEqual (4, props.Length);
foreach (PropertyInfoMirror prop in props) {
ParameterInfoMirror[] indexes = prop.GetIndexParameters ();

Expand Down Expand Up @@ -4953,6 +4953,23 @@ public void IfPropertyStepping () {
Assert.IsTrue ((e as StepEvent).Method.Name == "op_Equality" || (e as StepEvent).Method.Name == "if_property_stepping");
}

[Test]
public void DebuggerBreakInFieldDoesNotHang () {
vm.EnableEvents (EventType.UserBreak);
Event e = run_until ("o1");

StackFrame frame = e.Thread.GetFrames () [0];
object val = frame.GetThis ();
Assert.IsTrue (val is ObjectMirror);
Assert.AreEqual ("Tests", (val as ObjectMirror).Type.Name);
ObjectMirror o = (val as ObjectMirror);
TypeMirror t = o.Type;

MethodMirror m = t.GetProperty ("BreakInField").GetGetMethod();
Value v = o.InvokeMethod (e.Thread, m, null, InvokeOptions.DisableBreakpoints);
AssertValue ("Foo", v);
}

#if !MONODROID_TOOLS

void HandleEvents () {
Expand Down
39 changes: 36 additions & 3 deletions mcs/class/System.Windows.Forms/System.Windows.Forms/GridEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,7 @@ public bool SetValue (object value, out string error)
if (this.IsReadOnly)
return false;

if (value != Value) {
SetValueCore(value, out error);
if (SetValueCore (value, out error)) {
InvalidateChildGridItemsCache ();
property_grid.OnPropertyValueChangedInternal (this, this.Value);
return true;
Expand All @@ -478,6 +477,40 @@ public bool SetValue (object value, out string error)
protected virtual bool SetValueCore (object value, out string error)
{
error = null;

TypeConverter converter = GetConverter ();
Type valueType = value != null ? value.GetType () : null;
// if the new value is not of the same type try to convert it
if (valueType != null && this.PropertyDescriptor.PropertyType != null &&
!this.PropertyDescriptor.PropertyType.IsAssignableFrom (valueType)) {
bool conversionError = false;
try {
if (converter != null &&
converter.CanConvertFrom ((ITypeDescriptorContext)this, valueType))
value = converter.ConvertFrom ((ITypeDescriptorContext)this,
CultureInfo.CurrentCulture, value);
} catch (Exception e) {
error = e.Message;
conversionError = true;
}
if (conversionError) {
string valueText = ConvertToString (value);
string errorShortDescription = null;
if (valueText != null) {
errorShortDescription = "Property value '" + valueText + "' of '" +
PropertyDescriptor.Name + "' is not convertible to type '" +
this.PropertyDescriptor.PropertyType.Name + "'";

} else {
errorShortDescription = "Property value of '" +
PropertyDescriptor.Name + "' is not convertible to type '" +
this.PropertyDescriptor.PropertyType.Name + "'";
}
error = errorShortDescription + Environment.NewLine + Environment.NewLine + error;
return false;
}
}

bool changed = false;
bool current_changed = false;
object[] propertyOwners = this.PropertyOwners;
Expand Down Expand Up @@ -516,7 +549,7 @@ protected virtual bool SetValueCore (object value, out string error)
if (IsValueType (this.ParentEntry))
current_changed = ParentEntry.SetValueCore (propertyOwners[i], out error);
else
current_changed = Object.Equals (properties[i].GetValue (propertyOwners[i]), value);
current_changed = true;
}
}
if (current_changed)
Expand Down
26 changes: 26 additions & 0 deletions mcs/class/corlib/System/TimeZoneInfo.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,16 @@ unsafe struct AndroidTzDataEntry {
* https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/ZoneInfoDB.java
*
* This is needed in order to read Android v4.3 tzdata files.
*
* Android 10+ moved the up-to-date tzdata location to a module updatable via the Google Play Store and the
* database location changed (https://source.android.com/devices/architecture/modular-system/runtime#time-zone-data-interactions)
* The older locations still exist (at least the `/system/usr/share/zoneinfo` one) but they won't be updated.
*/
sealed class AndroidTzData : IAndroidTimeZoneDB {

internal static readonly string[] Paths = new string[]{
GetApexTimeDataRoot () + "/etc/tz/tzdata", // Android 10+, TimeData module where the updates land
GetApexRuntimeRoot () + "/etc/tz/tzdata", // Android 10+, Fallback location if the above isn't found or corrupted
Environment.GetEnvironmentVariable ("ANDROID_DATA") + "/misc/zoneinfo/tzdata",
Environment.GetEnvironmentVariable ("ANDROID_ROOT") + "/usr/share/zoneinfo/tzdata",
};
Expand Down Expand Up @@ -98,6 +104,26 @@ public string ZoneTab {
get {return zoneTab;}
}

static string GetApexTimeDataRoot ()
{
string ret = Environment.GetEnvironmentVariable ("ANDROID_TZDATA_ROOT");
if (!String.IsNullOrEmpty (ret)) {
return ret;
}

return "/apex/com.android.tzdata";
}

static string GetApexRuntimeRoot ()
{
string ret = Environment.GetEnvironmentVariable ("ANDROID_RUNTIME_ROOT");
if (!String.IsNullOrEmpty (ret)) {
return ret;
}

return "/apex/com.android.runtime";
}

bool LoadData (string path)
{
if (!File.Exists (path))
Expand Down
22 changes: 22 additions & 0 deletions mcs/class/corlib/Test/System.Reflection.Emit/EnumBuilderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,28 @@ public void TestCreateTypeIncompleteEnumStaticField ()
Assert.Fail ("Expected CreateInstance of a broken type to throw TLE");
}

[Test]
public void TestCreateInvalidEnumWithAnIncompleteUnderlyingEnumType ()
{
var mb = GenerateModule ();
var incomplete = GenerateEnum (mb);
GenerateField (incomplete);

var eb = mb.DefineEnum (
_enumNamespace + ".IncompleteUnderlying",
TypeAttributes.Public,
incomplete);

bool caught = false;
try {
var t = eb.CreateType ();
} catch (TypeLoadException exn) {
caught = true;
}
if (!caught)
Assert.Fail ("Expected CreateType of a broken type to throw TLE");
}

[Test]
public void TestEnumBuilderTokenUsable () {
// Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58361
Expand Down
4 changes: 3 additions & 1 deletion mcs/tools/resgen/monoresgen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ static IResourceReader GetReader (Stream stream, string name, bool useSourcePath
return new ResourceReader (stream);
case ".resx":
var reader = new ResXResourceReader (stream);
reader.BasePath = Path.GetDirectoryName (name);
if (useSourcePath) {
reader.BasePath = Path.GetDirectoryName (name);
}
return reader;
default:
throw new Exception ("Unknown format in file " + name);
Expand Down
12 changes: 6 additions & 6 deletions mono/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
project (mono)
project(mono)

#set (subdirs eglib arch utils cil sgen metadata mini dis profiler)
set (subdirs mini)
#set(subdirs eglib arch utils cil sgen metadata mini dis profiler)
set(subdirs mini profiler)

foreach (dir ${subdirs})
add_subdirectory (${dir})
endforeach ()
foreach(dir ${subdirs})
add_subdirectory(${dir})
endforeach()
2 changes: 2 additions & 0 deletions mono/cil/cil-opcodes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,6 @@
<opcode name="mono_ld_delegate_method_ptr" input="Pop1" output="PushI" args="InlineNone" o1="0xF0" o2="0x1E" flow="next" />
<opcode name="mono_rethrow" input="PopRef" output="Push0" args="InlineNone" o1="0xF0" o2="0x1F" flow="throw" type="Objmodel" />
<opcode name="mono_get_sp" input="Pop0" output="PushI" args="InlineNone" o1="0xF0" o2="0x20" flow="next" />
<opcode name="mono_methodconst" input="Pop0" output="PushI" args="InlineI" o1="0xF0" o2="0x21" flow="next" />
<opcode name="mono_pinvoke_addr_cache" input="Pop0" output="PushI" args="InlineI" o1="0xF0" o2="0x22" flow="next" />
</opdesc>
2 changes: 2 additions & 0 deletions mono/cil/opcode.def
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ OPDEF(CEE_MONO_LDPTR_PROFILER_ALLOCATION_COUNT, "mono_ldptr_profiler_allocation_
OPDEF(CEE_MONO_LD_DELEGATE_METHOD_PTR, "mono_ld_delegate_method_ptr", Pop1, PushI, InlineNone, 0, 2, 0xF0, 0x1E, NEXT)
OPDEF(CEE_MONO_RETHROW, "mono_rethrow", PopRef, Push0, InlineNone, 0, 2, 0xF0, 0x1F, ERROR)
OPDEF(CEE_MONO_GET_SP, "mono_get_sp", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x20, NEXT)
OPDEF(CEE_MONO_METHODCONST, "mono_methodconst", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x21, NEXT)
OPDEF(CEE_MONO_PINVOKE_ADDR_CACHE, "mono_pinvoke_addr_cache", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x22, NEXT)
#ifndef OPALIAS
#define _MONO_CIL_OPALIAS_DEFINED_
#define OPALIAS(a,s,r)
Expand Down
1 change: 1 addition & 0 deletions mono/eglib/eglib-remap.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
#define g_ptr_array_sized_new monoeg_g_ptr_array_sized_new
#define g_ptr_array_sort monoeg_g_ptr_array_sort
#define g_ptr_array_sort_with_data monoeg_g_ptr_array_sort_with_data
#define g_ptr_array_find monoeg_g_ptr_array_find
#define g_qsort_with_data monoeg_g_qsort_with_data
#define g_queue_free monoeg_g_queue_free
#define g_queue_is_empty monoeg_g_queue_is_empty
Expand Down
1 change: 1 addition & 0 deletions mono/eglib/glib.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ void g_ptr_array_set_size (GPtrArray *array, gint length);
gpointer *g_ptr_array_free (GPtrArray *array, gboolean free_seg);
void g_ptr_array_foreach (GPtrArray *array, GFunc func, gpointer user_data);
guint g_ptr_array_capacity (GPtrArray *array);
gboolean g_ptr_array_find (GPtrArray *array, gconstpointer needle, guint *index);
#define g_ptr_array_index(array,index) (array)->pdata[(index)]
//FIXME previous missing parens

Expand Down
15 changes: 15 additions & 0 deletions mono/eglib/gptrarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,18 @@ g_ptr_array_capacity (GPtrArray *array)
{
return ((GPtrArrayPriv *)array)->size;
}

gboolean
g_ptr_array_find (GPtrArray *array, gconstpointer needle, guint *index)
{
g_assert (array);
for (int i = 0; i < array->len; i++) {
if (array->pdata [i] == needle) {
if (index)
*index = i;
return TRUE;
}
}

return FALSE;
}
4 changes: 2 additions & 2 deletions mono/metadata/appdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,7 @@ mono_domain_assembly_preload (MonoAssemblyLoadContext *alc,

char *base_dir = get_app_context_base_directory (error);
search_path [0] = base_dir;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Domain %s (%p) ApplicationBase is %s", domain->friendly_name, domain, base_dir);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Domain (%p) ApplicationBase is %s", domain, base_dir);

result = real_load (search_path, aname->culture, aname->name, &req);

Expand Down Expand Up @@ -2821,7 +2821,7 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu
{
MonoAssembly *ass = NULL;
MonoImageOpenStatus status;
MonoImage *image = mono_image_open_from_data_internal (alc, (char*)assembly_data, raw_assembly_len, FALSE, NULL, refonly, FALSE, NULL);
MonoImage *image = mono_image_open_from_data_internal (alc, (char*)assembly_data, raw_assembly_len, FALSE, NULL, refonly, FALSE, NULL, NULL);

if (!image) {
mono_error_set_bad_image_by_name (error, "In memory assembly", "0x%p", assembly_data);
Expand Down
3 changes: 3 additions & 0 deletions mono/metadata/appdomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ mono_domain_foreach (MonoDomainFunc func, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY MonoAssembly *
mono_domain_assembly_open (MonoDomain *domain, const char *name);

MONO_API void
mono_domain_ensure_entry_assembly (MonoDomain *domain, MonoAssembly *assembly);

MONO_API mono_bool
mono_domain_finalize (MonoDomain *domain, uint32_t timeout);

Expand Down
Loading

0 comments on commit bec33a5

Please sign in to comment.