Skip to content

Conversation

Copy link

Copilot AI commented Jan 6, 2026

LinuxStrategy used Execute() with Task.Run() wrapper while WindowsStrategy implemented ExecuteAsync() directly, creating inconsistent async patterns across platform strategies.

Changes

  • LinuxStrategy.cs: Replace Execute() + Task.Run() with native ExecuteAsync() implementation

    • Remove fire-and-forget Task.Run() wrapper
    • Update error messages to reference correct class name (was incorrectly referencing WindowsStrategy)
  • GeneralUpdateBootstrap.cs: Fix compilation error from previous commit

    • Store GetOption(UpdateOption.DownloadTimeOut) result to avoid duplicate calls
    • Use ternary operator for zero check (value types return 0 as default, not null)

Both platform strategies now follow identical async patterns:

// Before
public override void Execute()
{
    Task.Run(async () => { /* async work */ });
}

// After  
public override async Task ExecuteAsync()
{
    /* async work */
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 6, 2026 16:34
…Strategy

Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
…alls

Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix adaptation to .NET 10 new features based on feedback Align LinuxStrategy async pattern with WindowsStrategy Jan 6, 2026
Copilot AI requested a review from JusterZhu January 6, 2026 16:38
@JusterZhu JusterZhu marked this pull request as ready for review January 6, 2026 17:01
Copilot AI review requested due to automatic review settings January 6, 2026 17:01
@JusterZhu JusterZhu merged commit da6be94 into script Jan 6, 2026
2 checks passed
Copy link
Contributor

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 aligns the async implementation patterns between platform strategies and fixes a compilation error in the bootstrap configuration. The LinuxStrategy previously used a fire-and-forget Task.Run() pattern while WindowsStrategy properly implemented ExecuteAsync(), creating inconsistent behavior where LinuxStrategy's Execute() would return immediately without waiting for async operations to complete.

Key Changes

  • Refactored LinuxStrategy from fire-and-forget Execute() + Task.Run() to proper async Task ExecuteAsync() implementation
  • Corrected error message references from "WindowsStrategy" to "LinuxStrategy" in error logging
  • Fixed compilation error in GeneralUpdateBootstrap by properly handling value-type default (0) instead of using null coalescing operator for timeout configuration

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/c#/GeneralUpdate.Core/Strategys/LinuxStrategy.cs Refactored to use native async/await pattern, removed fire-and-forget wrapper, and corrected class name references in error messages
src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs Fixed timeout option handling to check for default value (0) instead of null, as GetOption returns non-nullable int

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

@JusterZhu JusterZhu deleted the copilot/sub-pr-95 branch January 7, 2026 02:34
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