dotnet / runtime

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

[NativeAOT][Publish Error]One or more errors occurred. #74477

Closed submaie closed 2 years ago

submaie commented 2 years ago

Description

I used the Avalonia UI library as the program interface, and the project references are as follows:

Avalonia.Desktop v 0.10.18 --> Program interface Avalonia.AvaloniaEdit v 0.10.12.2 --> RichTextBox Microsoft.Data.Sqlite v 6.0.8 --> Read & write database NPOI v 2.5.6 --> Write and generating .docx System.Data.OleDb v6.0.0 --> Read .xlsx file

Reproduction Steps

1 Download and install the AvaloniaVS.VS2022.vsix file. 2 Download the Avalonia NuGet package. 3 Create new Avalonia Application project 4 Add System.Data.OleDb.dll, NPOI, Avalonia.AvaloniaEdit.dll, Avalonia.AvaloniaEdit.dll from NuGet. 5 Type the code, read the data from the excel. Xlsx file and save it to SQLite data, and then write it to the. Docx file by reading the contents of the database. Obviously, the SQLite database is a buffer. 6 Both debug compilation and release compilation were successful. The program runs normally. 7 Follow the tutorial https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/compiling.md enable NativeAOT 8 Publish Error.

Expected behavior

Publish successful.

Actual behavior

Error Msg: 2022/8/24 10:43:17 System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: 发布时遇到错误。我们无法确定错误的原因。有关详细信息,请查看输出日志。 --- End of inner exception stack trace --- ---> (内部异常 #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: 发布时遇到错误。我们无法确定错误的原因。有关详细信息,请查看输出日志。<---

Microsoft.WebTools.Shared.Exceptions.WebToolsException: 发布时遇到错误。我们无法确定错误的原因。有关详细信息,请查看输出日志。

=================== One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2<TResult,TProgress><System.Canon,int32>..cctor()') 1>System.AggregateException: One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2<TResult,TProgress><System.Canon,int32>..cctor()') 1> ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2<TResult,TProgress><System.Canon,int32>..cctor()' 1> ---> System.InvalidOperationException: [Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2<TResult,TProgress><System.Canon,int32>: TypeHandle: [Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2<TResult,TProgress><!0_System.Canon,int32> 1> at ILCompiler.DependencyAnalysis.PrecomputedDictionaryLayoutNode.GetSlotForEntry(GenericLookupResult entry) in //src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DictionaryLayoutNode.cs:line 230 1> at ILCompiler.Compilation.ComputeGenericLookup(MethodDesc contextMethod, ReadyToRunHelperId lookupKind, Object targetOfLookup) in //src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 398 1> at Internal.JitInterface.CorInfoImpl.ComputeLookup(CORINFO_RESOLVED_TOKEN& pResolvedToken, Object entity, ReadyToRunHelperId helperId, CORINFOLOOKUP& lookup) in //src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 257 1> at Internal.JitInterface.CorInfoImpl.embedGenericHandle(CORINFO_RESOLVED_TOKEN& pResolvedToken, Boolean fEmbedParent, CORINFO_GENERICHANDLERESULT& pResult) in //src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 1746 1> at Internal.JitInterface.CorInfoImpl._embedGenericHandle(IntPtr thisHandle, IntPtr ppException, CORINFO_RESOLVED_TOKEN pResolvedToken, Byte fEmbedParent, CORINFO_GENERICHANDLERESULT* pResult) in //src/coreclr/tools/Common/JitInterface/CorInfoBase.cs:line 1987 1> --- End of inner exception stack trace --- 1> at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL) in //src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs:line 379 1> at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL) in //src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 63 1> at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 190 1> at ILCompiler.RyuJitCompilation.CompileSingleMethod(MethodCodeNode methodCodeNodeNeedingCode) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 175 1> at System.Threading.Tasks.Parallel.<>c__DisplayClass19_01.b1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) 1>--- End of stack trace from previous location --- 1> at System.Threading.Tasks.Parallel.<>c__DisplayClass19_01.b_1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) 1> at System.Threading.Tasks.TaskReplicator.Replica.Execute() 1> --- End of inner exception stack trace --- 1> at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction1 action, ParallelOptions options, Boolean stopOnFirstFailure) 1> at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) 1>--- End of stack trace from previous location --- 1> at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) 1> at ILCompiler.RyuJitCompilation.CompileMultiThreaded(List1 methodsToCompile) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 150 1> at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List1 obj) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 140 1> at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in //src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 315 1> at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 88 1> at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in //src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 526 1> at ILCompiler.Program.Run(String[] args) in //src/coreclr/tools/aot/ILCompiler/Program.cs:line 910 1> at ILCompiler.Program.Main(String[] args) in //src/coreclr/tools/aot/ILCompiler/Program.cs:line 1102 1>命令“"C:\Users\username.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\7.0.0-preview.7.22375.6\tools\ilc" @"obj\x64\Release\net6.0-windows10.0.19041.0\win-x64\native\xReportGenerator.ilc.rsp"”已退出,代码为 1。 ========== “生成”: 0 成功,0 失败,1 更新,0 已跳过 ========== ========== “发布”: 0 成功,1 失败,0已跳过 ==========

