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
System.TypeLoadException : Method 'set_VirtualInternalSet' on type 'Mock.AbstractClassefa0bfaa-f64d-4c8b-b1b2-7eef47cfe38a' from assembly 'Foq.Dynamic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is overriding a method that is not visible from that assembly.
Stack Trace:
at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
at System.Reflection.Emit.TypeBuilder.CreateTypeInfo()
at Foq.Emit.mock(MockMode mode, Type abstractType, FSharpList`1 otherTypes, FSharpList`1 calls, Object[] args, FSharpOption`1 returnStrategy)
at Foq.Mock`1.Create()
If you remove the VirtualInternalSet property, the test passes.
Related information
Windows 10
.NET Core 2.1
Foq 1.8.0
XUnit 2.4.0
The text was updated successfully, but these errors were encountered:
Any progress on this issue? I just ran into it after upgrading to latest Azure.Storage.Blobs library (12.11.0). The Azure.Response type can no longer be mocked:
letresp= Foq.Mock<Azure.Response>().Create()
Fails at runtime with System.TypeLoadException : Method 'set_IsError' on type 'Mock.Responseda15e24f-4b36-4ebb-a375-a1c2b3ef1ec8' from assembly 'Foq.Dynamic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is overriding a method that is not visible from that assembly.
Edit: I just noticed that the IsError property is not even virtual. Now I'm really confused.
Description
Foq throws an exception if you try to mock a C# abstract class containing a virtual property with an internal setter.
Repro steps
Create the following class in a C# project:
Create this test in an F# test project:
Expected behavior
Test should pass.
Actual behavior
Fails with this error:
Stack Trace:
If you remove the
VirtualInternalSet
property, the test passes.Related information
The text was updated successfully, but these errors were encountered: