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 current proxy generator can not intercept the method UserQuery+IFoo.Bar() for the following reason:
- Can not create proxy for method Int32 UserQuery.IFoo.Bar() because it or its declaring type is not accessible. Make it public, or internal and mark your assembly with [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] attribute, because assembly LINQPadQuery is not strong-named.
The problem is easy enough to fix: just specify options.Implements<IFoo>() in the fake creation options.
However, the error message is misleading and confusing. It seems to imply that the interface or method is not public, which isn't true, and doesn't point to the actual cause of the problem: the fact that IFoo.Bar() is implemented explicitly and can't be overriden unless Foo explicitly implements IFoo as well.
The message in this scenario should to be improved to something along these lines:
Foo implements IFoo.Bar explicitly; in order to fake IFoo.Bar, the faked Foo must implement IFoo explicitly using options.Implements<IFoo>() in the fake creation options.
The text was updated successfully, but these errors were encountered:
Given this interface and class:
When trying to configure the
IFoo.Bar()
method on a fakeFoo
:The following exception is thrown:
The problem is easy enough to fix: just specify
options.Implements<IFoo>()
in the fake creation options.However, the error message is misleading and confusing. It seems to imply that the interface or method is not public, which isn't true, and doesn't point to the actual cause of the problem: the fact that
IFoo.Bar()
is implemented explicitly and can't be overriden unlessFoo
explicitly implementsIFoo
as well.The message in this scenario should to be improved to something along these lines:
The text was updated successfully, but these errors were encountered: