Change all members to virtual
.
See Milestones for release notes.
It is expected that all developers using Fody become a Patron on OpenCollective. See Licensing/Patron FAQ for more information.
See also Fody usage.
Install the Virtuosity.Fody NuGet package and update the Fody NuGet package:
PM> Install-Package Fody
PM> Install-Package Virtuosity.Fody
The Install-Package Fody
is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.
Add <Virtuosity/>
to FodyWeavers.xml
<Weavers>
<Virtuosity/>
</Weavers>
sealed
classesstatic
membersabstract
membersprivate
membersvirtual
membersvirtual
virtual
) membersvirtual
new
modifiers to override
modifiersTo exclude a specific class you can mark it with a DoNotVirtualizeAttribute
.
Add the below class to your assembly. Namespace does not matter.
public class DoNotVirtualizeAttribute : Attribute
{
}
The class will look like this
[DoNotVirtualize]
public class ClassToSkip
{
...
}
These config options are access by modifying the Virtuosity
node in FodyWeavers.xml
A list of namespaces to exclude.
Can not be defined with IncludeNamespaces
.
Can take two forms.
As an element with items delimited by a newline.
<Virtuosity>
<ExcludeNamespaces>
Foo
Bar
</ExcludeNamespaces>
</Virtuosity>
Or as a attribute with items delimited by a pipe |
.
<Virtuosity ExcludeNamespaces='Foo|Bar'/>
A list of namespaces to include.
Can not be defined with ExcludeNamespaces
.
Can take two forms.
As an element with items delimited by a newline.
<Virtuosity>
<IncludeNamespaces>
Foo
Bar
</IncludeNamespaces>
</Virtuosity>
Or as a attribute with items delimited by a pipe |
.
<Virtuosity IncludeNamespaces='Foo|Bar'/>
When using one of the following tools
All these tools make use of DynamicProxy. DynamicProxy allows for runtime interception of members. The one caveat is that all intercepted members must be virtual. This means that that all the above tools, to some extent, require members to be virtual.
When a member is not virtual these tools will not work and fail in sometimes very unhelpful ways. So rather than having to remember to use the virtual keyword Virtuosity means members will be virtual by default.
Russian Doll designed by [Simon Child](https://thenounproject.com/Simon Child) from The Noun Project.