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
The above is simply the default constructor. However, GetMethodFromExpression cannot find the constructor for said constructor. It fails in the validation phase because the original method to shim (the constructor) is null. I suspect this is due to it being the default constructor because the following works--insofar as it passes the validation phase.
The above is no longer the default constructor, and GetMethodFromExpression successfully finds the intended constructor. During the isolation, I can also see that the breakpoint in the replacement is called as expected.
However, the replacement value is never actually present in the resulting code. See the following example.
vars=Shim.Replace(()=>newDateTime(Is.A<int>(),Is.A<int>(),Is.A<int>())).With((inty,intm,intd)=>newDateTime(2004,1,1));vardateTimeShim=Shim.Replace(()=>DateTime.Now).With(()=>newDateTime(2004,1,1));PoseContext.Isolate(()=>{vardt=newDateTime(2023,1,1);Console.WriteLine(dt);// <-- This prints '01-01-0001 00:00:00'},s);
The text was updated successfully, but these errors were encountered:
This is evident if attempting the following:
The above is simply the default constructor. However,
GetMethodFromExpression
cannot find the constructor for said constructor. It fails in the validation phase because the original method to shim (the constructor) isnull
. I suspect this is due to it being the default constructor because the following works--insofar as it passes the validation phase.The above is no longer the default constructor, and
GetMethodFromExpression
successfully finds the intended constructor. During the isolation, I can also see that the breakpoint in the replacement is called as expected.However, the replacement value is never actually present in the resulting code. See the following example.
The text was updated successfully, but these errors were encountered: