Skip to content

Commit 2762028

Browse files
committed
[fix] fixed extern mocking
1 parent fefa7f4 commit 2762028

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

VSharp.CSharpUtils/ExternMocker.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ namespace VSharp.CSharpUtils;
1010

1111
public static class ExternMocker
1212
{
13-
public static bool ExtMocksSupported =
13+
public static readonly bool ExtMocksSupported =
1414
!OperatingSystem.IsMacOS()
1515
|| RuntimeInformation.OSArchitecture == Architecture.X86
1616
|| RuntimeInformation.OSArchitecture == Architecture.X64;
1717

18+
public static readonly bool ShimSupported = Environment.Version.Major <= 6;
19+
1820
private static List<NativeDetour> _detours = new();
1921

2022
public static IntPtr GetExternPtr(string libName, string methodName)

VSharp.SILI/Interpreter.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ type internal ILInterpreter() as this =
957957
isIntrinsic && (Array.contains fullMethodName x.TrustedIntrinsics |> not)
958958

959959
member private x.ShouldMock (method : Method) fullMethodName =
960-
Loader.isShimmed fullMethodName
960+
Loader.isShimmed fullMethodName && ExternMocker.ShimSupported
961961
|| method.IsExternalMethod && not method.IsQCall
962962

963963
member private x.InstantiateThisIfNeed state thisOption (method : Method) =

0 commit comments

Comments
 (0)