-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trimmability and compiler optimization regression in FSharp.Core.dll with .NET 8.0.300 SDK #17381
Comments
It has changed in #15484, it's not inlined because inline logic has changed - it will no longer inline anything private. It was changed back in #17189 (at least I believe it fixed it): Here's result of building it with internal static BindingFlags AllStatics
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
}
}
internal static string[] GetStaticMethods(Type t)
{
MethodInfo[] array = ArrayModule.Filter(GetStaticMethods@10.@_instance, t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
if (array == null)
{
throw new ArgumentNullException("array");
}
string[] array2 = new string[array.Length];
for (int i = 0; i < array2.Length; i++)
{
array2[i] = array[i].Name;
}
return array2;
} It should also be in |
8.0.400 won't release until August - but at this point any backport of this fix to the 8.0.3xx SDKs wouldn't be releasing until August's patch release anyway so there's no chance for this to be fixed sooner than that. |
So it sounds like this issue will be fixed in an upcoming release? |
Yeah, it appears so. If it won't, please bump the issue (or create a new one). |
Great! I'll close this then. Thanks! |
Please provide a succinct description of the issue.
In
.nuget\packages\fsharp.core\8.0.200\lib\netstandard2.0\FSharp.Core.dll
there is a method Microsoft.FSharp.Core.PrintfImpl.FormatParser<TPrinter,TState,TResidue,TResult>.buildCaptureFuncInside that method there is reflection.
When you look at the compiled IL (I'm going to use decompiled C# from ILSpy since that's going to be easiest to read) the
GetMethod
calls look likeAnd for context here is the source code.
The key thing to note is that
AllStatics
is inlined. This inlining allows ILLink to detect the dependency and markSpecializations<TState, TResidue, TResult>.CaptureFinal1
So all is good with
FSharp.Core.dll
from 8.0.200.Now to the problem, If you look at the same method in
FSharp.Core.dll
from 8.0.300 it looks different.Notice that
AllStatics
has not been inlined. This leads to ILLink not being able to detect the dependency and leads to aMissingMethodException
if this code path is hit on a trimmed assembly.I dropped the following code into an F# library to play around with the behavior.
Using the 8.0.202 .NET SDK, when I compile in Debug,
AllStatics
is not inlined. When I compile in Release,AllStatics
is inlined.If I take that same repro, and compile it in Release using the 8.0.300 .NET SDK
AllStatics
is no longer inlined.Expected behavior
AllStatics is inlined.
Actual behavior
AllStatis is not inlined.
Known workarounds
You could use a link.xml file to workaround the trimming problem.
The text was updated successfully, but these errors were encountered: