Closed smhmhmd closed 2 years ago
NativeAOT supported application for .NET 6.0 and up. .NET core 3.1 is not supported. See this https://github.com/dotnet/runtimelab/issues/1241#issuecomment-1026571480
The latest nightly packages have an explicit block for compiling applications that are targeting earlier net versions. You should see an error message like this:
C:\Users\jkotas\.nuget\packages\microsoft.dotnet.ilcompiler\7.0.0-preview.4.22201.3\build\Microsoft.NETCore.Native.Publ ish.targets(52,5): error : For native compilation, the project needs to target .NET 6 or higher. [C:\repro\repro.csproj ]
Building a 'hello world' program with .NET 3.1 for NativeAOT hang
It is not a hang. The problem is that the compilation is trying to compile all code in .NET runtime, without trimming anything - that is a lot.
we would like to understand the root cause
There are number of known issues with trimming when the application targets earlier net versions. We do not plan to fix them.
how we can instrument ilc to show more about what could be causing this.
You can pass --verbose
flag to the compiler. It will show you what the compiler is compiling.
Description
Building a 'hello world' program with .NET 3.1 for NativeAOT hangs, the ilc process also consumes a lot of memory. .NET 3.1 will be EOL'ed in December, but, we would like to understand the root cause and also how we can instrument ilc to show more about what could be causing this. Thanks to @beau-gosse-dev for reproducing it.
Reproduction Steps
Expected behavior
'Hello World!' is printed
Actual behavior
Compilation hangs
Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response