[Mono-list] Assertion failures when using Moq on Linux/ARM
Weeble
clockworksaint at gmail.com
Fri Feb 4 05:52:52 EST 2011
I'm currently running Mono 2.6.7 on an ARM box (a Sheevaplug) running
Linux. When I try to run unit tests that work on Windows-x86 with
Microsoft's CLR and on Linux-x86 with Mono, they fail often (but not
always) with an assertion:
ERROR:mini-arm.c:2579:handle_thunk: assertion failed: (pdata.found == 1)
Stacktrace:
at (wrapper managed-to-native)
System.Delegate.CreateDelegate_internal
(System.Type,object,System.Reflection.MethodInfo,bool) <0xffffffff>
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo,bool) <0x006c0>
at System.Delegate.CreateDelegate
(System.Type,object,System.Reflection.MethodInfo) <0x0002f>
at System.Reflection.Emit.DynamicMethod.CreateDelegate
(System.Type,object) <0x0003f>
at System.Linq.Expressions.EmitContext.CreateDelegate
(System.Runtime.CompilerServices.ExecutionScope) <0x0003f>
at System.Linq.Expressions.CompilationContext.CreateDelegate
(int,System.Runtime.CompilerServices.ExecutionScope) <0x00043>
at System.Linq.Expressions.CompilationContext.CreateDelegate () <0x0003f>
at System.Linq.Expressions.LambdaExpression.Compile () <0x00053>
at System.Linq.Expressions.Expression`1<object>.Compile () <0x0001b>
at Moq.Mock.GetInterceptor
(System.Linq.Expressions.Expression,Moq.Mock) <0x00073>
at Moq.Mock.Verify<object>
(Moq.Mock,System.Linq.Expressions.Expression`1<System.Action`1<object>>,Moq.Times,string)
<0x001eb>
at Moq.Mock`1<object>.Verify
(System.Linq.Expressions.Expression`1<System.Action`1<object>>)
<0x00063>
...
You can see the source of GetInterceptor here:
http://code.google.com/p/moq/source/browse/trunk/Source/Mock.cs#sl_svn751_676
private static Interceptor GetInterceptor(Expression fluentExpression,
Mock mock)
{
var targetExpression = FluentMockVisitor.Accept(fluentExpression, mock);
var targetLambda =
Expression.Lambda<Func<Mock>>(Expression.Convert(targetExpression,
typeof(Mock)));
var targetObject = targetLambda.Compile()();
return targetObject.Interceptor;
}
The expression getting passed in is fairly trivial. My code does this:
iMockListener.Verify(x => x.SetPropInt(1, 1999));
And then I think Verify extracts the object expression from the method
call which I guess is just the identity function?
Looking at mini-arm.c, I think that assertion is saying that it can't
find an appropriate place to create the thunk for a delegate. Is that
right?
1. Is this a bug?
2. If I move to Mono 2.8, am I likely to have any better luck?
3. Does Moq create too many delegates to work properly on ARM? Is this
an inappropriate library to use on an ARM device?
4. Is this problem limited only to doing advanced stuff with Linq
expressions or can it happen simple from creating a lot of delegates?
5. Is it useful for me to try to put together a minimal example to
replicate the problem?
Best regards,
Weeble.
More information about the Mono-list
mailing list