object traps

J

John Rivers

hi

does anybody know of a way to detect all accesses to an object
including
method or property entry and exit
instance or static field read and write etc.

this would be very useful during debugging but also at runtime

imagine being able to implement an event handler for every write to a
field etc.

tools like speedtrace get very close to what I want

http://www.ipcas.com/trace-and-profile/c-sharp-and-vb.net-tracer-and-profiler

but I want access to that type of information from within my
application

john
 
S

Sergey Zyuzin

hi

does anybody know of a way to detect all accesses to an object
including
method or property entry and exit
instance or static field read and write etc.

this would be very useful during debugging but also at runtime

imagine being able to implement an event handler for every write to a
field etc.

tools like speedtrace get very close to what I want

http://www.ipcas.com/trace-and-profile/c-sharp-and-vb.net-tracer-and-...

but I want access to that type of information from within my
application

john

Hi John,

I think what you describe can be solved with Aspect Oriented
Programming. There are some sorts of AOP implementations for .NET,
like Spring .Net framework for example.(http://www.springframework.net/
doc-latest/reference/html/aop-quickstart.html)

In .NET you can use ContextBoundObjects to handle calls to methods and
properties.
Here's an article about this: http://www.codeproject.com/KB/cs/aspectintercept.aspx

HTH,
Sergey
 
J

John Rivers

Hi John,

I think what you describe can be solved with Aspect Oriented
Programming. There are some sorts of AOP implementations for .NET,
like Spring .Net framework for example.(http://www.springframework.net/
doc-latest/reference/html/aop-quickstart.html)

In .NET you can use ContextBoundObjects to handle calls to methods and
properties.
Here's an article about this:http://www.codeproject.com/KB/cs/aspectintercept.aspx

HTH,
Sergey


Thanks Sergey

that CodeProject article seems to do exactly what I need

now I just have to understand it completely before I use it for real

I read a bit on the Spring.net aspect oriented programming - there are
some big ideas
in there .. maybe too big for me *-)

Thanks again

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top