#include <mono/metadata/profiler-private.h>
#include <mono/metadata/class-internals.h>
#include <mono/metadata/domain-internals.h>
+#include <mono/metadata/reflection-internals.h>
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/mono-debug.h>
#include <mono/io-layer/io-layer.h>
/* Loaded assembly binding info */
static GSList *loaded_assembly_bindings = NULL;
+/* Class lazy loading functions */
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (internals_visible, System.Runtime.CompilerServices, InternalsVisibleToAttribute)
+
static MonoAssembly*
mono_assembly_invoke_search_hook_internal (MonoAssemblyName *aname, MonoAssembly *requesting, gboolean refonly, gboolean postload);
static MonoAssembly*
if (aname->major == vset->major && aname->minor == vset->minor &&
aname->build == vset->build && aname->revision == vset->revision)
return aname;
+
+ if (compare_versions (vset, aname) < 0) {
+ // requested version is newer than current
+ // runtime version, don't remap
+ return aname;
+ }
if ((aname->major | aname->minor | aname->build | aname->revision) != 0)
mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY,
* names in custom attributes.
*
* This is an internal method, we need this because when we load mscorlib
- * we do not have the mono_defaults.internals_visible_class loaded yet,
+ * we do not have the internals visible cattr loaded yet,
* so we need to load these after we initialize the runtime.
*
* LOCKING: Acquires the assemblies lock plus the loader lock.
void
mono_assembly_load_friends (MonoAssembly* ass)
{
+ MonoError error;
int i;
MonoCustomAttrInfo* attrs;
GSList *list;
if (ass->friend_assembly_names_inited)
return;
- attrs = mono_custom_attrs_from_assembly (ass);
+ attrs = mono_custom_attrs_from_assembly_checked (ass, &error);
+ mono_error_assert_ok (&error);
if (!attrs) {
mono_assemblies_lock ();
ass->friend_assembly_names_inited = TRUE;
MonoAssemblyName *aname;
const gchar *data;
/* Do some sanity checking */
- if (!attr->ctor || attr->ctor->klass != mono_defaults.internals_visible_class)
+ if (!attr->ctor || attr->ctor->klass != mono_class_try_get_internals_visible_class ())
continue;
if (attr->data_size < 4)
continue;