test(yengine): suppress production finalizer path on deliberately uninitialized test objects

This commit is contained in:
OpenGenesis (MPL 2.0) committed 2026-11-07 20:59:47 +01:00
1 parent 946e17bf5d
commit 3f7af292c9
1 file changed
+7 -1
@@ -19,7 +19,13 @@ static void Reject<T>(Action action, string reason) where T : Exception
}
static XMRInstance Fake()
{
return (XMRInstance)RuntimeHelpers.GetUninitializedObject(typeof(XMRInstance));
XMRInstance result =
(XMRInstance)RuntimeHelpers.GetUninitializedObject(typeof(XMRInstance));
// The production XMRInstance has a finalizer which expects all constructor
// locks to exist. These deliberately incomplete test doubles must never
// enter its normal disposal path during GC.
SetField(result, "m_disposed", true);
return result;
}
static void SetField(XMRInstance instance, string name, object value)
{