You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is some code where MethodA calls MethodB - if there is no exception, MethodA returns "0" otherwise it returns "1". However, if I make a shim for MethodB that calls an exception, Pose execution stops and the exception isn't caught in MethodA.
Is there a way to throw exceptions in shims that are caught in the isolated method?
[Fact]
public void Test()
{
int i = MethodA();
Assert.Equal(0, i);
PoseContext.Isolate(() =>
{
i = MethodA();
}, Shim.Replace(() => MethodB()).With(() => { throw new Exception("test"); }));
Assert.Equal(1, i);
}
public static int MethodA()
{
try
{
MethodB();
}
catch
{
return 1;
}
return 0;
}
public static void MethodB()
{
}
The text was updated successfully, but these errors were encountered:
Here is some code where MethodA calls MethodB - if there is no exception, MethodA returns "0" otherwise it returns "1". However, if I make a shim for MethodB that calls an exception, Pose execution stops and the exception isn't caught in MethodA.
Is there a way to throw exceptions in shims that are caught in the isolated method?
The text was updated successfully, but these errors were encountered: