From 69b42e07dd32c8006a8e2a16ce5e6c693bd7c47d Mon Sep 17 00:00:00 2001 From: NextTurn <45985406+NextTurn@users.noreply.github.com> Date: Tue, 4 Feb 2020 00:00:00 +0800 Subject: [PATCH 1/3] Remove unused locals in System.ServiceProcess.ServiceController --- .../src/System/ServiceProcess/ServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs index 72f07e971004e..28bb1399fa638 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs +++ b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs @@ -474,7 +474,7 @@ private void DeferredPowerEvent(int eventType, IntPtr eventData) try { PowerBroadcastStatus status = (PowerBroadcastStatus)eventType; - bool statusResult = OnPowerEvent(status); + _ = OnPowerEvent(status); WriteLogEntry(SR.PowerEventOK); } From 4b6303c2d2668bf44242ced25675562fbd7cb7f8 Mon Sep 17 00:00:00 2001 From: NextTurn <45985406+NextTurn@users.noreply.github.com> Date: Tue, 4 Feb 2020 00:00:00 +0800 Subject: [PATCH 2/3] Inline status variable --- .../src/System/ServiceProcess/ServiceBase.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs index 28bb1399fa638..2d078ab2d82d9 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs +++ b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs @@ -473,8 +473,7 @@ private void DeferredPowerEvent(int eventType, IntPtr eventData) // already been freed. try { - PowerBroadcastStatus status = (PowerBroadcastStatus)eventType; - _ = OnPowerEvent(status); + _ = OnPowerEvent((PowerBroadcastStatus)eventType); WriteLogEntry(SR.PowerEventOK); } From 5da65e3384bef5fac892a8de039be304377cfc08 Mon Sep 17 00:00:00 2001 From: Next Turn <45985406+NextTurn@users.noreply.github.com> Date: Tue, 4 Feb 2020 11:23:43 +0800 Subject: [PATCH 3/3] Apply suggestions from code review Co-Authored-By: Stephen Toub --- .../src/System/ServiceProcess/ServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs index 2d078ab2d82d9..72dc9983b6231 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs +++ b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs @@ -473,7 +473,7 @@ private void DeferredPowerEvent(int eventType, IntPtr eventData) // already been freed. try { - _ = OnPowerEvent((PowerBroadcastStatus)eventType); + OnPowerEvent((PowerBroadcastStatus)eventType); WriteLogEntry(SR.PowerEventOK); }