File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ private static void GenerateAnalyzerConfig(IEnumerable<string> cshtmls, string a
55
55
public IEnumerable < string > GenerateFiles ( IEnumerable < string > cshtmls , IEnumerable < string > references , string workingDirectory )
56
56
{
57
57
var name = Guid . NewGuid ( ) . ToString ( "N" ) . ToUpper ( ) ;
58
- var tempPath = FileUtils . GetTemporaryWorkingDirectory ( out var _ ) ;
58
+ var tempPath = FileUtils . GetTemporaryWorkingDirectory ( out var shouldCleanUp ) ;
59
59
var analyzerConfig = Path . Combine ( tempPath , $ "{ name } .txt") ;
60
60
var dllPath = Path . Combine ( tempPath , $ "{ name } .dll") ;
61
61
var cscArgsPath = Path . Combine ( tempPath , $ "{ name } .rsp") ;
@@ -105,21 +105,24 @@ public IEnumerable<string> GenerateFiles(IEnumerable<string> cshtmls, IEnumerabl
105
105
}
106
106
finally
107
107
{
108
- DeleteFile ( analyzerConfig ) ;
109
- DeleteFile ( dllPath ) ;
110
- DeleteFile ( cscArgsPath ) ;
108
+ if ( shouldCleanUp )
109
+ {
110
+ DeleteFile ( analyzerConfig ) ;
111
+ DeleteFile ( dllPath ) ;
112
+ DeleteFile ( cscArgsPath ) ;
113
+ }
111
114
}
112
115
}
113
116
114
- private static void DeleteFile ( string path )
117
+ private void DeleteFile ( string path )
115
118
{
116
119
try
117
120
{
118
121
File . Delete ( path ) ;
119
122
}
120
- catch
123
+ catch ( Exception exc )
121
124
{
122
- // Ignore
125
+ logger . LogWarning ( $ "Failed to delete file { path } : { exc } " ) ;
123
126
}
124
127
}
125
128
}
You can’t perform that action at this time.
0 commit comments