Friend assemblies ("InternalsVisibleTo") can leak via automatic inlining cause runtime error
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Assembly A exposed it's internal to Assembly B via the `InternalsVisibleTo` attribute. Assembly B provides a simple method to Assembly C, but because it's a simple method, it is inlined by the f# compiler into Assembly C. This results in Runtime error.
**Expected behavior**
The FSharp compiler shouldn't inline methods that have calls to methods that have been exposed via InternalsVisibleTo.
**Actual behavior**
Runtime error.
**Known workarounds**
As per #5178, the use of `[]` stops the f# compiler from inling the method, but has the side effect that the JIT also stops inlining the call.
**Related information**
C:> fsc.exe
Microsoft (R) F# Compiler version 10.4.0 for F# 4.6
Copyright (c) Microsoft Corporation. All Rights Reserved.
Contributor guide
Assessment
This issue has not been assessed yet.