I've just downloaded the dynamic object framework Clay and am running into issues regarding castle project versions. Clay uses functionality from v2.0 of "castle" whilst I have a project which has been started referencing v2.5. Needless to say just to make matters more interesting I'm a complete beginner in all things "Castle" and IoC.
The real problem is that upgrading the references within clay solution results in a depreciated method warning. Regardless of whether you supress the method or not, the provided unit tests fail with a "Cannot perform runtime binding on a null reference" exception in the following code in "Intercept" of "InterfaceProxyBehavior":
var invoker = BindInvoker(invocation);
invoker(invocation);
The code that produces the run-time warning is in "CreateInstance" of "DefaultClayActivator":
//var proxyType = _builder.CreateClassProxy(baseType, options);
var proxyType = _builder.CreateClassProxyType(baseType, null, options);
As previously stated I'm still a complete beginner with Castle Windsor and just starting out with IoC so haven't even come across the Proxy stuff yet. Frustratingly I have no idea what the error message is even telling me, or asking for.
Have anyone already ported Clay across to version 2.5 of the castle project, so know the steps needed. Or can any one with experience of this part of castle throw anymore light on the error and what I may need to do to resolve it.
Updated
I'm still not really any the wiser as to the functionality that is failing, but have had chance to revisit the code running it both with v2.0 (works) and v2.5 (breaks) in castle.core. Attached are two images of the debug information when it works and then when it breaks. The test that it fails on is below, I've indicated the call with a comment.
namespace ClaySharp.Tests {
[TestFixture]
public class BinderFallbackTests {
...
[Test]
public void TestInvokePaths() {
var dynamically = ClayActivator.CreateInstance<Alpha>(new IClayBehavior[] {
new InterfaceProxyBehavior(),
new AlphaBehavior()
});
Alpha statically = dynamically;
IAlpha interfacially = dynamically;
Assert.That(dynamically.Hello(), Is.EqualTo("World-"));
Assert.That(statically.Hello(), Is.EqualTo("World-"));
Assert.That(interfacially.Hello(), Is.EqualTo("World-")); // <- Fails on this call
Assert.That(dynamically.Foo(), Is.EqualTo("Bar-"));
Assert.That(interfacially.Foo(), Is.EqualTo("Bar-"));
Assert.Throws<RuntimeBinderException>(() => dynamically.MissingNotHandled());
}
...
}
}
This is the debug information when using v2.5 of castle.core and the exception is thrown:
This is the debug information using v2.0 of castle.core (which works) for the same call / line that causes the problem with v2.5