Two dimensional object array return type - NSubstitute

北慕城南 提交于 2019-12-05 18:03:41

NSubstitute depends on Castle, which depends on Reflection.Emit, so they blame Reflection.Emit.

http://issues.castleproject.org/issue/DYNPROXY-154

For a workaround to your problem, looks like you cannot use multidimensional arrays. Note that your exception actually occurs on Get2DArray(), not Returns.

Please note that I, personally, am working on a mocking framework that does NOT use Reflection.Emit (nor Castle for that matter) It's going to take a few weeks before even an Alpha is ready, but it is quite a powerful tool. There are many scenarios Castle fails that I don't (my site will list these). If you are interested, please follow http://smug.codeplex.com

This may be a bit late, but could help someone who encounters this issue and comes across this question.

We found a way around this limitation by having your Interface return Array instead of object[,].

There is an implicit conversion, so the code inside your implementation of the interface should be able to remain the same.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!