dotnet / dotnet/sdk

"dotnet run --no-restore --no-build --no-launch-profile" significantly slower than "dotnet exec <path-to-dll>"

Open
#51,460 5 comments 0 reactions 0 assignees View on GitHub
Area-CLI Area-Performance Area-Run untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
After building a fairly large dll, this command (run from the project directory):

> dotnet run --no-restore --no-build --no-launch-profile

takes 8 seconds longer than running this command:

> dotnet exec

I understand that dotnet run may add some overhead but 8 seconds seems like way too much. This does not happen with a fresh project so it seems that something specific to my project or environment is causing the issue. I've added logging to ensure that the program has the same PWD and the same number of managed assemblies are loaded. I've taken hostlog traces and can confirm that the overhead is coming before my app is invoked.

### Further technical details
See the attached hostlog traces and timestamps within. "run.hostlog.txt" is the one from "dotnet run" that has the additional overhead.

[run.hostlog.txt](https://github.com/user-attachments/files/23167973/run.hostlog.txt)
[exec.hostlog.txt](https://github.com/user-attachments/files/23167974/exec.hostlog.txt)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.