How do I write a code analysis tool for vs2008 to prevent a specific framework call, such as GC.WaitForFullGCComplete() or Application.DoEvents()
I tried overriding the VisitMethodCall in my custom rule, but I cannot figure out what the Microsoft.FxCop.Sdk.MethodCall parameter really has in it. Could not find example on the web.
Can someone point me in the correct direction?
Replace System.Web.HttpUtility.HtmlEncode(System.String)
with the method signature that you are trying to find and prevent.
public override ProblemCollection Check(Member member)
{
if (member is Method)
{
var callees = new List<Method>(Callees.CalleesFor((Method)member));
foreach (var callee in callees)
{
if (callee.FullName == "System.Web.HttpUtility.HtmlEncode(System.String)")
{
Problems.Add(new Problem(GetResolution()));
}
}
}
return Problems;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With