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

NativeAOT compile with FSharp get broken in net8.0.100-preview.4 #86676

Closed luojunyuan closed 1 year ago

luojunyuan commented 1 year ago

Description

dotnet version 8.0.100-preview.4.23260.5

failed to compile fsharp hello world

Reproduction Steps

dotnet new console -lang F# -o ConsoleApp1
cd ConsoleApp1
dotnet publish -p:PublishAot=true

Expected behavior

net version 8.0.100-preview.2.23157.25 Should be normally compiled (with some warning message currently)

  Generating native code
C:\Users\hide\.nuget\packages\fsharp.core\7.0.300-beta.23127.2\lib\netstandard2.1\FSharp.Core.d
ll : warning IL3053: Assembly 'FSharp.Core' produced AOT analysis warnings. [C:\Users\hide\sour
ce\repos\hide\hide\hide\hide.fsproj]
C:\Users\hide\.nuget\packages\fsharp.core\7.0.300-beta.23127.2\lib\netstandard2.1\FSharp.Core.d
ll : warning IL2104: Assembly 'FSharp.Core' produced trim warnings. For more information see htt
ps://aka.ms/dotnet-illink/libraries [C:\Users\hide\source\repos\hide\hide\hide\cxpip
e.fsproj]

Actual behavior

dotnet version 8.0.100-preview.4.23260.5

