Some time ago I sort of complained there's no Mocking Framework available for Silverlight. This has a lot to do with the not being available Castle's DynamicProxy for Silverlight. So I did some analyzing on DynamicProxy if it's possible to make it work under Silverlight.
The Castle.Core project
I did some analyzing by just counting the error's. It's about 130 errors that needs to be solved. Most of those errors are the usage of:
I think that some of those error's that have to do with the collections can be solved like the missing classes: ArrayList, Hashtable and ReadOnlyCollectionBase.
I'm not sure about things like Serializable and MarshalRefByObject. I don't think we can solve them, they probably need to be omitted, but will this break basic features of the Castle Core?
The Castle.DynamicProxy project
The Castle.DynamicProxy project has a lot more errors that occur, around 210. Although while navigating through the source code I found out that nothing in the namespace Castle.DynamicProxy.Generators.Emitters needs to be changed. So does this say that Reflection.Emit has enough to do everything needed for the Mocking frameworks? Most of the errors are in the usage of:
Again some of those usages can be rewritten, but the things about serialization probably won't and what about the ReaderWriterLock and the FormatterService? Those are very internally implemented classes. Maybe it's possible to recode things to work without ReaderWriterLock and the FormatterService.
So there needs to be changed a lot in each of the DynamicProxy libraries about 340 lines. That's a lot I would guess. But what if we would solve all these incompatible lines by removing them sort of? I'm afraid this would leave DynamicProxy sort of handicapped. Maybe it's too much so there won't be any mocking frameworks that can make use of the handicapped DynamicProxy. Maybe it's because I've got too little knowledge on the inner workings of DynamicProxy and mocking frameworks like Moq and Rhino Mocks.