File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -86,10 +86,25 @@ private static JsonElement ParseSwaggerDocument(string content)
8686
8787 private static async Task WriteToDiskAsync ( string path , JsonElement jsonElement )
8888 {
89- string directory = Path . GetDirectoryName ( path ) ! ;
90- Directory . CreateDirectory ( directory ) ;
91-
92- string contents = jsonElement . ToString ( ) ;
93- await File . WriteAllTextAsync ( path , contents ) ;
89+ while ( true )
90+ {
91+ try
92+ {
93+ string directory = Path . GetDirectoryName ( path ) ! ;
94+ Directory . CreateDirectory ( directory ) ;
95+
96+ string contents = jsonElement . ToString ( ) ;
97+ await File . WriteAllTextAsync ( path , contents ) ;
98+
99+ return ;
100+ }
101+ catch ( IOException )
102+ {
103+ // This sometimes happens when running tests locally.
104+ // Multi-targeted projects should not use the same output path.
105+
106+ await Task . Delay ( TimeSpan . FromMilliseconds ( 50 ) ) ;
107+ }
108+ }
94109 }
95110}
You can’t perform that action at this time.
0 commit comments