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 2006

Tip: Looking for answers? Try searching our database.

CLR Events and Handlers?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MD - 10 Sep 2006 03:05 GMT
Is there a means of hooking events from the CLR that fire before and
after any member of a class is accessed/invoked within a particular
assembly?  I am looking for something akin to how trace switches work.
With those one can simply insert entries into the application
configuration file to define the switch and then be able to capture the
output of debug/trace calls and so forth.  But that requires
pre-emptive coding in the assemblies being traced.  I am looking for
the ability to detect whether particular class members are being used
within assemblies that are already compiled and would be too-ROI costly
to refactor to use tracing calls.  So I am wondering if the CLR or
Framework itself already defines any such events to which handlers can
be defined in configuration files.  My targets are mainly Win32's.  I
know that with ASP.NET I have the option to register my own custom HTTP
handler and thus be able to do similar detections at the URL level,
which is not quite the same, but close.

Thanks in advance.
Greg Young - 12 Sep 2006 07:55 GMT
You might want to look at using AOP for this...

You could quite easily define a tracing aspect (and it would be configured
in your config file/applied at runtime).

Another method you could use would be to look at the profiling API.

> Is there a means of hooking events from the CLR that fire before and
> after any member of a class is accessed/invoked within a particular
[quoted text clipped - 13 lines]
>
> Thanks in advance.
Jay B. Harlow [MVP - Outlook] - 13 Sep 2006 00:01 GMT
It sounds like you want to use the Profiling APIs

http://msdn.microsoft.com/msdnmag/issues/03/01/NETProfilerAPI/

Alternatively you might be able to use CLR Profiler to extract the info for
you:

http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926
-862B40AA0CD0&displaylang=en


Signature

Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net

| Is there a means of hooking events from the CLR that fire before and
| after any member of a class is accessed/invoked within a particular
[quoted text clipped - 13 lines]
|
| Thanks in advance.

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.