This may be a bit, but suppose I want to use Moq in the ViewModel to create some design-time data, for example:
public class SomeViewModel
{
public SomeViewModel(ISomeDependency dependency)
{
if (IsInDesignMode)
{
var mock = new Mock<ISomeDependency>();
dependency = mock.Object;
}
}
}
The layout can be customized to do something, but you get the point.
My problem is that during development in Blend, this code throws an InvalidCastException, with a message in the lines “Cannot strip an object of type Castle.Proxies.ISomeDependencyProxy2b3a8f318828ffffbb1212bdf3d50d3fc” for input “ISomeDependency.” Although this does not necessarily apply to MoomeDependency. castle, I hope the Moq example helps;)
Any idea why this is?
Thank!