Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Overriding non-virtual methods using IL and Reflection.Emit

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rfuller987@hotmail.com - 07 Jul 2006 18:48 GMT
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
rfuller987@hotmail.com
Greg Young - 07 Jul 2006 19:19 GMT
No.(Notice that every dynamic proxy has this limitation).

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

> 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
[quoted text clipped - 3 lines]
> -rfuller987
> rfuller987@hotmail.com
rfuller987@hotmail.com - 07 Jul 2006 21:19 GMT
That's a real problem.  That makes real aspect oriented programming in
.net impossible.

> No.(Notice that every dynamic proxy has this limitation).
>
[quoted text clipped - 11 lines]
> > -rfuller987
> > rfuller987@hotmail.com
Greg Young - 07 Jul 2006 21:49 GMT
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

> That's a real problem.  That makes real aspect oriented programming in
> .net impossible.
[quoted text clipped - 14 lines]
>> > -rfuller987
>> > rfuller987@hotmail.com
rfuller987@hotmail.com - 10 Jul 2006 14:19 GMT
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

> Well I think you picked the right person to talk to. I have some experience
> in the area :)
[quoted text clipped - 35 lines]
> >> > -rfuller987
> >> > rfuller987@hotmail.com

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.