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

[release/7.0-staging] Make WindowsServiceLifetime gracefully stop #85656

Merged

Commits on May 2, 2023

  1. Make WindowsServiceLifetime gracefully stop (dotnet#83892)

    * Make WindowsServiceLifetime gracefully stop
    
    WindowsServiceLifetime was not waiting for ServiceBase to stop the service.  As a result
    we would sometimes end the process before notifying service control manager that the service
    had stopped -- resulting in an error in the eventlog and sometimes a service restart.
    
    We also were permitting multiple calls to Stop to occur - through SCM callbacks, and through
    public API.  We must not call SetServiceStatus again once the service is marked as stopped.
    
    * Alternate approach to ensuring we only ever set STATE_STOPPED once.
    
    * Avoid calling ServiceBase.Stop on stopped service
    
    I fixed double-calling STATE_STOPPED in ServiceBase, but this fix will
    not be present on .NETFramework.  Workaround that by avoiding calling
    ServiceBase.Stop when the service has already been stopped by SCM.
    
    * Add tests for WindowsServiceLifetime
    
    These tests leverage RemoteExecutor to avoid creating a separate service
    assembly.
    
    * Respond to feedback and add more tests.
    
    This better integrates with the RemoteExecutor component as well,
    by hooking up the service process and fetching its handle.
    
    This gives us the correct logging and exitcode handling from
    RemoteExecutor.
    
    * Honor Cancellation in StopAsync
    
    * Fix bindingRedirects in RemoteExecutor
    
    * Use Async lambdas for service testing
    
    * Fix issue on Win7 where duplicate service descriptions are disallowed
    
    * Respond to feedback
    
    * Fix comment and add timeout
    ericstj committed May 2, 2023
    Configuration menu
    Copy the full SHA
    701f7cc View commit details
    Browse the repository at this point in the history
  2. Fix test condition

    ericstj committed May 2, 2023
    Configuration menu
    Copy the full SHA
    f05ef3e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d7babd0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ba9608b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6254c6c View commit details
    Browse the repository at this point in the history
  6. Enable MS.W.C for servicing

    ericstj committed May 2, 2023
    Configuration menu
    Copy the full SHA
    7dd0c7e View commit details
    Browse the repository at this point in the history
  7. Reference latest Microsoft.Extensions.Logging.Abstractions

    This package has been serviced and we compile against the serviced
    version of its assemblies.
    
    None of the directly referenced projects have been serviced so our
    package doesn't restore the serviced versions.
    
    Lift up the dependency on Logging.Abstractions to ensure we reference
    the serviced package.
    ericstj committed May 2, 2023
    Configuration menu
    Copy the full SHA
    5f989c5 View commit details
    Browse the repository at this point in the history