Right, the class you are proxying would have to extend MarshalByRefObject
calls to it. When the JIT compiler sees a non-virtual method call, it
dynamic interception technique (MBROs are a special case). For your
non-vrituals no longer works. If that is acceptable for you, then perhaps
due in large part to the performance implications). If this is what you
you're trying to achieve, you're probably out of luck. The only
when it is jitted (see [1]). However, the profiler API is intended only to
This posting is provided "AS IS" with no warranties, and confers no rights.
> From: "Kemal Erdogan" <kemal@erdogan.biz>
> Subject: RE: Calling a private base constructor from within a constructor
in MSIL
> Date: Sat, 5 Feb 2005 17:03:32 -0800
>
> Hello Rick,
>
> Thank you for your reply. I would need a custom solution
> just because dotnet framework does not support multiple
> inheritance.
>
>
> I actually need to intercept method calls, so change of
> method definitions at runtime would also be a possible
> solution for me. Do you know a good tool, or have some
> source code for that?
>
> Kemal
>
>
> >-----Original Message-----
> >Hi Kemal,
> >No you cannot call a private base class constructor
> directly - that is
> >exactly what the "private" means <grin>. Also, in order
> for a constructor
> >to be verifiable, it must directly call a constructor of
> it's base class.
> >Jim Miller's annotated CLI book has an interesting
> discussion (page 76) of
> >the implications of this for languages like Eiffel that
> don't want this
> >restriction.
> >
> >Assuming you only want to run in full-trust, you might
> be able to get away
> >with something unverifiable. For example, don't call
> any base constructor
> >directly, but instead use reflection to invoke the base
> constructor using
> >your existing "this" pointer. However, I'm not sure
> offhand whether
> >reflection will let you invoke a constructor on an
> existing object like a
> >regular method.
> >
> >Regardless, there are larger problems with creating a
> true transparent
> >proxy class like this yourself. This is exactly why the
> CLR has built-in
> >support for transparent proxies. Is there some reason
> why you couldn't use
> >the existing TransparentProxy system to do what you want?
> >
> >Rick
> >
> >--------
> >This posting is provided "AS IS" with no warranties, and
> confers no rights.
> >--------------------
> >> Subject: Calling a private base constructor from
> within a constructor in
> >MSIL
> >> Message-ID: <opsk1x3jpe2wljbb@kk-home.chello.at>
> >> From: "Kemal Erdogan" <kemal@erdogan.biz>
> >> Date: Sun, 23 Jan 2005 11:58:21 +0100
> >>
> >> Hello All,
> >>
> >> I am trying to implement proxies for a certain group
> of classes, using
> >> System.Reflection.Emit. Subclassing works fine as long
> as the base class
> >> have a non-private default constructor.
> >>
> >> Here is a part of my code:
> >>
> >> ConstructorInfo ci = basetype.GetConstructor
> (ALL_INSTANCE_METHODS,
> >> null, CallingConventions.Standard,
> >> Type.EmptyTypes, new
> ParameterModifier[0] );
> >>
> >> constructorIL.Emit( OpCodes.Ldarg_0 );
> >> constructorIL.Emit( OpCodes.Call, ci );
> >>
> >> peverify.exe complains when I generate a proxy
> assembly that makes calls
> >> to private base constructor. And it actually does not
> work.
> >>
> >> Is it possible at all to make a call to private base
> constructor? And a
> >> weird question: Can I actually create the base class
> instance using
> >> reflection and the base private constructor, then
> assign the returned
> >> object to "this" pointer (the argument 0) within
> subclass's constructor.
> >>
> >>
> >> Thank you for any answers,
> >> Kemal
> >> --
> >> Using Opera's revolutionary e-mail client:
>
http://www.opera.com/m2/ > >>
> >
> >.
> >
>