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 / CLR / September 2003

Tip: Looking for answers? Try searching our database.

Poosible to runtime modify an existing class method?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stefan - 10 Sep 2003 07:45 GMT
Hi!

Does anyone know if it's possible to modify a method at runtime?
I've searched around and all that I find is the possibility to
extend classes at runtime, adding properties, methods etc.
(TypeBuilder, MethodBuilder, reflection etc)

What I actually want to do is to inject debug support dynamically,
starting with enter/leave tracing..

All tips appreciated
Stefan
Ben Blair - 16 Sep 2003 00:14 GMT
Stefan,

Take a look at Aleksandr Mikunov's excellent article on  
using the Profiling API to re-write msi on the fly (right
before it goes to the JIT).

http://msdn.microsoft.com/msdnmag/issues/03/09/NETProfiling
API/default.aspx

- Ben Blair
- benblair@Association of Computing Machinery dot org

>-----Original Message-----
>Hi!
[quoted text clipped - 10 lines]
> Stefan
>.
Thomas Tomicek [MVP] - 16 Sep 2003 05:45 GMT
And then stay away from it for the reasons documented in the documentation.

Signature

Regards

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)

> Stefan,
>
[quoted text clipped - 25 lines]
> > Stefan
> >.
Thomas Tomicek [MVP] - 16 Sep 2003 05:45 GMT
> Hi!
>
> Does anyone know if it's possible to modify a method at runtime?

No, not unless you go for the profiler API which is a TERRIBLE bad idea to
do for a number of reasons, one being that it is a develloper API which your
user may not have access to.

I actually stay away from thei API aolso for another reason: I like to
profile my programs, and there can only ever be ONE user of this API.

Signature

Regards

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)

Ice - 19 Sep 2003 14:20 GMT
You have to implement some form of interception (at a performance risk).
What I have seen done (and implemented) is creating a proxy for all objects
and then having the proxy write trace info before and after calling the
"real" object to execute the method.

can be 5 - 200 times slower.
ice
> Hi!
>
[quoted text clipped - 8 lines]
> All tips appreciated
>  Stefan

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.