Overriding non-virtual methods using IL and Reflection.Emit

  • Thread starter Thread starter rfuller987
  • Start date Start date
R

rfuller987

Is it possible to override non-virtual methods using Reflection.Emit.
I'm creating dynamic proxy classes at runtime and I want to be able to
proxy all public methods on an object, regardless of whether the object
author happened to mark them as virtual or not. Is this possible?

-rfuller987
(e-mail address removed)
 
That's a real problem. That makes real aspect oriented programming in
..net impossible.
 
Well I think you picked the right person to talk to. I have some experience
in the area :)

There are other ways of implementing AOP than the dynamic proxy ...

There are also numerous AOP frameworks with this virtual limitation .. see
CastleProject, nAspect, spring .net

People have also looked at such operations as using the profiling API to
instrument IL just before JIT (this is being frowned on a bit).Personally I
at this point am leaning towards a "link" time IL based weave ...

If you happen to be in the southern US I will be speaking on this subject in
New Orleans the 17th.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
 
Do you have any more information on this 'link' time IL based weave.
Sounds promising, although I don't think I have the expertise to
implement it myself.

How does .net remoting work? Doesn't it manage to proxy any
MarshalByRef object regardless of the object's functions being marked
as virtual?

-rfuller
 
Back
Top