[Mono-dev] Reflection Emit issues

Ayende Rahien ayende at ayende.com
Mon Mar 12 02:12:30 EDT 2007


Hi guys,
I have just attempted to run the Rhino Mocks test suite on Mono (Win32).
The result is about 300 failing tests. The root cause seems to be
differences in Reflection.Emit behavior.
Rhino Mocks is using Castle Dynamic Proxy 2 to generate proxies, and all
those tests are running on the Microsoft .NET implementation successfully.

How to reproduce:
1/ Get the source from
https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools
2/ Build rhino-mocks (xbuild default.build)
3/ rhino-tools\rhino-mocks\Rhino.Mocks.Tests\bin\debug>"c:\Program
Files\Mono-1.2.3.1\bin\mono" MbUnit.GUI.exe

The result of one of the failing tests:

1)
Rhino.Mocks.Tests.FieldsProblem.PresenterBaseTestFixture.SetUp.TestEventInitialization.TearDown:
Argument cannot be null.
Parameter name: method
  at System.Reflection.Emit.ILGenerator.Emit (OpCode opcode,
System.Reflection.MethodInfo method) [0x00000]
  at
Castle.DynamicProxy.Generators.Emitters.SimpleAST.MethodTokenExpression.Emit(IMemberEmitter
member,
System.Reflection.Emit.ILGenerator gen) [0x00000]
  at Castle.DynamicProxy.Generators.Emitters.SimpleAST.AssignStatement.Emit(IMemberEmitter
member,
System.Reflection.Emit.ILGenerator gen) [0x00000]
  at
Castle.DynamicProxy.Generators.Emitters.CodeBuilders.AbstractCodeBuilder.Generate(IMemberEmitter
member,
System.Reflection.Emit.ILGenerator il) [0x00000]
  at Castle.DynamicProxy.Generators.Emitters.ConstructorEmitter.Generate ()
[0x00000]
  at
Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.EnsureBuildersAreInAValidState()
[0x00000]
  at Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType()
[0x00000]
  at
Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.GenerateCode(
System.Type proxyTargetType, System.Type[] interfaces,
Castle.DynamicProxy.ProxyGenerationOptions options) [0x00000]
  at
Castle.DynamicProxy.DefaultProxyBuilder.CreateInterfaceProxyTypeWithoutTarget(
System.Type theInterface, System.Type[] interfaces,
Castle.DynamicProxy.ProxyGenerationOptions options) [0x00000]
  at
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithoutTarget (
System.Type theInterface, System.Type[] interfaces,
Castle.DynamicProxy.ProxyGenerationOptions options) [0x00000]
  at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget (
System.Type theInterface, System.Type[] interfaces,
Castle.DynamicProxy.ProxyGenerationOptions options,
Castle.Core.Interceptor.IInterceptor[] interceptors) [0x00000]
  at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget (
System.Type theInterface, System.Type[] interfaces,
Castle.Core.Interceptor.IInterceptor[] interceptors) [0x00000]
  at Rhino.Mocks.MockRepository.MockInterface
(Rhino.Mocks.CreateMockStatemockStateFactory,
System.Type type, System.Type[] extras) [0x00000]
  at Rhino.Mocks.MockRepository.CreateMockObject (System.Type type,
Rhino.Mocks.CreateMockState factory, System.Type[] extras, System.Object[]
argumentsForConstructor) [0x00000]
  at Rhino.Mocks.MockRepository.DynamicMultiMock (System.Type mainType,
System.Type[] extraTypes, System.Object[] argumentsForConstructor) [0x00000]

  at Rhino.Mocks.MockRepository.DynamicMock (System.Type type, System.Object[]
argumentsForConstructor) [0x00000]
  at Rhino.Mocks.Tests.FieldsProblem.PresenterBaseTestFixture.SetUp ()
[0x00000]
  at <0x00000> <unknown method>
  at (wrapper managed-to-native)
System.Reflection.MonoMethod:InternalInvoke(object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00000]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070312/99a5fafa/attachment.html 


More information about the Mono-devel-list mailing list