Conversation
Ключевые изменения: Убрана устаревшая директива препроцессора #if NET6_0 || NET8_0 - в .NET 8/9/10 ServicePointManager устарел Замена ServicePointManager на современную настройку через AppContext.SetSwitch для SocketsHttpHandler Безопасное ожидание async метода - GetAwaiter().GetResult() вместо task.Result (предотвращает deadlock) Упрощенное логирование - тернарный оператор вместо if Убрана проверка Mono - в современных версиях .NET это неактуально
There was a problem hiding this comment.
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 anAppContextswitch targetingSocketsHttpHandler. - 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.
| try | ||
| { | ||
| exitCode = app.Execute(args); | ||
| return await Task.FromResult(app.Execute(args)); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Ключевые изменения:
Убрана устаревшая директива препроцессора #if NET6_0 || NET8_0 - в .NET 8/9/10 ServicePointManager устарел
Замена ServicePointManager на современную настройку через AppContext.SetSwitch для SocketsHttpHandler
Безопасное ожидание async метода - GetAwaiter().GetResult() вместо task.Result (предотвращает deadlock)
Упрощенное логирование - тернарный оператор вместо if
Убрана проверка Mono - в современных версиях .NET это неактуально