-
Notifications
You must be signed in to change notification settings - Fork 126
Closed
Description
Kicking the tires with .Net 5 and specifically trimmed publishing.
When PublishTrimmed is true, getting this exception (no exception with regular publish).
Build started...
1>------ Build started: Project: MyProjectCommon, Configuration: Release Any CPU ------
1>MyProjectCommon -> S:\e\MyProject1\src\MyProject\MyProjectCommon\bin\Release\net5.0-windows7.0\win10-x64\MyProjectCommon.dll
2>------ Publish started: Project: MyProjectConsole, Configuration: Release Any CPU ------
2>Determining projects to restore...
2>All projects are up-to-date for restore.
2>MyProjectConsole -> S:\e\MyProject1\src\MyProject\MyProjectConsole\bin\Release\net5.0-windows7.0\win10-x64\MyProjectConsole.dll
2>C:\Program Files (x86)\dotnet\dotnet.exe "C:\Program Files (x86)\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.ILLink.Tasks\tools\netcoreapp3.0\illink.dll" -a "C:\Users\myalias\.nuget\packages\commandlineparser\2.8.0\lib\netstandard2.0\CommandLine.dll"
2>-a "C:\Users\myalias\.nuget\packages\markdig.signed\0.21.1\lib\netcoreapp3.1\Markdig.Signed.dll"
<...>
2>-reference "C:\Users\myalias\.nuget\packages\microsoft.management.infrastructure\2.0.0\ref\netstandard1.6\Microsoft.Management.Infrastructure.Native.dll"
2>-p skip "Microsoft.Management.Infrastructure.Native"
2>-out "obj\Release\net5.0-windows7.0\win10-x64\linked"
2>--nowarn "1701;1702;1701;1702;2008;IL2026;IL2041;IL2042;IL2043;IL2056;IL2045;IL2046;IL2050;IL2032;IL2055;IL2057;IL2058;IL2059;IL2060;IL2061;IL2096;IL2062;IL2063;IL2064;IL2065;IL2066;IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091;IL2092;IL2093;IL2094;IL2095;IL2097;IL2098;IL2099"
2>--warn "5"
2>--warnaserror --warnaserror ";NU1605"
2>-b
2>-c copyused -u copyused
2>--skip-unresolved true
2>
2>IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues
2>Fatal error in IL Linker
2>Unhandled exception. System.NotImplementedException: GenericInst
2> at Mono.Cecil.SignatureReader.ReadPrimitiveValue(ElementType type)
2> at Mono.Cecil.SignatureReader.ReadConstantSignature(ElementType type)
2> at Mono.Cecil.MetadataReader.ReadLocalConstant(UInt32 rid)
2> at Mono.Cecil.MetadataReader.ReadLocalScope(Row`6 record)
2> at Mono.Cecil.MetadataReader.ReadScope(MethodDefinition method)
2> at Mono.Cecil.Cil.PortablePdbReader.ReadScope(MethodDebugInformation method_info)
2> at Mono.Cecil.Cil.PortablePdbReader.Read(MethodDefinition method)
2> at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
2> at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
2> at Mono.Cecil.MetadataReader.ReadMethodBody(MethodDefinition method)
2> at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
2> at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
2> at Mono.Cecil.MethodDefinition.get_Body()
2> at Mono.Linker.Steps.RemoveUnreachableBlocksStep.FindConstantExpressionsMethods(Collection`1 types)
2> at Mono.Linker.Steps.RemoveUnreachableBlocksStep.Process()
2> at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
2> at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
2> at Mono.Linker.Pipeline.Process(LinkContext context)
2> at Mono.Linker.Driver.Run(ILogger customLogger)
2> at Mono.Linker.Driver.Main(String[] args)
2>Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
2>Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
This is the publish profile:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net5.0-windows7.0\win10-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>
</Project>
dotnet --version
5.0.101
dotnet --list-sdks
3.1.404 [C:\Program Files (x86)\dotnet\sdk]
5.0.101 [C:\Program Files (x86)\dotnet\sdk]
Reactions are currently unavailable