[Mono-osx] typeof returns MonoType instead of Type for object mocked with FakeItEasy

Jonathan Pryor jonpryor at vt.edu
Sun Aug 3 13:59:52 UTC 2014

On Aug 2, 2014, at 7:54 PM, tron_thomas <tron.thomas at frontier.com> wrote:
> I am using Xamarin Studio to develop a simple console application using TDD with FakeItEasy. I am trying to write a test that is similar to the following code:

> 			SomeObject someObject = A.Fake<SomeObject>(options => options.WithArgumentsForConstructor(new object[] { typeof(Object) }));

> When I go to run the test I get this error:
> FakeItEasy.Core.FakeCreationException: Failed to create fake of type “TypeProblem.SomeObject” with the specified arguments for the constructor:
>  No constructor matches the passed arguments for constructor.
>  An exception was caught during this call. Its message was:
>  Can not instantiate proxy of class: TypeProblem.SomeObject.
>  Could not find a constructor that would match the given arguments:  System.MonoType

It looks like FakeItEasy or Castle.Core has a bug. You will need to file it with them.

System.Type is abstract; you can thus _never_ have an instance with a runtime type of System.Type; it will instead have some other name. This must likewise be true on .NET.

 - Jon

More information about the Mono-osx mailing list