Publishing a trimmed ASP.NET project does not print trim warnings
Repro steps
- Create an empty C# ASP.NET application
- Create an empty F# ASP.NET application
- Put
<PublishTrimmed>true</PublishTrimmed>into both project files -
dotnet publish -c Release --self-containedeach project
Expected behavior
Publishing the F# project prints a list of warnings similar to the C# counterpart. Such as:
ILLink : Trim analysis warning IL2026: System.Security.Cryptography.Xml.CryptoHelpers.CreateFromName<T>(String): Using
member 'System.Security.Cryptography.CryptoConfig.CreateFromName(String)' which has 'RequiresUnreferencedCodeAttribute'
can break functionality when trimming application code. The default algorithm implementations might be removed, use st
rong type references like 'RSA.Create()' instead. [snip\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj]
snip\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.0-rc.2.22476.2\runtimes\win-x64\lib\net7.0\M
icrosoft.AspNetCore.Components.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Components' produced trim warnings.
For more information see https://aka.ms/dotnet-illink/libraries [snip\ConsoleApp1\ConsoleApp1\Cons
oleApp1.csproj]
Actual behavior
Publishing the F# project prints no warnings at all.
Known workarounds
None.
Related information
- 7.0.100-rc.2.22477.23
- Win 10
I'm not entirely sure it's F# issue, we don't so anything special regarding this flag.
@baronfel do you happen to know who we can talk to about it?
Fair. I suspected the issue might be transferred, but this repo seemed like a good first port of call.
Not 100% sure, I'd want to see a binlog of each case and try to identify what's different.
Though I fear that if the analysis is Roalyn-analyzer-based, F# simply won't be able to participate in it at all.
@agocke do you know off the top of your head how this works?
Yup, we have two experiences: roslyn analyzers for build time analysis and IL analysis during publishing. I'd definitely expect F# to get the IL analysis during publish. If it's not, my first guess is that warnings are disabled somehow via <SuppressTrimAnalysisWarnings>true</>. That's not supposed to be enabled for ASP, but I can't rule it out,
Building an Android project with trimming and AOT enabled does not print any warnings at all either.
@kerams My recollection is that warnings are suppressed by default for Android. Could you try setting SuppressTrimAnalysisWarnings to false?
Nothing. I'm guessing F# tooling swallows or does not opt into these.