File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
src/Cli/dotnet/commands/dotnet-test Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -97,38 +97,38 @@ public int Run(ParseResult parseResult)
9797 if ( msbuildResult != 0 )
9898 {
9999 VSTestTrace . SafeWriteTrace ( ( ) => $ "MSBuild task _GetTestsProject didn't execute properly with exit code: { msbuildResult } .") ;
100- CleanUp ( ) ;
101100 return ExitCodes . GenericFailure ;
102101 }
103102
104103 // If not all test projects have IsTestingPlatformApplication set to true, we will simply return
105104 if ( ! _msBuildConnectionHandler . EnqueueTestApplications ( ) )
106105 {
107106 VSTestTrace . SafeWriteTrace ( ( ) => LocalizableStrings . CmdUnsupportedVSTestTestApplicationsDescription ) ;
108- CleanUp ( ) ;
109107 return ExitCodes . GenericFailure ;
110108 }
111109 }
112110
113111 _actionQueue . EnqueueCompleted ( ) ;
114112 hasFailed = _actionQueue . WaitAllActions ( ) ;
115-
116113 // Above line will block till we have all connections and all GetTestsProject msbuild task complete.
117- _cancellationToken . Cancel ( ) ;
118- _namedPipeConnectionLoop . Wait ( ) ;
119114
120- // Clean up everything
121- CleanUp ( ) ;
115+ WaitOnMSBuildHandlerPipeConnectionLoop ( ) ;
122116 }
123- catch ( Exception )
117+ finally
124118 {
119+ // Clean up everything
125120 CleanUp ( ) ;
126- throw ;
127121 }
128122
129123 return hasFailed ? ExitCodes . GenericFailure : ExitCodes . Success ;
130124 }
131125
126+ private void WaitOnMSBuildHandlerPipeConnectionLoop ( )
127+ {
128+ _cancellationToken . Cancel ( ) ;
129+ _namedPipeConnectionLoop . Wait ( ( int ) TimeSpan . FromSeconds ( 30 ) . TotalMilliseconds ) ;
130+ }
131+
132132 private void CleanUp ( )
133133 {
134134 _msBuildConnectionHandler . Dispose ( ) ;
You can’t perform that action at this time.
0 commit comments