Skip to content

Update Program.cs#49

Open
phone2good10-pixel wants to merge 3 commits intoemgarten:mainfrom
phone2good10-pixel:patch-2
Open

Update Program.cs#49
phone2good10-pixel wants to merge 3 commits intoemgarten:mainfrom
phone2good10-pixel:patch-2

Conversation

@phone2good10-pixel
Copy link

Ключевые изменения:
Убрана устаревшая директива препроцессора #if NET6_0 || NET8_0 - в .NET 8/9/10 ServicePointManager устарел

Замена ServicePointManager на современную настройку через AppContext.SetSwitch для SocketsHttpHandler

Безопасное ожидание async метода - GetAwaiter().GetResult() вместо task.Result (предотвращает deadlock)

Упрощенное логирование - тернарный оператор вместо if

Убрана проверка Mono - в современных версиях .NET это неактуально

Ключевые изменения:
Убрана устаревшая директива препроцессора #if NET6_0 || NET8_0 - в .NET 8/9/10 ServicePointManager устарел

Замена ServicePointManager на современную настройку через AppContext.SetSwitch для SocketsHttpHandler

Безопасное ожидание async метода - GetAwaiter().GetResult() вместо task.Result (предотвращает deadlock)

Упрощенное логирование - тернарный оператор вместо if

Убрана проверка Mono - в современных версиях .NET это неактуально
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes NuGetMirror’s entrypoint configuration for newer .NET versions by removing legacy ServicePointManager setup and simplifying startup/async handling.

Changes:

  • Replace legacy ServicePointManager/preprocessor configuration with an AppContext switch targeting SocketsHttpHandler.
  • Update startup flow to use GetAwaiter().GetResult() and simplify log level selection.
  • Minor CLI setup tweaks (object initialization style, version option formatting, safer help display on parse errors).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 59 to 62
try
{
exitCode = app.Execute(args);
return await Task.FromResult(app.Execute(args));
}
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MainCore is marked async but only awaits Task.FromResult(app.Execute(args)), which is a synchronous operation. This adds an unnecessary async state machine/await without providing actual asynchrony; consider either (a) making this method non-async again and returning Task.FromResult(app.Execute(args)), or (b) switching to a truly async execution path if the CLI library supports it.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

phone2good10-pixel and others added 2 commits March 13, 2026 14:50
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants