Skip to content

Commit 1f5151d

Browse files
committed
[mbr] Throw InvalidOperationException is hot reload is not supported
On a per-assembly basis
1 parent 7e901f8 commit 1f5151d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/mono/mono/metadata/metadata-update.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ mono_metadata_update_enabled (int *modifiable_assemblies_out)
9595
return modifiable != MONO_MODIFIABLE_ASSM_NONE;
9696
}
9797

98+
static gboolean
99+
assembly_update_supported (MonoAssembly *assm)
100+
{
101+
int modifiable = 0;
102+
if (!mono_metadata_update_enabled (&modifiable))
103+
return FALSE;
104+
if (modifiable == MONO_MODIFIABLE_ASSM_DEBUG &&
105+
mono_assembly_is_jit_optimizer_disabled (assm))
106+
return TRUE;
107+
return FALSE;
108+
}
109+
98110
/**
99111
* mono_metadata_update_no_inline:
100112
* \param caller: the calling method
@@ -935,6 +947,11 @@ mono_image_load_enc_delta (MonoImage *image_base, gconstpointer dmeta_bytes, uin
935947
if (!is_ok (error))
936948
return;
937949

950+
if (!assembly_update_supported (image_base->assembly)) {
951+
mono_error_set_invalid_operation (error, "The assembly can not be edited or changed.");
952+
return;
953+
}
954+
938955
const char *basename = image_base->filename;
939956
/* FIXME:
940957
* (1) do we need to memcpy dmeta_bytes ? (maybe)

0 commit comments

Comments
 (0)