CodePlexProject Hosting for Open Source Software
I would like to insert a method just like:
public int add([PexAssumeUnderTest]Class1 target, int j)
int result = target.add(j);
Is there any way to achieve this?
Certainly, make a mutable copy of the assembly you want to modify, then make the new method (using the mutable metadata model), insert it in the right place and write out the assembly.
Thanks for the quick responding. If just for inserting the method, I know how to do it. however, I don't know how to add the attribute for the method and parameter.
Add a new CustomAtrribute object to the Attributes collections of the method and parameter, respectively.
could you give me an example?
I still have some problems about how to define a new CustomAttribute, is there any sample code for that?
Have look at Normalizer.cs in the MutableMetadataModel project for examples of how custom attributes are constructed and added to a code model.
Are you sure you want to delete this post? You will not be able to recover it later.
Are you sure you want to delete this thread? You will not be able to recover it later.