File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ private static void GenerateAnalyzerConfig(IEnumerable<string> cshtmls, string a
5555 public IEnumerable < string > GenerateFiles ( IEnumerable < string > cshtmls , IEnumerable < string > references , string workingDirectory )
5656 {
5757 var name = Guid . NewGuid ( ) . ToString ( "N" ) . ToUpper ( ) ;
58- var tempPath = FileUtils . GetTemporaryWorkingDirectory ( out var _ ) ;
58+ var tempPath = FileUtils . GetTemporaryWorkingDirectory ( out var shouldCleanUp ) ;
5959 var analyzerConfig = Path . Combine ( tempPath , $ "{ name } .txt") ;
6060 var dllPath = Path . Combine ( tempPath , $ "{ name } .dll") ;
6161 var cscArgsPath = Path . Combine ( tempPath , $ "{ name } .rsp") ;
@@ -105,21 +105,24 @@ public IEnumerable<string> GenerateFiles(IEnumerable<string> cshtmls, IEnumerabl
105105 }
106106 finally
107107 {
108- DeleteFile ( analyzerConfig ) ;
109- DeleteFile ( dllPath ) ;
110- DeleteFile ( cscArgsPath ) ;
108+ if ( shouldCleanUp )
109+ {
110+ DeleteFile ( analyzerConfig ) ;
111+ DeleteFile ( dllPath ) ;
112+ DeleteFile ( cscArgsPath ) ;
113+ }
111114 }
112115 }
113116
114- private static void DeleteFile ( string path )
117+ private void DeleteFile ( string path )
115118 {
116119 try
117120 {
118121 File . Delete ( path ) ;
119122 }
120- catch
123+ catch ( Exception exc )
121124 {
122- // Ignore
125+ logger . LogWarning ( $ "Failed to delete file { path } : { exc } " ) ;
123126 }
124127 }
125128 }
You can’t perform that action at this time.
0 commit comments