-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Correctness.UseNoInliningWithGetCallingAssemblyRule(2.10)
Sebastien Pouliot edited this page Feb 9, 2011
·
3 revisions
Assembly: Gendarme.Rules.Correctness
Version: 2.10
This rule warns when a method call Assembly.GetCallingAssembly() from a method that is not decorated with MethodImpl(MethodImplOptions.NoInlining). Without this attribute the method could be inlined by the JIT. In this case the calling assembly would be the assembly of the caller (of the inlined method), which could be different than the assembly of the real, source-wise, caller to Assembly.GetCallingAssembly.
Bad example:
public void ShowInfo ()
{
Console.WriteLine (Assembly.GetCallingAssembly ().Location);
}
Good example:
[MethodImpl (MethodImplOptions.NoInlining)]
public void ShowInfo ()
{
Console.WriteLine (Assembly.GetCallingAssembly ().Location);
}
- This rule is available since Gendarme 2.8
Note that this page was autogenerated (3/17/2011 9:31:58 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!