Release inline optimization leads to MethodAccessException if used with assembly:InternalsVisibleTo attribute #16105
Labels
Area-Compiler-CodeGen
IlxGen, ilwrite and things at the backend
Bug
Impact-High
(Internal MS Team use only) Describes an issue with extreme impact on existing code.
We've faced an issue that internal function get inlined in the public one and this in turn leads to MethodAccessException on caller side.
Repro steps
Repro zip is attached. just run MethodAccessBug console application in Release mode (not reproduced in Debug)
MethodAccessBug.zip
Expected behavior
Call to internal function is not inlined an no exception is thrown
Actual behavior
Call to internal function is inlined an exception is thrown
Known workarounds
Decorate public method with
[<MethodImpl(MethodImplOptions.NoInlining)>]
or with
[<NoCompilerInlining>]
Related information
The text was updated successfully, but these errors were encountered: