how to save the return value using cci

Dec 7, 2010 at 4:42 PM

Hello,  I am a green hand for Cci. Now, I want to instrument a method to save its return value into a file. how to do it? Thanks

Coordinator
Dec 8, 2010 at 2:50 PM

You can look at the ILMutator project which is in the Metadata/Samples folder. That shows how to inject calls to Console.WriteLine. I would first change it so that it calls WriteLine with the return value from each method (or just the methods you want to instrument). Then you could change the calls to WriteLine to be calls to write to a file instead.

Let me know if that doesn't work.

Dec 10, 2010 at 7:05 AM

Thanks for your help, I have solved the problem for saving the return value.  But now, I meet another problem. When I try to save the state of a field, I don't know how to deal with the situation like "class.field", in which, ''class" is a instance of a type, "field" is a field for this type. Could you give me some suggestion? Thanks.