Add service name to TimeoutException message (#33927)
authorFrancesco Saltori <francescosaltori@gmail.com>
Mon, 23 Mar 2020 01:06:39 +0000 (02:06 +0100)
committerGitHub <noreply@github.com>
Mon, 23 Mar 2020 01:06:39 +0000 (21:06 -0400)
src/libraries/System.ServiceProcess.ServiceController/src/Resources/Strings.resx
src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs

index 6028274..aa322b1 100644 (file)
@@ -91,7 +91,7 @@
     <value>Cannot stop '{0}' service on computer '{1}'.</value>
   </data>
   <data name="Timeout" xml:space="preserve">
-    <value>Time out has expired and the operation has not been completed.</value>
+    <value>The operation requested for service '{0}' has not been completed within the specified time interval.</value>
   </data>
   <data name="PlatformNotSupported_ServiceController" xml:space="preserve">
     <value>ServiceController enables manipulating and accessing Windows services and it is not applicable for other operating systems.</value>
index e635a9c..8096fc4 100644 (file)
@@ -900,7 +900,7 @@ namespace System.ServiceProcess
             while (Status != desiredStatus)
             {
                 if (DateTime.UtcNow - start > timeout)
-                    throw new System.ServiceProcess.TimeoutException(SR.Timeout);
+                    throw new System.ServiceProcess.TimeoutException(SR.Format(SR.Timeout, ServiceName));
 
                 _waitForStatusSignal.WaitOne(250);
                 Refresh();