diff --git a/package-versions.props b/package-versions.props index bb86f2d6fc..dea972acbb 100644 --- a/package-versions.props +++ b/package-versions.props @@ -28,7 +28,7 @@ 2.9.* 9.*-* 9.0.* - 17.14.* + 18.0.* 2.9.* 3.1.* diff --git a/test/OpenApiTests/OpenApiTestContext.cs b/test/OpenApiTests/OpenApiTestContext.cs index 5151e9a73a..16b7f26628 100644 --- a/test/OpenApiTests/OpenApiTestContext.cs +++ b/test/OpenApiTests/OpenApiTestContext.cs @@ -86,10 +86,25 @@ private static JsonElement ParseSwaggerDocument(string content) private static async Task WriteToDiskAsync(string path, JsonElement jsonElement) { - string directory = Path.GetDirectoryName(path)!; - Directory.CreateDirectory(directory); - - string contents = jsonElement.ToString(); - await File.WriteAllTextAsync(path, contents); + while (true) + { + try + { + string directory = Path.GetDirectoryName(path)!; + Directory.CreateDirectory(directory); + + string contents = jsonElement.ToString(); + await File.WriteAllTextAsync(path, contents); + + return; + } + catch (IOException) + { + // This sometimes happens when running tests locally. + // Multi-targeted projects should not use the same output path. + + await Task.Delay(TimeSpan.FromMilliseconds(50)); + } + } } } diff --git a/tests.runsettings b/tests.runsettings index e6790c9356..a6309d7602 100644 --- a/tests.runsettings +++ b/tests.runsettings @@ -11,7 +11,7 @@ **/test/**/*.* - [*]JsonApiDotNetCore.OpenApi.JsonApiObjects.* + [*]JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.* ObsoleteAttribute,GeneratedCodeAttribute,TestSDKAutoGeneratedCode true