Regression?

No response

Known Workarounds

No response

Configuration

Building Host Operation System: Windows 11 Pro v 25182.1010 .Net Version: .Net Core 6.0.8 VS: Microsoft Visual Studio Professional 2022 v17.3.1 TargetFramework : net6.0-windows10.0.19041.0 TrimMode: copyused Target runtime: win-x64

Package r:eference : Avalonia.Desktop v 0.10.18 Package r:eference : Avalonia.AvaloniaEdit v 0.10.12.2 Package r:eference : Microsoft.Data.Sqlite v 6.0.8 Package r:eference : NPOI v 2.5.6 Package r:eference : System.Data.OleDb v6.0.0

Other information

No response

ghost commented 2 years ago

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

Issue Details
### Description I used the Avalonia UI library as the program interface, and the project references are as follows: Avalonia.Desktop v 0.10.18 --> Program interface Avalonia.AvaloniaEdit v 0.10.12.2 --> RichTextBox Microsoft.Data.Sqlite v 6.0.8 --> Read & write database NPOI v 2.5.6 --> Write and generating .docx System.Data.OleDb v6.0.0 --> Read .xlsx file ### Reproduction Steps 1 Download and install the AvaloniaVS.VS2022.vsix file. 2 Download the Avalonia NuGet package. 3 Create new Avalonia Application project 4 Add System.Data.OleDb.dll, NPOI, Avalonia.AvaloniaEdit.dll, Avalonia.AvaloniaEdit.dll from NuGet. 5 Type the code, read the data from the excel. Xlsx file and save it to SQLite data, and then write it to the. Docx file by reading the contents of the database. Obviously, the SQLite database is a buffer. 6 Both debug compilation and release compilation were successful. The program runs normally. 7 Follow the tutorial [https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/compiling.md](url) enable NativeAOT 8 Publish Error. ### Expected behavior Publish successful. ### Actual behavior Error Msg: 2022/8/24 10:43:17 System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: 发布时遇到错误。我们无法确定错误的原因。有关详细信息,请查看输出日志。 --- End of inner exception stack trace --- ---> (内部异常 #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: 发布时遇到错误。我们无法确定错误的原因。有关详细信息,请查看输出日志。<--- Microsoft.WebTools.Shared.Exceptions.WebToolsException: 发布时遇到错误。我们无法确定错误的原因。有关详细信息,请查看输出日志。 =================== One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2..cctor()') 1>System.AggregateException: One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2..cctor()') 1> ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2..cctor()' 1> ---> System.InvalidOperationException: [Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2: TypeHandle: [Microsoft.Windows.SDK.NET]+Windows.Foundation.AsyncOperationWithProgressCompletedHandler2 1> at ILCompiler.DependencyAnalysis.PrecomputedDictionaryLayoutNode.GetSlotForEntry(GenericLookupResult entry) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DictionaryLayoutNode.cs:line 230 1> at ILCompiler.Compilation.ComputeGenericLookup(MethodDesc contextMethod, ReadyToRunHelperId lookupKind, Object targetOfLookup) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 398 1> at Internal.JitInterface.CorInfoImpl.ComputeLookup(CORINFO_RESOLVED_TOKEN& pResolvedToken, Object entity, ReadyToRunHelperId helperId, CORINFO_LOOKUP& lookup) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 257 1> at Internal.JitInterface.CorInfoImpl.embedGenericHandle(CORINFO_RESOLVED_TOKEN& pResolvedToken, Boolean fEmbedParent, CORINFO_GENERICHANDLE_RESULT& pResult) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 1746 1> at Internal.JitInterface.CorInfoImpl._embedGenericHandle(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken, Byte fEmbedParent, CORINFO_GENERICHANDLE_RESULT* pResult) in /_/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs:line 1987 1> --- End of inner exception stack trace --- 1> at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL) in /_/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs:line 379 1> at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 63 1> at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 190 1> at ILCompiler.RyuJitCompilation.CompileSingleMethod(MethodCodeNode methodCodeNodeNeedingCode) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 175 1> at System.Threading.Tasks.Parallel.<>c__DisplayClass19_01.b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) 1>--- End of stack trace from previous location --- 1> at System.Threading.Tasks.Parallel.<>c__DisplayClass19_01.b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) 1> at System.Threading.Tasks.TaskReplicator.Replica.Execute() 1> --- End of inner exception stack trace --- 1> at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction1 action, ParallelOptions options, Boolean stopOnFirstFailure) 1> at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) 1>--- End of stack trace from previous location --- 1> at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) 1> at ILCompiler.RyuJitCompilation.CompileMultiThreaded(List1 methodsToCompile) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 150 1> at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List1 obj) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 140 1> at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in //src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 315 1> at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 88 1> at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in //src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 526 1> at ILCompiler.Program.Run(String[] args) in //src/coreclr/tools/aot/ILCompiler/Program.cs:line 910 1> at ILCompiler.Program.Main(String[] args) in //src/coreclr/tools/aot/ILCompiler/Program.cs:line 1102 1>命令“"C:\Users\username.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\7.0.0-preview.7.22375.6\tools\ilc" @"obj\x64\Release\net6.0-windows10.0.19041.0\win-x64\native\xReportGenerator.ilc.rsp"”已退出,代码为 1。 ========== “生成”: 0 成功,0 失败,1 更新,0 已跳过 ========== ========== “发布”: 0 成功,1 失败,0已跳过 ========== ### Regression? _No response_ ### Known Workarounds _No response_ ### Configuration Building Host Operation System: Windows 11 Pro v 25182.1010 .Net Version: .Net Core 6.0.8 VS: Microsoft Visual Studio Professional 2022 v17.3.1 TargetFramework : net6.0-windows10.0.19041.0 TrimMode: copyused Target runtime: win-x64 Package r:eference : Avalonia.Desktop v 0.10.18 Package r:eference : Avalonia.AvaloniaEdit v 0.10.12.2 Package r:eference : Microsoft.Data.Sqlite v 6.0.8 Package r:eference : NPOI v 2.5.6 Package r:eference : System.Data.OleDb v6.0.0 ### Other information _No response_
Author: submaie
Assignees: -
Labels: `area-CodeGen-coreclr`
Milestone: -
MichalStrehovsky commented 2 years ago

This is a duplicate of #68278. CsWinRT doesn't currently work with NativeAOT. Even if we were to compile this, it wouldn't work at runtime because it relies on reflection.emit. There is work in progress to make it compatible.