diff --git a/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/Internal/ReferenceHelper.cs b/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/Internal/ReferenceHelper.cs index 89cd7322..4f22f3ce 100644 --- a/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/Internal/ReferenceHelper.cs +++ b/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/Internal/ReferenceHelper.cs @@ -129,6 +129,8 @@ private static InvokeInterfaceProxy GetProxy(JVirtualMachineRef vmRef) { InvokeInterfaceProxy? result = ReferenceHelper.invokeProxies.GetValueOrDefault(vmRef); if (result is not null && result.Reference.Reference.Pointer != ptr) result = default; + if (result?.AllowedThread != null && result.AllowedThread != Environment.CurrentManagedThreadId) + result = default; return result ?? InvokeInterfaceProxy.Detached; } } diff --git a/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/InvokeInterfaceProxy.cs b/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/InvokeInterfaceProxy.cs index a9475a15..39c05820 100644 --- a/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/InvokeInterfaceProxy.cs +++ b/src/Test/Rxmxnx.JNetInterface.Implementation.Tests.Proxies/InvokeInterfaceProxy.cs @@ -30,6 +30,7 @@ public abstract class InvokeInterfaceProxy public JMethodId StackTraceElementIsNativeMethodMethodId { get; } = ReferenceHelper.Fixture.Create(); public JVirtualMachineRef Reference { get; private set; } + public Int32? AllowedThread { get; set; } = Environment.CurrentManagedThreadId; public abstract JResult DestroyVirtualMachine(); public abstract JResult AttachCurrentThread(ValPtr envRef,