Tuna,

The cause of your error may be that there was a slight change that
fixed handling constructor parameters of some cases with class proxy.
Seems that RM relies on the buggy behavior, hence the error. I'm
reinstalling my VS and SDKs so I can't confirm, but it's very likely
that's the case.

On Jun 27, 3:38 pm, Tuna Toksoz <[email protected]> wrote:
> After updating Castle dlls on my local copy, below is what i get.
>
> MyTestCase : Failed *** Failures ***
> Exception
> System.MissingMethodException: Can't find a constructor with matching
> arguments ---> System.MissingMethodException: Constructor on type
> 'MyClassProxy64aace5742f44fb6b83beef215414c3b' not found.
>    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
> Binder binder, Object[] args, CultureInfo culture, Object[]
> activationAttributes)
>    at System.Activator.CreateInstance(Type type, BindingFlags
> bindingAttr, Binder binder, Object[] args, CultureInfo culture,
> Object[] activationAttributes)
>    at System.Activator.CreateInstance(Type type, Object[] args)
>    at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type
> classToProxy, Type[] additionalInterfacesToProxy,
> ProxyGenerationOptions options, Object[] constructorArguments,
> IInterceptor[] interceptors)
>    at Rhino.Mocks.MockRepository.MockClass(CreateMockState
> mockStateFactory, Type type, Type[] extras, Object[]
> argumentsForConstructor) in
> D:\OpenSourceProjects\RhinoTools\mocks\Rhino.Mocks\MockRepository.cs:line
> 780
>    --- End of inner exception stack trace ---
>    at Rhino.Mocks.MockRepository.MockClass(CreateMockState
> mockStateFactory, Type type, Type[] extras, Object[]
> argumentsForConstructor) in
> D:\OpenSourceProjects\RhinoTools\mocks\Rhino.Mocks\MockRepository.cs:line
> 786
>    at Rhino.Mocks.MockRepository.CreateMockObject(Type type,
> CreateMockState factory, Type[] extras, Object[]
> argumentsForConstructor) in
> D:\OpenSourceProjects\RhinoTools\mocks\Rhino.Mocks\MockRepository.cs:line
> 882
>    at Rhino.Mocks.MockRepository.PartialMultiMock(Type type, Type[]
> extraTypes, Object[] argumentsForConstructor) in
> D:\OpenSourceProjects\RhinoTools\mocks\Rhino.Mocks\MockRepository.cs:line
> 536
>    at Rhino.Mocks.MockRepository.PartialMock(Type type, Object[]
> argumentsForConstructor) in
> D:\OpenSourceProjects\RhinoTools\mocks\Rhino.Mocks\MockRepository.cs:line
> 511
>    at Rhino.Mocks.MockRepository.PartialMock[T](Object[]
> argumentsForConstructor) in
> D:\OpenSourceProjects\RhinoTools\mocks\Rhino.Mocks\MockRepository.cs:line
> 1275
>    at Rhino.Mocks.Tests.MyTest.MyTestCase() in
> D:\OpenSourceProjects\RhinoTools\mocks\Rhino.Mocks.Tests\MyTest.cs:line
> 23
>
> Tuna Toksöz
> Eternal sunshine of the open source mind.
>
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
>
> On Sat, Jun 27, 2009 at 2:53 PM, Tim Barcz <[email protected]> wrote:
> > Though I don't have a fix for you the problem comes in with DP and the
> > "List<string>[] action" param.  I don't know all the details but at one time
> > (and maybe still exists) there was some goofiness around DP and generics.
> > Playing with your code I found the following (draw your own conclusions)
>
> > The test passes when:
>
> >    - I get ride of the array as a param - public virtual void
> >    Foo<T>(List<T> action) { }
> >    - I make the method NOT generic - public virtual void Foo(IList<string>
> >    action) { }
>
> > It seems to be an issue with DP and generics, whether an array of lists (of
> > type T) or making Foo a generic method.
>
> > I'll enlist some DP experts who can hopefully help.
>
> > Tim
>
> > On Sat, Jun 27, 2009 at 12:22 AM, Kenneth Xu <[email protected]> wrote:
>
> >> Hi,
>
> >> Here is the test code to reproduce it.
> >>    public abstract class MyClass
> >>    {
> >>        public virtual void Foo<T>(List<T>[] action) { }
>
> >>        /* ... */
> >>    }
>
> >>    [TestFixture] public class MyTest
> >>    {
> >>        [Test] public void MyTestCase()
> >>        {
> >>            var mockery = new MockRepository();
> >>            var mock = mockery.PartialMock<MyClass>();
> >>            mockery.ReplayAll();
> >>            mock.Foo<string>(null);
> >>        }
> >>    }
>
> >> Am I doing anything wrong here or this is a bug? from Castle dynamic
> >> proxy?
>
> >> Thanks,
> >> Kenneth
>
> > --
> > Tim Barcz
> > ASPInsider
> >http://timbarcz.devlicio.us
> >http://www.twitter.com/timbarcz
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to