diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp
index f9d5924c94a517..d0ab78f2d57d3e 100644
--- a/src/coreclr/vm/dllimport.cpp
+++ b/src/coreclr/vm/dllimport.cpp
@@ -4556,7 +4556,7 @@ static void CreatePInvokeStubAccessMetadata(
(*pNumArgs) = msig.NumFixedArgs();
- IMDInternalImport* pInternalImport = pSigDesc->m_pModule->GetMDImport();
+ IMDInternalImport* pInternalImport = pSigDesc->m_pMetadataModule->GetMDImport();
_ASSERTE(!SF_IsHRESULTSwapping(*pdwStubFlags));
diff --git a/src/tests/Interop/Interop.csproj b/src/tests/Interop/Interop.csproj
index b0762fcd2eeae9..ee10f9f8954ee2 100644
--- a/src/tests/Interop/Interop.csproj
+++ b/src/tests/Interop/Interop.csproj
@@ -12,6 +12,7 @@
+
@@ -42,7 +43,7 @@
-
+
diff --git a/src/tests/Interop/PInvoke/Varargs/CrossAssembly/CrossAssemblyVarargsTest.cs b/src/tests/Interop/PInvoke/Varargs/CrossAssembly/CrossAssemblyVarargsTest.cs
new file mode 100644
index 00000000000000..28a67968cbd7ee
--- /dev/null
+++ b/src/tests/Interop/PInvoke/Varargs/CrossAssembly/CrossAssemblyVarargsTest.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Text;
+using TestLibrary;
+using VarArgsPInvokeLib;
+using Xunit;
+
+namespace PInvokeTests
+{
+ public class CrossAssemblyVarargsTest
+ {
+ [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsVarArgSupported))]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/91388", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.PlatformDoesNotSupportNativeTestAssets))]
+ public static void TestCrossAssemblyVarArgs()
+ {
+ int arg1 = 10;
+ int arg2 = 20;
+ double arg3 = 12.5;
+ string expected = FormattableString.Invariant($"{arg1}, {arg2}, {arg3:F1}");
+
+ var builder = new StringBuilder(30);
+ VarArgsWrapper.TestVarArgs(builder, (IntPtr)30, "%i, %i, %.1f", __arglist(arg1, arg2, arg3));
+ Assert.Equal(expected, builder.ToString());
+ }
+ }
+}
diff --git a/src/tests/Interop/PInvoke/Varargs/CrossAssembly/VarArgsPInvokeLib/VarArgsPInvokeLib.cs b/src/tests/Interop/PInvoke/Varargs/CrossAssembly/VarArgsPInvokeLib/VarArgsPInvokeLib.cs
new file mode 100644
index 00000000000000..f5ccf0b037c0f3
--- /dev/null
+++ b/src/tests/Interop/PInvoke/Varargs/CrossAssembly/VarArgsPInvokeLib/VarArgsPInvokeLib.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace VarArgsPInvokeLib
+{
+ public static class VarArgsWrapper
+ {
+ [DllImport("VarargsNative", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void TestVarArgs(StringBuilder builder, nint bufferSize, string formatString, __arglist);
+ }
+}
diff --git a/src/tests/Interop/PInvoke/Varargs/CrossAssembly/VarArgsPInvokeLib/VarArgsPInvokeLib.csproj b/src/tests/Interop/PInvoke/Varargs/CrossAssembly/VarArgsPInvokeLib/VarArgsPInvokeLib.csproj
new file mode 100644
index 00000000000000..ff0035bf7259bc
--- /dev/null
+++ b/src/tests/Interop/PInvoke/Varargs/CrossAssembly/VarArgsPInvokeLib/VarArgsPInvokeLib.csproj
@@ -0,0 +1,9 @@
+
+
+ Library
+ true
+
+
+
+
+