dotnet / dotnet/dotnet-api-docs
Depth of AggressiveInlining option
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
Re the [documentation for MethodImplAttribute](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Runtime.CompilerServices/MethodImplAttribute.xml), I've noticed on multiple occasions that people use the `MethodImplOptions.AggressiveInlining` option, but it would be helpful if the documentation explains the depth of the `AggressiveInlining` option, meaning whether it applies to only one method or also applies to the methods invoked by that method.
For example, does the following mean that **only** `AddOrFail` will be inlined, or does it mean that `AddOrFail` **and** `inDict.Add` will be inlined?
```
[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
public static void AddOrFail(this Dictionary inDict, TKey inKey, TValue inValue)
{
inDict.Add(inKey, inValue);
}
```
The "aggressive" in the name `AggressiveInlining` suggests that may perform multiple levels of inlining but the documentation doesn't explain and I cannot find the answer anywhere.
The problem here is that if people use the `AggressiveInlining` option and it inlines multiple levels of invocations, then it can cause an unexpected/undesired "code size explosion".
Thanks for considering this issue.
Contributor guide
Assessment
This issue has not been assessed yet.