dotnet / dotnet/dotnet-api-docs

Depth of AggressiveInlining option

Open
#2,479 0 comments 0 reactions 0 assignees View on GitHub
area-System.Runtime doc-enhancement Pri3
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.