@@ -30,29 +30,46 @@ private static void AnalyseStandalone(
3030 IProgressMonitor progressMonitor ,
3131 Stopwatch stopwatch )
3232 {
33- CSharp . Extractor . Analyse ( stopwatch , analyser , options ,
34- references => GetResolvedReferencesStandalone ( referencePaths , references ) ,
35- ( analyser , syntaxTrees ) => CSharp . Extractor . ReadSyntaxTrees ( sources , analyser , null , null , syntaxTrees ) ,
36- ( syntaxTrees , references ) => CSharpCompilation . Create (
37- "csharp.dll" , syntaxTrees , references , new CSharpCompilationOptions ( OutputKind . ConsoleApplication , allowUnsafe : true )
38- ) ,
39- ( compilation , options ) => analyser . Initialize ( compilation , options ) ,
40- ( ) => { } ,
41- _ => { } ,
42- ( ) =>
43- {
44- foreach ( var type in analyser . MissingNamespaces )
45- {
46- progressMonitor . MissingNamespace ( type ) ;
47- }
33+ var output = FileUtils . CreateTemporaryFile ( ".dll" , out var shouldCleanUpContainingFolder ) ;
4834
49- foreach ( var type in analyser . MissingTypes )
35+ try
36+ {
37+ CSharp . Extractor . Analyse ( stopwatch , analyser , options ,
38+ references => GetResolvedReferencesStandalone ( referencePaths , references ) ,
39+ ( analyser , syntaxTrees ) => CSharp . Extractor . ReadSyntaxTrees ( sources , analyser , null , null , syntaxTrees ) ,
40+ ( syntaxTrees , references ) => CSharpCompilation . Create (
41+ output . Name , syntaxTrees , references , new CSharpCompilationOptions ( OutputKind . ConsoleApplication , allowUnsafe : true )
42+ ) ,
43+ ( compilation , options ) => analyser . Initialize ( output . FullName , compilation , options ) ,
44+ _ => { } ,
45+ ( ) =>
5046 {
51- progressMonitor . MissingType ( type ) ;
47+ foreach ( var type in analyser . MissingNamespaces )
48+ {
49+ progressMonitor . MissingNamespace ( type ) ;
50+ }
51+
52+ foreach ( var type in analyser . MissingTypes )
53+ {
54+ progressMonitor . MissingType ( type ) ;
55+ }
56+
57+ progressMonitor . MissingSummary ( analyser . MissingTypes . Count ( ) , analyser . MissingNamespaces . Count ( ) ) ;
58+ } ) ;
59+ }
60+ finally
61+ {
62+ try
63+ {
64+ FileUtils . TryDelete ( output . FullName ) ;
65+ if ( shouldCleanUpContainingFolder )
66+ {
67+ output . Directory ? . Delete ( true ) ;
5268 }
53-
54- progressMonitor . MissingSummary ( analyser . MissingTypes . Count ( ) , analyser . MissingNamespaces . Count ( ) ) ;
55- } ) ;
69+ }
70+ catch
71+ { }
72+ }
5673 }
5774
5875 private static void ExtractStandalone (
0 commit comments