diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index a1faf8522fc62..c6d294efa0460 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -5233,6 +5233,13 @@ buffer_add_value_full (Buffer *buf, MonoType *t, void *addr, MonoDomain *domain, nfields = 0; iter = NULL; while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (G_UNLIKELY (!f->type)) { + ERROR_DECL(error); + mono_field_resolve_type (f, error); + mono_error_cleanup (error); + if (!f->type) + continue; + } if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; if (mono_field_is_deleted (f)) @@ -5250,6 +5257,13 @@ buffer_add_value_full (Buffer *buf, MonoType *t, void *addr, MonoDomain *domain, iter = NULL; while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (G_UNLIKELY (!f->type)) { + ERROR_DECL(error); + mono_field_resolve_type (f, error); + mono_error_cleanup (error); + if (!f->type) + continue; + } if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; if (mono_field_is_deleted (f)) @@ -5351,6 +5365,13 @@ decode_vtype (MonoType *t, MonoDomain *domain, gpointer void_addr, gpointer void nfields = decode_int (buf, &buf, limit); while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (G_UNLIKELY (!f->type)) { + ERROR_DECL(error); + mono_field_resolve_type (f, error); + mono_error_cleanup (error); + if (!f->type) + continue; + } if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; if (mono_field_is_deleted (f)) @@ -5459,6 +5480,13 @@ decode_vtype_compute_size (MonoType *t, MonoDomain *domain, gpointer void_buf, g nfields = decode_int (buf, &buf, limit); while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (G_UNLIKELY (!f->type)) { + ERROR_DECL(error); + mono_field_resolve_type (f, error); + mono_error_cleanup (error); + if (!f->type) + continue; + } if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; if (mono_field_is_deleted (f)) @@ -8476,6 +8504,13 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint buffer_add_int (buf, nfields); while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (G_UNLIKELY (!f->type)) { + ERROR_DECL(field_error); + mono_field_resolve_type (f, field_error); + mono_error_cleanup (field_error); + if (!f->type) + continue; + } buffer_add_fieldid (buf, domain, f); buffer_add_string (buf, f->name); buffer_add_typeid (buf, domain, mono_class_from_mono_type_internal (f->type)); @@ -8856,6 +8891,13 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint int nfields = 0; gpointer iter = NULL; while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (G_UNLIKELY (!f->type)) { + ERROR_DECL(field_error); + mono_field_resolve_type (f, field_error); + mono_error_cleanup (field_error); + if (!f->type) + continue; + } if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; if (mono_field_is_deleted (f)) @@ -8866,6 +8908,13 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint iter = NULL; while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (G_UNLIKELY (!f->type)) { + ERROR_DECL(field_error); + mono_field_resolve_type (f, field_error); + mono_error_cleanup (field_error); + if (!f->type) + continue; + } if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; if (mono_field_is_deleted (f)) diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs index bfeb9ec9b4d5e..e2bfcce85cf72 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs @@ -596,7 +596,8 @@ await SendCommandAndCheck (JObject.FromObject(new { }), "Debugger.resume", scrip await CheckProps (c, new { Field1 = TNumber(123), Field2 = TString("spqr"), - }, "c", num_fields: 2); + Field3Unused = TString(null), + }, "c", num_fields: 3); }); } diff --git a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssembly3/MethodBody2_v2.cs b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssembly3/MethodBody2_v2.cs index 379adbe266908..7d89669cd454c 100644 --- a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssembly3/MethodBody2_v2.cs +++ b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssembly3/MethodBody2_v2.cs @@ -22,6 +22,7 @@ public C() } public double Field1; public string Field2; + public string Field3Unused; } }