mcs/errors @marek-safar
mcs/mcs @marek-safar
mcs/tests @marek-safar
-mono/eglib @kumpera
-mono/metadata @vargaz
+mono/eglib @kumpera @vargaz @luhenry
+mono/metadata/*verify* @kumpera
+mono/metadata @vargaz @kumpera
mono/metadata/*profiler* @alexrp
mono/metadata/monitor* @brzvlad
mono/metadata/sgen* @brzvlad
-Subproject commit 141e6a55feee9052e347c424aff09b156e0d5497
+Subproject commit f2c8f2e7fb17e8a55b6679c7d13e3634ec45c639
Color back_color, fore_color;
Rectangle text_draw = e.Bounds;
StringFormat string_format = new StringFormat ();
- string_format.FormatFlags = StringFormatFlags.LineLimit;
-
+ string_format.FormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap;
+
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
back_color = ColorHighlight;
fore_color = ColorHighlightText;
case 32: /* ERROR_SHARING_VIOLATION */ return "Sharing violation";
case 33: /* ERROR_LOCK_VIOLATION */ return "Lock violation";
case 50: /* ERROR_NOT_SUPPORTED */ return "Operation not supported";
+ case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
case 87: /* ERROR_INVALID_PARAMETER */ return "Invalid parameter";
case 120: /* ERROR_CALL_NOT_IMPLEMENTED */ return "Call not implemented";
case 123: /* ERROR_INVALID_NAME */ return "Invalid name";
case 52: /* ERROR_DUP_NAME */ return "Duplicate name";
case 53: /* ERROR_BAD_NETPATH */ return "Bad netpath";
case 54: /* ERROR_NETWORK_BUSY */ return "Network busy";
- case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
case 56: /* ERROR_TOO_MANY_CMDS */ return "Too many commands";
case 57: /* ERROR_ADAP_HDW_ERR */ return "ADAP HDW error";
case 58: /* ERROR_BAD_NET_RESP */ return "Bad net response";
Thread tr = new Thread (new ThreadStart (CallbackThread));
tr.Start();
- bool terminated = tr.Join(2000);
+ bool terminated = tr.Join(10000);
Assert.IsTrue(terminated, "Thread didn't get lock of context bound object.");
Assert.IsTrue (!otResult, "Concurrency detected in CallbackThread");
PORTABLE_TARGETS_SRC:=data/Portable/Targets
PCL5_FX_SRC:=data/Portable/Frameworks/v5.0
+DENIED_ASSEMBLY_LIST_SRC=data/deniedAssembliesList.txt
NETFRAMEWORK_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETFramework
PCL5_FX_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETPortable/v5.0
install-versioned-files: install-bin-data install-nuget-imports
#install files that are only installed once across all xbuild versions
-install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets
+install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets install-msbuild-specific-files
install-bin-data:
$(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/MSBuild
$(INSTALL_DATA) "$(PCL5_FX_SRC)/ASP.NET Core 1.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/ASP.NET Core 1.0.xml"
$(INSTALL_DATA) "$(PCL5_FX_SRC)/Windows Universal 10.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/Windows Universal 10.0.xml"
+install-msbuild-specific-files:
+ $(MKINSTALLDIRS) $(DESTDIR)$(mono_libdir)/mono/xbuild
+ $(INSTALL_DATA) $(DENIED_ASSEMBLY_LIST_SRC) $(DESTDIR)$(mono_libdir)/mono/xbuild
+
EXTRA_DISTFILES = \
data/xbuild.rsp \
data/xbuild.exe.config.in \
"data/Portable/Frameworks/v5.0/ASP.NET Core 1.0.xml" \
"data/Portable/Frameworks/v5.0/FrameworkList.xml" \
"data/Portable/Frameworks/v5.0/Windows Universal 10.0.xml" \
+ data/deniedAssembliesList.txt \
frameworks/net_2.0.xml \
frameworks/net_3.0.xml \
frameworks/net_3.5.xml \
--- /dev/null
+System.Globalization.Extensions.dll,475DBF02-9F68-44F1-8FB5-C9F69F1BD2B1,4,0,0,0
+System.Globalization.Extensions.dll,5FCD54F0-4B97-4259-875D-30E481F02EA2,4,0,1,0
+System.Globalization.Extensions.dll,E9FCFF5B-4DE1-4BDC-9CE8-08C640FC78CC,4,0,2,0
+System.IO.Compression.dll,44FCA06C-A510-4B3E-BDBF-D08D697EF65A,4,1,0,0
+System.IO.Compression.dll,3A58A219-266B-47C3-8BE8-4E4F394147AB,4,1,2,0
+System.Net.Http.dll,269B562C-CC15-4736-B1B1-68D4A43CAA98,4,1,0,0
+System.Net.Http.dll,EA2EC6DC-51DD-479C-BFC2-E713FB9E7E47,4,1,0,1
+System.Net.Http.dll,C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0,4,1,1,0
+System.Net.Http.dll,817F01C3-4011-477D-890A-98232B85553D,4,1,1,0
+System.Net.Http.dll,09D4A140-061C-4884-9B63-22067E841931,4,1,1,1
+System.Runtime.InteropServices.RuntimeInformation.dll,F13660F8-9D0D-419F-BA4E-315693DD26EA,4,0,0,0
+System.Runtime.InteropServices.RuntimeInformation.dll,DD91439F-3167-478E-BD2C-BF9C036A1395,4,0,1,0
+System.Text.Encoding.CodePages.dll,C142254F-DEB5-46A7-AE43-6F10320D1D1F,4,0,1,0
+System.Text.Encoding.CodePages.dll,FD178CD4-EF4F-44D5-9C3F-812B1E25126B,4,0,2,0
+System.Text.Encoding.CodePages.dll,F5CCCBEC-E1AD-4DBB-9B44-9B42C86B94B8,4,1,0,0
+System.Threading.Overlapped.dll,9F5D4F09-787A-458A-BA08-553AA71470F1,4,0,0,0
+System.Threading.Overlapped.dll,FCBD003B-2BB4-4940-BAEF-63AF520C2336,4,0,1,0
+System.Threading.Overlapped.dll,87697E71-D192-4F0B-BAD4-02BBC7793005,4,0,2,0
This is to be removed once a proper fix is shipped through nuget.
+Please keep this in sync with mcs/tools/xbuild/data/deniedAssembliesList.txt
+If any assemblies are added/removed, then this should be regenerated with:
+
+ $ mono tools/nuget-hash-extractor/nuget-hash-extractor.exe nugets guids_for_msbuild > mcs/tools/xbuild/data/deniedAssembliesList.txt
+
*/
typedef enum {
SYS_IO_COMPRESSION = 2, //System.IO.Compression
SYS_NET_HTTP = 3, //System.Net.Http
SYS_TEXT_ENC_CODEPAGES = 4, //System.Text.Encoding.CodePages
- SYS_REF_DISP_PROXY = 5, //System.Reflection.DispatchProxy
- SYS_THREADING_OVERLAPPED = 6, //System.Threading.Overlapped
+ SYS_THREADING_OVERLAPPED = 5, //System.Threading.Overlapped
} IgnoredAssemblyNames;
typedef struct {
"System.IO.Compression.dll",
"System.Net.Http.dll",
"System.Text.Encoding.CodePages.dll",
- "System.Reflection.DispatchProxy.dll",
"System.Threading.Overlapped.dll"
};
IGNORED_ASSEMBLY (0x8437178B, SYS_NET_HTTP, "C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0", "4.3.0 net46"),
IGNORED_ASSEMBLY (0xFAFDA422, SYS_NET_HTTP, "817F01C3-4011-477D-890A-98232B85553D", "4.3.1 net46"),
IGNORED_ASSEMBLY (0x472FA630, SYS_NET_HTTP, "09D4A140-061C-4884-9B63-22067E841931", "4.3.2 net46"),
- IGNORED_ASSEMBLY (0x4A15555E, SYS_REF_DISP_PROXY, "E40AFEB4-CABE-4124-8412-B46AB79C92FD", "4.0.0 net46"),
- IGNORED_ASSEMBLY (0xD20D9783, SYS_REF_DISP_PROXY, "2A69F0AD-B86B-40F2-8E4C-5B671E47479F", "4.0.1 netstandard1.3"),
- IGNORED_ASSEMBLY (0xA33A7E68, SYS_REF_DISP_PROXY, "D4E8D2DB-BD65-4168-99EA-D2C1BDEBF9CC", "4.3.0 netstandard1.3"),
IGNORED_ASSEMBLY (0x46A4A1C5, SYS_RT_INTEROP_RUNTIME_INFO, "F13660F8-9D0D-419F-BA4E-315693DD26EA", "4.0.0 net45"),
IGNORED_ASSEMBLY (0xD07383BB, SYS_RT_INTEROP_RUNTIME_INFO, "DD91439F-3167-478E-BD2C-BF9C036A1395", "4.3.0 net45"),
IGNORED_ASSEMBLY (0x911D9EC3, SYS_TEXT_ENC_CODEPAGES, "C142254F-DEB5-46A7-AE43-6F10320D1D1F", "4.0.1 net46"),
IGNORED_ASSEMBLY (0xFA686A38, SYS_TEXT_ENC_CODEPAGES, "FD178CD4-EF4F-44D5-9C3F-812B1E25126B", "4.3.0 net46"),
+ IGNORED_ASSEMBLY (0xF6D18A2E, SYS_TEXT_ENC_CODEPAGES, "F5CCCBEC-E1AD-4DBB-9B44-9B42C86B94B8", "4.4.0 net461"),
IGNORED_ASSEMBLY (0xAA21986B, SYS_THREADING_OVERLAPPED, "9F5D4F09-787A-458A-BA08-553AA71470F1", "4.0.0 net46"),
IGNORED_ASSEMBLY (0x7D927C2A, SYS_THREADING_OVERLAPPED, "FCBD003B-2BB4-4940-BAEF-63AF520C2336", "4.0.1 net46"),
IGNORED_ASSEMBLY (0x6FE03EE2, SYS_THREADING_OVERLAPPED, "87697E71-D192-4F0B-BAD4-02BBC7793005", "4.3.0 net46")
"System.IO.Compression",
"System.Net.Http",
"System.Text.Encoding.CodePages",
- "System.Reflection.DispatchProxy",
"System.Threading.Overlapped"
};
IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 0, 1),
IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 0),
IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 1),
- IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 0, 0),
- IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 1, 0),
- IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 2, 0),
IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 0, 0),
IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 1, 0),
IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 1, 0),
IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 2, 0),
+ IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 1, 0, 0),
IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 0, 0),
IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 1, 0),
IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 2, 0),
mono_gchandle_free (gchandle);
- mono_raise_exception (exc);
+ mono_reraise_exception (exc);
}
/*
#include "mempool.h"
#include "mempool-internals.h"
-#include "utils/mono-compiler.h"
+#include "utils/unlocked.h"
/*
* MonoMemPool is for fast allocation of memory. We free
} d;
};
-static long total_bytes_allocated = 0;
+static gint64 total_bytes_allocated = 0;
/**
* mono_mempool_new:
/**
* mono_mempool_new_size:
- *
- * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
- * * mono_mempool_alloc
- * * mono_mempool_new_size
- * * mono_mempool_destroy
- * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
- * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
- * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
- *
* \param initial_size the amount of memory to initially reserve for the memory pool.
* \returns a new memory pool with a specific initial memory reservation.
*/
-MONO_NO_SANITIZE_THREAD
MonoMemPool *
mono_mempool_new_size (int initial_size)
{
pool->pos = (guint8*)pool + SIZEOF_MEM_POOL; // Start after header
pool->end = (guint8*)pool + initial_size; // End at end of allocated space
pool->d.allocated = pool->size = initial_size;
- total_bytes_allocated += initial_size;
+ UnlockedAdd64 (&total_bytes_allocated, initial_size);
return pool;
}
/**
* mono_mempool_destroy:
- *
- * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
- * * mono_mempool_alloc
- * * mono_mempool_new_size
- * * mono_mempool_destroy
- * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
- * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
- * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
- *
* \param pool the memory pool to destroy
*
* Free all memory associated with this pool.
*/
-MONO_NO_SANITIZE_THREAD
void
mono_mempool_destroy (MonoMemPool *pool)
{
MonoMemPool *p, *n;
- total_bytes_allocated -= pool->d.allocated;
+ UnlockedSubtract64 (&total_bytes_allocated, pool->d.allocated);
p = pool;
while (p) {
/**
* mono_mempool_alloc:
- *
- * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
- * * mono_mempool_alloc
- * * mono_mempool_new_size
- * * mono_mempool_destroy
- * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
- * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
- * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
- *
* \param pool the memory pool to use
* \param size size of the memory block
*
*
* \returns the address of a newly allocated memory block.
*/
-MONO_NO_SANITIZE_THREAD
gpointer
mono_mempool_alloc (MonoMemPool *pool, guint size)
{
np->size = new_size;
pool->next = np;
pool->d.allocated += new_size;
- total_bytes_allocated += new_size;
+ UnlockedAdd64 (&total_bytes_allocated, new_size);
rval = (guint8*)np + SIZEOF_MEM_POOL;
} else {
pool->pos = (guint8*)np + SIZEOF_MEM_POOL;
pool->end = (guint8*)np + new_size;
pool->d.allocated += new_size;
- total_bytes_allocated += new_size;
+ UnlockedAdd64 (&total_bytes_allocated, new_size);
rval = pool->pos;
pool->pos += size;
long
mono_mempool_get_bytes_allocated (void)
{
- return total_bytes_allocated;
+ return UnlockedRead64 (&total_bytes_allocated);
}
FAIL (ctx, g_strdup_printf ("CustomAttribute: Invalid boxed object type %x", sub_type));
}
-
case MONO_TYPE_CLASS:
+ if (klass && klass->enumtype) {
+ klass = klass->element_class;
+ type = klass->byval_arg.type;
+ goto handle_enum;
+ }
+
if (klass != mono_defaults.systemtype_class)
FAIL (ctx, g_strdup_printf ("CustomAttribute: Invalid class parameter type %s:%s ",klass->name_space, klass->name));
*_ptr = ptr;
for (i = 0; i < table->rows; ++i) {
mono_metadata_decode_row (table, i, data, MONO_TYPEDEF_SIZE);
if (data [MONO_TYPEDEF_FLAGS] & INVALID_TYPEDEF_FLAG_BITS)
- ADD_ERROR (ctx, g_strdup_printf ("Invalid typedef row %d invalid flags field 0x%08x", i, data [MONO_TYPEDEF_FLAGS]));
+ ADD_ERROR (ctx, g_strdup_printf ("Invalid typedef row %d invalid flags field 0x%08x rejected bits: 0x%08x", i, data [MONO_TYPEDEF_FLAGS], data [MONO_TYPEDEF_FLAGS] & INVALID_TYPEDEF_FLAG_BITS));
if ((data [MONO_TYPEDEF_FLAGS] & TYPE_ATTRIBUTE_LAYOUT_MASK) == 0x18)
ADD_ERROR (ctx, g_strdup_printf ("Invalid typedef row %d invalid class layout 0x18", i));
/*This can't fail since this is checked in is_valid_cattr_blob*/
g_assert (decode_signature_header (ctx, data [MONO_CUSTOM_ATTR_VALUE], &size, &ptr));
- if (!is_valid_cattr_content (ctx, ctor, ptr, size))
- ADD_ERROR (ctx, g_strdup_printf ("Invalid CustomAttribute content row %d Value field 0x%08x", i, data [MONO_CUSTOM_ATTR_VALUE]));
+ if (!is_valid_cattr_content (ctx, ctor, ptr, size)) {
+ char *ctor_name = mono_method_full_name (ctor, TRUE);
+ ADD_ERROR (ctx, g_strdup_printf ("Invalid CustomAttribute content row %d Value field 0x%08x ctor: %s", i, data [MONO_CUSTOM_ATTR_VALUE], ctor_name));
+ g_free (ctor_name);
+ }
}
}
{
int i;
+ /* We guard against double initialization due to how pedump in verification mode works.
+ Until runtime initialization is properly factored to work with what it needs we need workarounds like this.
+ FIXME: https://bugzilla.xamarin.com/show_bug.cgi?id=58793
+ */
+ static gboolean inited;
+
+ if (inited)
+ return;
+ inited = TRUE;
+
type_cache = g_hash_table_new (mono_type_hash, mono_type_equal);
for (i = 0; i < NBUILTIN_TYPES (); ++i)
gboolean (*mono_current_thread_has_handle_block_guard) (void);
gboolean (*mono_above_abort_threshold) (void);
void (*mono_clear_abort_threshold) (void);
+ void (*mono_reraise_exception) (MonoException *ex);
} MonoRuntimeExceptionHandlingCallbacks;
MONO_COLD void mono_set_pending_exception (MonoException *exc);
eh_callbacks.mono_raise_exception (ex);
}
+/**
+ * mono_raise_exception:
+ * \param ex exception object
+ * Signal the runtime that the exception \p ex has been raised in unmanaged code.
+ */
+void
+mono_reraise_exception (MonoException *ex)
+{
+ MONO_REQ_GC_UNSAFE_MODE;
+
+ /*
+ * NOTE: Do NOT annotate this function with G_GNUC_NORETURN, since
+ * that will cause gcc to omit the function epilog, causing problems when
+ * the JIT tries to walk the stack, since the return address on the stack
+ * will point into the next function in the executable, not this one.
+ */
+ eh_callbacks.mono_reraise_exception (ex);
+}
+
void
mono_raise_exception_with_context (MonoException *ex, MonoContext *ctx)
{
MONO_API void
mono_raise_exception (MonoException *ex);
+MONO_API void
+mono_reraise_exception (MonoException *ex);
+
MONO_RT_EXTERNAL_ONLY
MONO_API void
mono_runtime_object_init (MonoObject *this_obj);
#define TYPE_ATTRIBUTE_IMPORT 0x00001000
#define TYPE_ATTRIBUTE_SERIALIZABLE 0x00002000
+#define TYPE_ATTRIBUTE_WINDOWS_RUNTIME 0x00004000
+
#define TYPE_ATTRIBUTE_STRING_FORMAT_MASK 0x00030000
#define TYPE_ATTRIBUTE_ANSI_CLASS 0x00000000
#include <mono/metadata/metadata.h>
#include <mono/metadata/image.h>
#include <mono/metadata/loader.h>
-#include <mono/metadata/class-internals.h>
#include <glib.h> /* GSList dep */
MONO_BEGIN_DECLS
typedef struct {
MonoVerifyInfo info;
- MonoExceptionType exception_type : 8; /*should be one of MONO_EXCEPTION_* */
+ int8_t exception_type; /*should be one of MONO_EXCEPTION_* */
} MonoVerifyInfoExtended;
case EINTR: return ERROR_IO_PENDING; /* best match I could find */
case EPIPE: return ERROR_WRITE_FAULT;
case ELOOP: return ERROR_CANT_RESOLVE_FILENAME;
+#ifdef ENODEV
+ case ENODEV: return ERROR_DEV_NOT_EXIST;
+#endif
default:
g_error ("%s: unknown error (%d) \"%s\"", __FILE__, error, g_strerror (error));
#define ERROR_LOCK_VIOLATION 33
#define ERROR_HANDLE_DISK_FULL 39
#define ERROR_NOT_SUPPORTED 50
+#define ERROR_DEV_NOT_EXIST 55
#define ERROR_FILE_EXISTS 80
#define ERROR_CANNOT_MAKE 82
#define ERROR_INVALID_PARAMETER 87
cbs.mono_walk_stack_with_state = mono_walk_stack_with_state;
- if (mono_llvm_only)
+ if (mono_llvm_only) {
cbs.mono_raise_exception = mono_llvm_raise_exception;
- else
+ cbs.mono_reraise_exception = mono_llvm_reraise_exception;
+ } else {
cbs.mono_raise_exception = (void (*)(MonoException *))mono_get_throw_exception ();
+ cbs.mono_reraise_exception = (void (*)(MonoException *))mono_get_rethrow_exception ();
+ }
cbs.mono_raise_exception_with_ctx = mono_raise_exception_with_ctx;
cbs.mono_exception_walk_trace = mono_exception_walk_trace;
cbs.mono_install_handler_block_guard = mono_install_handler_block_guard;
mono_llvm_throw_exception ((MonoObject*)e);
}
+void
+mono_llvm_reraise_exception (MonoException *e)
+{
+ mono_llvm_rethrow_exception ((MonoObject*)e);
+}
+
void
mono_llvm_throw_corlib_exception (guint32 ex_token_index)
{
MonoObject *mono_llvm_load_exception (void);
void mono_llvm_reset_exception (void);
void mono_llvm_raise_exception (MonoException *e);
+void mono_llvm_reraise_exception (MonoException *e);
gint32 mono_llvm_match_exception (MonoJitInfo *jinfo, guint32 region_start, guint32 region_end, gpointer rgctx, MonoObject *this_obj);
gboolean
bug-46661.cs \
w32message.cs \
runtime-invoke.gen.cs \
- imt_big_iface_test.cs
+ imt_big_iface_test.cs \
+ bug-58782-plain-throw.cs \
+ bug-58782-capture-and-throw.cs
if AMD64
TESTS_CS_SRC += async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs
bug-1147.cs \
generic-type-builder.2.cs
+PLATFORM_DISABLED_TESTS=
+
+if HOST_WIN32
+PLATFORM_DISABLED_TESTS += bug-58782-plain-throw.exe bug-58782-capture-and-throw.exe
+endif
+
if AMD64
# #651684
-PLATFORM_DISABLED_TESTS = finally_guard.exe
+PLATFORM_DISABLED_TESTS += finally_guard.exe
if HOST_WIN32
PLATFORM_DISABLED_TESTS += w32message.exe
if X86
if HOST_WIN32
-PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
+PLATFORM_DISABLED_TESTS += async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
bug-18026.exe monitor.exe threadpool-exceptions5.exe process-unref-race.exe w32message.exe \
unhandled-exception-1.exe unhandled-exception-2.exe unhandled-exception-3.exe unhandled-exception-4.exe \
unhandled-exception-5.exe unhandled-exception-6.exe unhandled-exception-7.exe unhandled-exception-8.exe
if POWERPC
# bug #71274
-PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
+PLATFORM_DISABLED_TESTS += finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
endif
if POWERPC64
# FIXME: These tests hang/fail for unknown reasons
-PLATFORM_DISABLED_TESTS=monitor.exe threadpool-exceptions5.exe appdomain-thread-abort.exe appdomain-unload.exe \
+PLATFORM_DISABLED_TESTS += monitor.exe threadpool-exceptions5.exe appdomain-thread-abort.exe appdomain-unload.exe \
pinvoke2.exe pinvoke3.exe pinvoke11.exe threadpool-exceptions7.exe winx64structs.exe bug-10127.exe pinvoke_ppcc.exe \
pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe abort-cctor.exe load-exceptions.exe \
sgen-domain-unload-2.exe sgen-weakref-stress.exe sgen-cementing-stress.exe sgen-new-threads-dont-join-stw.exe \
endif
if ARM
-PLATFORM_DISABLED_TESTS=filter-stack.exe
+PLATFORM_DISABLED_TESTS += filter-stack.exe
INTERP_DISABLED_TESTS_PLATFORM=finalizer-exception.exe main-returns-abort-resetabort.exe block_guard_restore_aligment_on_exit.exe \
delegate-exit.exe delegate-exit.exe delegate-delegate-exit.exe delegate-async-exit.exe delegate3.exe delegate1.exe
endif
if MIPS
# monitor.exe is racy
-PLATFORM_DISABLED_TESTS=filter-stack.exe monitor.exe
+PLATFORM_DISABLED_TESTS += filter-stack.exe monitor.exe
endif
if S390X
-PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe
+PLATFORM_DISABLED_TESTS += dynamic-method-resurrection.exe
#PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe exception17.exe
PLATFORM_DISABLED_TESTS += \
marshal8.exe \
pinvoke-2.2.exe \
pinvoke3.exe \
- thunks.exe
+ thunks.exe \
+ bug-58782-plain-throw.exe \
+ bug-58782-capture-and-throw.exe
# Tests which load assemblies which are not
# in the testing_aot_full profile
bug-46661.exe \
bug-47295.exe \
bug-48015.exe \
+ bug-58782-plain-throw.exe \
+ bug-58782-capture-and-throw.exe \
bug-544446.exe \
bug-685908.exe \
bug-80307.exe \
safehandle.2.exe winx64structs.exe thunks.exe pinvoke3.exe pinvoke2.exe pinvoke-2.2.exe pinvoke17.exe pinvoke13.exe \
pinvoke11.exe pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe pinvoke_ppcc.exe pinvoke.exe \
- marshalbool.exe marshal9.exe marshal5.exe marshal.exe handleref.exe cominterop.exe bug-Xamarin-5278.exe: libtest.la
+ marshalbool.exe marshal9.exe marshal5.exe marshal.exe handleref.exe cominterop.exe bug-Xamarin-5278.exe \
+ bug-58782-plain-throw.exe bug-58782-capture-and-throw.exe: libtest.la
event-get.2.exe$(PLATFORM_AOT_SUFFIX): event-il.exe$(PLATFORM_AOT_SUFFIX)
event-get.2.exe: event-il.exe
--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+
+class Driver
+{
+ [DllImport ("libtest")]
+ static extern void mono_test_native_to_managed_exception_rethrow (Action action);
+
+ [DllImport ("libc")]
+ static extern void _exit (int exitCode);
+
+ static int Main (string[] args)
+ {
+ AppDomain.CurrentDomain.UnhandledException += (sender, exception_args) =>
+ {
+ CustomException exc = exception_args.ExceptionObject as CustomException;
+ if (exc == null) {
+ Console.WriteLine ($"FAILED - Unknown exception: {exception_args.ExceptionObject}");
+ _exit (1);
+ }
+
+ Console.WriteLine (exc.StackTrace);
+ if (string.IsNullOrEmpty (exc.StackTrace)) {
+ Console.WriteLine ("FAILED - StackTrace is null for unhandled exception.");
+ _exit (2);
+ } else {
+ Console.WriteLine ("SUCCESS - StackTrace is not null for unhandled exception.");
+ _exit (0);
+ }
+ };
+
+ mono_test_native_to_managed_exception_rethrow (CaptureAndThrow);
+ Console.WriteLine ("Should have exited in the UnhandledException event handler.");
+ return 2;
+ }
+
+ static void CaptureAndThrow ()
+ {
+ try {
+ Throw ();
+ } catch (Exception e) {
+ System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture (e).Throw ();
+ }
+ }
+
+ static void Throw ()
+ {
+ throw new CustomException ("C");
+ }
+
+ class CustomException : Exception
+ {
+ public CustomException(string s) : base(s) {}
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+
+class Driver
+{
+ [DllImport ("libtest")]
+ static extern void mono_test_native_to_managed_exception_rethrow (Action action);
+
+ [DllImport ("libc")]
+ static extern void _exit (int exitCode);
+
+ static int Main (string[] args)
+ {
+ AppDomain.CurrentDomain.UnhandledException += (sender, exception_args) =>
+ {
+ CustomException exc = exception_args.ExceptionObject as CustomException;
+ if (exc == null) {
+ Console.WriteLine ($"FAILED - Unknown exception: {exception_args.ExceptionObject}");
+ _exit (1);
+ }
+
+ Console.WriteLine (exc.StackTrace);
+ if (string.IsNullOrEmpty (exc.StackTrace)) {
+ Console.WriteLine ("FAILED - StackTrace is null for unhandled exception.");
+ _exit (2);
+ } else {
+ Console.WriteLine ("SUCCESS - StackTrace is not null for unhandled exception.");
+ _exit (0);
+ }
+ };
+
+ mono_test_native_to_managed_exception_rethrow (PlainThrow);
+ Console.WriteLine ("Should have exited in the UnhandledException event handler.");
+ return 3;
+ }
+
+ static void PlainThrow ()
+ {
+ Throw ();
+ }
+
+ static void Throw ()
+ {
+ throw new CustomException ("C");
+ }
+
+ class CustomException : Exception
+ {
+ public CustomException(string s) : base(s) {}
+ }
+}
\ No newline at end of file
}
return 0;
}
+
+#ifndef WIN32
+
+typedef void (*NativeToManagedExceptionRethrowFunc) ();
+
+void *mono_test_native_to_managed_exception_rethrow_thread (void *arg)
+{
+ NativeToManagedExceptionRethrowFunc func = (NativeToManagedExceptionRethrowFunc) arg;
+ func ();
+ return NULL;
+}
+
+LIBTEST_API void STDCALL
+mono_test_native_to_managed_exception_rethrow (NativeToManagedExceptionRethrowFunc func)
+{
+ pthread_t t;
+ pthread_create (&t, NULL, mono_test_native_to_managed_exception_rethrow_thread, func);
+ pthread_join (t, NULL);
+}
+#endif
return ++*val;
}
+MONO_UNLOCKED_ATTRS
+gint64
+UnlockedAdd64 (gint64 *dest, gint64 add)
+{
+ return *dest += add;
+}
+
+MONO_UNLOCKED_ATTRS
+gint64
+UnlockedSubtract64 (gint64 *dest, gint64 sub)
+{
+ return *dest -= sub;
+}
+
+MONO_UNLOCKED_ATTRS
+gint64
+UnlockedRead64 (gint64 *src)
+{
+ return *src;
+}
+
#endif /* _UNLOCKED_H_ */
class MSBuild (GitHubPackage):
def __init__ (self):
GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.4',
- revision = 'f9ae632ef2aa472732bd40444cf77e1564496b3c')
+ revision = 'c907a5182a101624eb58e73fb24f97666abf477a')
def build (self):
self.sh ('./cibuild.sh --scope Compile --target Mono --host Mono --config Release')
## We don’t want to fix all broken nugets we only focus on few system-like that are likely to be used by broad audience and
## we have working implementation available in one of Mono assemblies.
##
+## PLEASE keep this in sync with mcs/tools/xbuild/data/deniedAssembliesList.txt
+##
+## If any nugets are added or removed here, then make sure to regenerate the above file with:
+##
+## $ mono nuget-hash-extractor.exe nugets guids_for_msbuild > ../../mcs/tools/xbuild/data/deniedAssembliesList.txt
+##
#System.Runtime.InteropServices.RuntimeInformation
wget https://www.nuget.org/api/v2/package/System.Runtime.InteropServices.RuntimeInformation/4.3.0 -O nugets/system.runtime.interopservices.runtimeinformation.4.3.0.nupkg
}
static int
-dump_verify_info (MonoImage *image, int flags)
+dump_verify_info (MonoImage *image, int flags, gboolean valid_only)
{
GSList *errors, *tmp;
int count = 0, verifiable = 0;
for (tmp = errors; tmp; tmp = tmp->next) {
MonoVerifyInfo *info = (MonoVerifyInfo *)tmp->data;
+ if (info->status == MONO_VERIFY_NOT_VERIFIABLE && valid_only)
+ continue;
+
g_print ("%s: %s\n", desc [info->status], info->message);
if (info->status == MONO_VERIFY_ERROR) {
count++;
"Ok", "Error", "Warning", NULL, "CLS", NULL, NULL, NULL, "Not Verifiable"
};
- image = mono_image_open_raw (fname, &status);
- if (!image) {
- printf ("Could not open %s\n", fname);
- return 1;
- }
+ if (!strstr (fname, "mscorlib.dll")) {
+ image = mono_image_open_raw (fname, &status);
+ if (!image) {
+ printf ("Could not open %s\n", fname);
+ return 1;
+ }
- if (!mono_verifier_verify_pe_data (image, &errors))
- goto invalid_image;
+ if (!mono_verifier_verify_pe_data (image, &errors))
+ goto invalid_image;
- if (!mono_image_load_pe_data (image)) {
- printf ("Could not load pe data for assembly %s\n", fname);
- return 1;
- }
+ if (!mono_image_load_pe_data (image)) {
+ printf ("Could not load pe data for assembly %s\n", fname);
+ return 1;
+ }
- if (!mono_verifier_verify_cli_data (image, &errors))
- goto invalid_image;
+ if (!mono_verifier_verify_cli_data (image, &errors))
+ goto invalid_image;
- if (!mono_image_load_cli_data (image)) {
- printf ("Could not load cli data for assembly %s\n", fname);
- return 1;
- }
+ if (!mono_image_load_cli_data (image)) {
+ printf ("Could not load cli data for assembly %s\n", fname);
+ return 1;
+ }
- if (!mono_verifier_verify_table_data (image, &errors))
- goto invalid_image;
+ if (!mono_verifier_verify_table_data (image, &errors))
+ goto invalid_image;
+
+ mono_image_load_names (image);
- mono_image_load_names (image);
+ /*fake an assembly for class loading to work*/
+ assembly = g_new0 (MonoAssembly, 1);
+ assembly->in_gac = FALSE;
+ assembly->image = image;
+ image->assembly = assembly;
+ mono_assembly_fill_assembly_name (image, &assembly->aname);
- /*fake an assembly for class loading to work*/
- assembly = g_new0 (MonoAssembly, 1);
- assembly->in_gac = FALSE;
- assembly->image = image;
- image->assembly = assembly;
- mono_assembly_fill_assembly_name (image, &assembly->aname);
+ /*Finish initializing the runtime*/
+ mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
+ mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
- /*Finish initializing the runtime*/
- mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
- mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
+ mono_init_version ("pedump", image->version);
- mono_init_version ("pedump", image->version);
+ mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
- mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
+ mono_icall_init ();
+ mono_marshal_init ();
+ } else {
+ /*Finish initializing the runtime*/
+ mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
+ mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
+
+ mono_init_version ("pedump", NULL);
+
+ mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
- mono_icall_init ();
- mono_marshal_init ();
+ mono_icall_init ();
+ mono_marshal_init ();
+ image = mono_get_corlib ();
+
+ if (!mono_verifier_verify_pe_data (image, &errors))
+ goto invalid_image;
+
+ if (!mono_image_load_pe_data (image)) {
+ printf ("Could not load pe data for assembly %s\n", fname);
+ return 1;
+ }
+ if (!mono_verifier_verify_cli_data (image, &errors))
+ goto invalid_image;
+
+ if (!mono_image_load_cli_data (image)) {
+ printf ("Could not load cli data for assembly %s\n", fname);
+ return 1;
+ }
+
+ if (!mono_verifier_verify_table_data (image, &errors))
+ goto invalid_image;
+ }
if (!verify_partial_md && !mono_verifier_verify_full_table_data (image, &errors))
goto invalid_image;
if (!file)
usage ();
+ //We have to force the runtime to load the corlib under verification as its own corlib so core types are properly populated in mono_defaults.
+ if (strstr (file, "mscorlib.dll"))
+ g_setenv ("MONO_PATH", g_path_get_dirname (file), 1);
+
#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters_init ();
#endif
return 4;
}
- code_result = dump_verify_info (assembly->image, verify_flags);
+ code_result = dump_verify_info (assembly->image, verify_flags, verifier_mode == MONO_VERIFIER_MODE_VALID);
return code_result ? code_result : image_result;
} else
mono_image_close (image);