Generating native code
EXEC : error : Failed to load type '!0' from assembly 'FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [/Users/hide/hide/hide/hide/hide.fsproj]
  Internal.TypeSystem.TypeSystemException+TypeLoadException: Failed to load type '!0' from assembly 'FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
     at Internal.TypeSystem.ThrowHelper.ThrowTypeLoadException(ExceptionStringID, String, String) in /_/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs:line 17
     at System.Reflection.TypeNameParser.GetType(String, ReadOnlySpan`1, String) in /_/src/coreclr/tools/Common/TypeSystem/Common/Utilities/CustomAttributeTypeNameParser.cs:line 97
     at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser&, String) in /_/src/libraries/Common/src/System/Reflection/TypeNameParser.cs:line 515
     at System.Reflection.TypeNameParser.GenericTypeName.ResolveType(TypeNameParser&, String) in /_/src/libraries/Common/src/System/Reflection/TypeNameParser.cs:line 613
     at Internal.TypeSystem.Ecma.CustomAttributeTypeProvider.GetTypeFromSerializedName(String) in /_/src/coreclr/tools/Common/TypeSystem/Ecma/CustomAttributeTypeProvider.cs:line 59
     at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeArgument(BlobReader&, ArgumentTypeInfo)
     at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeFixedArguments(BlobReader&, BlobReader&, Int32, BlobReader)
     at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeValue(EntityHandle, BlobHandle)
     at Internal.TypeSystem.Ecma.MetadataExtensions.GetDecodedCustomAttributes(EcmaMethod, String, String)+MoveNext()
     at ILCompiler.DependencyAnalysis.DynamicDependencyAttributesOnEntityNode.GetStaticDependencies(NodeFactory) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DynamicDependencyAttributesOnEntityNode.cs:line 61
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 182
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 222
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 257
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 308
     at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs:line 140
     at ILCompiler.Program.<Run>g__RunScanner|3_0(<>c__DisplayClass3_0&) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 443
     at ILCompiler.Program.Run() in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 423
     at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass206_0.<.ctor>b__0(InvocationContext) in /_/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs:line 275
/Users/hide/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/build/Microsoft.NETCore.Native.targets(270,5): error MSB3073: コマンド ""/Users/hide/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler.0-preview.4.23259.5/tools/ilc" @"obj/Release/net8.0/osx-arm64/native/hide.ilc.rsp"" はコード 1 で終了しました。ika/hide/hide/hide/hide.fsproj]

Regression?

it's worked in 8.0.100-preview.2.23157.25

Known Workarounds

none

Configuration

  1. dotnet version 8.0.100-preview.4.23260.5
  2. osx13.3.1 m1 and windows11 on arm
  3. ARM64
  4. maybe

Other information

both windows and Mac are the same situation

ghost commented 1 year ago

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.

Issue Details
### Description dotnet version 8.0.100-preview.4.23260.5 failed to compile fsharp hello world ### Reproduction Steps ``` dotnet new console -lang F# -o ConsoleApp1 cd ConsoleApp1 dotnet publish -p:PublishAot=true ``` ### Expected behavior net version 8.0.100-preview.2.23157.25 Should be normally compiled (with some warning message currently) ``` Generating native code C:\Users\hide\.nuget\packages\fsharp.core\7.0.300-beta.23127.2\lib\netstandard2.1\FSharp.Core.d ll : warning IL3053: Assembly 'FSharp.Core' produced AOT analysis warnings. [C:\Users\hide\sour ce\repos\hide\hide\hide\hide.fsproj] C:\Users\hide\.nuget\packages\fsharp.core\7.0.300-beta.23127.2\lib\netstandard2.1\FSharp.Core.d ll : warning IL2104: Assembly 'FSharp.Core' produced trim warnings. For more information see htt ps://aka.ms/dotnet-illink/libraries [C:\Users\hide\source\repos\hide\hide\hide\cxpip e.fsproj] ``` ### Actual behavior dotnet version 8.0.100-preview.4.23260.5 ``` Generating native code EXEC : error : Failed to load type '!0' from assembly 'FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [/Users/hide/hide/hide/hide/hide.fsproj] Internal.TypeSystem.TypeSystemException+TypeLoadException: Failed to load type '!0' from assembly 'FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Internal.TypeSystem.ThrowHelper.ThrowTypeLoadException(ExceptionStringID, String, String) in /_/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs:line 17 at System.Reflection.TypeNameParser.GetType(String, ReadOnlySpan`1, String) in /_/src/coreclr/tools/Common/TypeSystem/Common/Utilities/CustomAttributeTypeNameParser.cs:line 97 at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser&, String) in /_/src/libraries/Common/src/System/Reflection/TypeNameParser.cs:line 515 at System.Reflection.TypeNameParser.GenericTypeName.ResolveType(TypeNameParser&, String) in /_/src/libraries/Common/src/System/Reflection/TypeNameParser.cs:line 613 at Internal.TypeSystem.Ecma.CustomAttributeTypeProvider.GetTypeFromSerializedName(String) in /_/src/coreclr/tools/Common/TypeSystem/Ecma/CustomAttributeTypeProvider.cs:line 59 at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeArgument(BlobReader&, ArgumentTypeInfo) at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeFixedArguments(BlobReader&, BlobReader&, Int32, BlobReader) at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeValue(EntityHandle, BlobHandle) at Internal.TypeSystem.Ecma.MetadataExtensions.GetDecodedCustomAttributes(EcmaMethod, String, String)+MoveNext() at ILCompiler.DependencyAnalysis.DynamicDependencyAttributesOnEntityNode.GetStaticDependencies(NodeFactory) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DynamicDependencyAttributesOnEntityNode.cs:line 61 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 182 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 222 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 257 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 308 at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs:line 140 at ILCompiler.Program.g__RunScanner|3_0(<>c__DisplayClass3_0&) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 443 at ILCompiler.Program.Run() in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 423 at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass206_0.<.ctor>b__0(InvocationContext) in /_/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs:line 275 /Users/hide/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/build/Microsoft.NETCore.Native.targets(270,5): error MSB3073: コマンド ""/Users/hide/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler.0-preview.4.23259.5/tools/ilc" @"obj/Release/net8.0/osx-arm64/native/hide.ilc.rsp"" はコード 1 で終了しました。ika/hide/hide/hide/hide.fsproj] ``` ### Regression? it's worked in `8.0.100-preview.2.23157.25` ### Known Workarounds none ### Configuration 1. dotnet version 8.0.100-preview.4.23260.5 2. osx13.3.1 m1 and windows11 on arm 3. ARM64 4. maybe ### Other information both windows and Mac are the same situation
Author: luojunyuan
Assignees: -
Labels: `area-NativeAOT-coreclr`
Milestone: -
jkotas commented 1 year ago

Duplicate of https://github.com/dotnet/fsharp/issues/15140