It tells NGen that it is OK to inline the method it's applied to even in a different assembly.
For example:
String.Equals
has [TargetedPatchingOptOut]
String.Equals
String.Equals
call, replacing the method call instruction with the actual code in the method.However, if Microsoft finds a security hole in String.Equals
, they cannot just update mscorlib.dll
, because that won't affect the assembly that you just NGen'd. (Since it has raw machine code without referencing String.Equals
).
I assume that if that were to actually happen, the security update would clear the NGen store.
Note that this attribute is only useful in the .NET Framework assemblies. You don't need it in your own. You can find more information about that here: https://stackoverflow.com/a/14982340/631802
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