问题
I have created a program that uses plugins using Caliburn and .NET 4.
When creating an instance of the plugin, a container, window manager, and a view-model factory is injected using caliburn's abilities.
However, when a code containing usage of one of the injected properties is run, I get a
MissingMethodException
. It is driving me crazy.
Also, if the plugin instance has dependencies that need to be satisfied (like IContainer, and IWindowManager) which are registered by default in Caliburn, it fails to create it with the message that no such components were found in the IoC container.
In debug mode I checked and everything is registered so I don't know what to do.
What do you think could be the problem?
回答1:
Regarding the MissingMethodException
, make sure the signature in the XAML matches the method's.
For example, this in the XAML:
<DockPanel cal:Message.Attach=" [Event KeyDown] = [Action KeyDown($eventArgs)]">
Matches this method:
public void KeyDown(KeyEventArgs args)
{
//stuff
}
If you remove the $eventArgs
bit you will get an exception.
来源:https://stackoverflow.com/questions/8914090/missingmethodexception-caliburn