@@ -240,46 +240,37 @@ public async Task StartAsync()
240240        { 
241241            if  ( this . driverServiceProcess  ==  null ) 
242242            { 
243-                 lock  ( this . driverServiceProcessLock ) 
244-                 { 
243+                 this . driverServiceProcess  =  new  Process ( ) ; 
245244
246-                     if  ( this . driverServiceProcess  ==  null ) 
245+                 try 
246+                 { 
247+                     if  ( this . DriverServicePath  !=  null ) 
247248                    { 
248-                         var  driverServiceProcess  =  new  Process ( ) ; 
249- 
250-                         try 
249+                         if  ( this . DriverServiceExecutableName  is  null ) 
251250                        { 
252-                             if  ( this . DriverServicePath  !=  null ) 
253-                             { 
254-                                 if  ( this . DriverServiceExecutableName  is  null ) 
255-                                 { 
256-                                     throw  new  InvalidOperationException ( "If the driver service path is specified, the driver service executable name must be as well" ) ; 
257-                                 } 
258- 
259-                                 driverServiceProcess . StartInfo . FileName  =  Path . Combine ( this . DriverServicePath ,  this . DriverServiceExecutableName ) ; 
260-                             } 
261-                             else 
262-                             { 
263-                                 driverServiceProcess . StartInfo . FileName  =  new  DriverFinder ( this . GetDefaultDriverOptions ( ) ) . GetDriverPath ( ) ; 
264-                             } 
251+                             throw  new  InvalidOperationException ( "If the driver service path is specified, the driver service executable name must be as well" ) ; 
252+                         } 
265253
266-                             driverServiceProcess . StartInfo . Arguments  =  this . CommandLineArguments ; 
267-                             driverServiceProcess . StartInfo . UseShellExecute  =  false ; 
268-                             driverServiceProcess . StartInfo . CreateNoWindow  =  this . HideCommandPromptWindow ; 
254+                         this . driverServiceProcess . StartInfo . FileName  =  Path . Combine ( this . DriverServicePath ,  this . DriverServiceExecutableName ) ; 
255+                     } 
256+                     else 
257+                     { 
258+                         this . driverServiceProcess . StartInfo . FileName  =  new  DriverFinder ( this . GetDefaultDriverOptions ( ) ) . GetDriverPath ( ) ; 
259+                     } 
269260
270-                             DriverProcessStartingEventArgs  eventArgs  =  new  DriverProcessStartingEventArgs ( driverServiceProcess . StartInfo ) ; 
271-                             this . OnDriverProcessStarting ( eventArgs ) ; 
261+                     this . driverServiceProcess . StartInfo . Arguments  =  this . CommandLineArguments ; 
262+                     this . driverServiceProcess . StartInfo . UseShellExecute  =  false ; 
263+                     this . driverServiceProcess . StartInfo . CreateNoWindow  =  this . HideCommandPromptWindow ; 
272264
273-                             driverServiceProcess . Start ( ) ; 
274-                         } 
275-                         catch 
276-                         { 
277-                             driverServiceProcess . Dispose ( ) ; 
278-                             throw ; 
279-                         } 
265+                     DriverProcessStartingEventArgs  eventArgs  =  new  DriverProcessStartingEventArgs ( this . driverServiceProcess . StartInfo ) ; 
266+                     this . OnDriverProcessStarting ( eventArgs ) ; 
280267
281-                         this . driverServiceProcess  =  driverServiceProcess ; 
282-                     } 
268+                     this . driverServiceProcess . Start ( ) ; 
269+                 } 
270+                 catch 
271+                 { 
272+                     this . driverServiceProcess . Dispose ( ) ; 
273+                     throw ; 
283274                } 
284275            } 
285276
0 commit comments