Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[.NET Tutorial]: dot net 8 web api aot compilation error #8649

Closed
jdurnil opened this issue Jul 27, 2023 · 4 comments
Closed

[.NET Tutorial]: dot net 8 web api aot compilation error #8649

jdurnil opened this issue Jul 27, 2023 · 4 comments
Assignees
Labels
area-runtime Issue related to the .NET Core CLR. area-tutorials Issues related to getting started tutorials
Milestone

Comments

@jdurnil
Copy link

jdurnil commented Jul 27, 2023

URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/aot/native-aot-tutorial?view=aspnetcore-8.0&tabs=netcore-cli

Operating system

windows 10

More information about your system

x64, visual studio 2022 preview with .net 8 preview 6 installed and .net 8 sdk latest preview. Visual Studio 2022 installed with asp.net and c++ options

Description

I am trying to just publish the base code when creating a project using
dotnet new api --aot -o MyFirstAotWebApi && cd MyFirstAotWebApi

the program runs fine in debug mode
then I just do a
dotnet publish
and get this error
MyFirstAotWebApi -> C:\Program Files\no\MyFirstAotWebApi\bin\Release\net8.0\win-x64\MyFirstAotWebApi.dll
Generating native code
C:\Users\M31926.nuget\packages\microsoft.dotnet.ilcompiler\8.0.0-preview.6.23329.7\build\Microsoft.NETCore.Native
.targets(290,5): error MSB3073: The command ""C:\Users\M31926.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\8.0.0-preview.6.23329.7\tools\ilc" @"obj\Release\net8.0\win-x64\native\MyFirstAotWebApi.ilc.rsp"" exited
with code -2147483645. [C:\Program Files\no\MyFirstAotWebApi\MyFirstAotWebApi.csproj]

dotnet --info

.NET SDK:
Version: 8.0.100-preview.6.23330.14
Commit: ba97796b8f

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100-preview.6.23330.14\

.NET workloads installed:
There are no installed workloads to display.

Host:
Version: 8.0.0-preview.6.23329.7
Architecture: x64
Commit: 5340be2ccc

.NET SDKs installed:
7.0.306 [C:\Program Files\dotnet\sdk]
7.0.400-preview.23330.10 [C:\Program Files\dotnet\sdk]
8.0.100-preview.6.23330.14 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-preview.6.23329.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-preview.6.23329.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0-preview.6.23329.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

@jdurnil jdurnil added the area-tutorials Issues related to getting started tutorials label Jul 27, 2023
@LakshanF LakshanF self-assigned this Jul 31, 2023
@LakshanF LakshanF added this to the .NET 8.0 milestone Jul 31, 2023
@LakshanF LakshanF added the area-runtime Issue related to the .NET Core CLR. label Jul 31, 2023
@LakshanF
Copy link
Member

LakshanF commented Jul 31, 2023

@jdurnil, this is a known issue that we are working towards fixing. NativeAOT applications build prior to this PR is susceptible to crashes when a client turns on machine wide tracing while using an impacted NativeAOT application. Unfortunately, ILC, the ILCompiler tool, is a NativeAOT application that shows this problem. We are working towards updating ilc.

A common pattern for this issue: If you are debugging VS on a separate process (breakpoint on a HelloWorld for example) in the same machine, and then uses an impacted NativeAOT application (ILC gets used when you invoke dotnet publish). VS in this scenario, will send a request to the affected NativeAOT to turn on tracing, which will cause the problem you see in ILC.

A workaround for that scenario would be to stop debugging VS until the application is published.

Sorry for the inconvenience that this problem caused you.

@jdurnil
Copy link
Author

jdurnil commented Aug 1, 2023

hello i was not debugging the app during publish i was getting this message with the app completely stopped. What fixed this issue was to do a dotnet restore on the sample project then it built.

@LakshanF
Copy link
Member

LakshanF commented Aug 1, 2023

Glad that you got unblocked! Let me know if you run into the issue again, and the state of the other programs in the machine. The issue I mentioned above where it impacts ILC can happen when a machine wide tracing is enabled (ETW is turned on machine-wide for example).

@jkotas
Copy link
Member

jkotas commented Feb 13, 2024

This is fixed in .NET 8 release. Thank you for reporting it!

@jkotas jkotas closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-runtime Issue related to the .NET Core CLR. area-tutorials Issues related to getting started tutorials
Projects
Archived in project
Development

No branches or pull requests

3 participants