dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.37k stars 4.75k forks source link

Microsoft.DotNet.ILCompiler build fail #69223

Closed Cricle closed 2 years ago

Cricle commented 2 years ago

Description

Last console output is

C:\Users\Administrator\.nuget\packages\htmlagilitypack\1.11.42\lib\netstandard2.0\HtmlAgilityPack.dll : warning IL3053:
 Assembly 'HtmlAgilityPack' produced AOT analysis warnings. [G:\gitsouce\Anf\Platforms\Anf.Web\Anf.Web.csproj]
EXEC : error : Object reference not set to an instance of an object. [G:\gitsouce\Anf\Platforms\Anf.Web\Anf.Web.csproj]
  System.NullReferenceException: Object reference not set to an instance of an object.
     at ILCompiler.DependencyAnalysis.ConstrainedMethodUseLookupResult.GetTarget(NodeFactory factory, GenericLookupResu
  ltContext dictionary)
     at ILCompiler.DependencyAnalysis.ReadyToRunGenericHelperNode.InstantiateDependencies(NodeFactory factory, Instanti
  ation typeInstantiation, Instantiation methodInstantiation)
     at ILCompiler.DependencyAnalysis.ShadowConcreteMethodNode.GetStaticDependencies(NodeFactory factory)
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node
  )
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
     at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan()
     at ILCompiler.Program.Run(String[] args)
     at ILCompiler.Program.Main(String[] args)
C:\Users\Administrator\.nuget\packages\microsoft.dotnet.ilcompiler\7.0.0-preview.3.22175.4\build\Microsoft.NETCore.Nati
ve.targets(269,5): error MSB3073: 命令“"C:\Users\Administrator\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompile
r\7.0.0-preview.3.22175.4\tools\\ilc" @"obj\Release\net7.0\win-x64\native\Anf.Web.ilc.rsp"”已退出,代码为 1。 [G:\gitsouce\Anf\
Platforms\Anf.Web\Anf.Web.csproj]

Reproduction Steps

Use command

dotnet publish -c Release -f net6.0 -r win-x64

Expected behavior

Fail to compile to native

Actual behavior

Succeed

Regression?

.NET 6 or .NET 7

Microsoft.DotNet.ILCompiler 7.0.0-preview.3.22175.4

Known Workarounds

No response

Configuration

No response

Other information

No response

dotnet-issue-labeler[bot] commented 2 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

Cricle commented 2 years ago

Is .NET 6 Asp.net Core project suppport ILCompiler?

Cricle commented 2 years ago

Thanks, I will try after .NET 7 Release

MichalStrehovsky commented 2 years ago

This problem is not know, thanks for reporting. Reopening.

jkotas commented 2 years ago

@Cricle Could you please share a small project that reproduces the problem if possible?

hez2010 commented 2 years ago

I think it's a dup of https://github.com/dotnet/runtime/issues/68538 It can repro with both net6.0 and net7.0.

Cricle commented 2 years ago

@jkotas Can you try my project? I try to write mini project, but always compile succeed in NET6.0. https://github.com/Cricle/Anf/tree/dev/Platforms/Anf.Web image Restore this line and try publish