Skip to content

Commit 8aa360f

Browse files
Bump Microsoft.NET.Test.Sdk from 17.14.1 to 18.0.0 (#1804)
* Bump Microsoft.NET.Test.Sdk from 17.14.1 to 18.0.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Update TestSdkVersion to allow minor version updates * Workaround sporadic error "IOException: The process cannot access the file" when running locally through 'dotnet test' * Fix coverage exclude pattern --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
1 parent d016302 commit 8aa360f

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

package-versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<ScalarAspNetCoreVersion>2.9.*</ScalarAspNetCoreVersion>
2929
<SwashbuckleVersion>9.*-*</SwashbuckleVersion>
3030
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>
31-
<TestSdkVersion>17.14.*</TestSdkVersion>
31+
<TestSdkVersion>18.0.*</TestSdkVersion>
3232
<XunitVersion>2.9.*</XunitVersion>
3333
<XunitVisualStudioVersion>3.1.*</XunitVisualStudioVersion>
3434
</PropertyGroup>

test/OpenApiTests/OpenApiTestContext.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

tests.runsettings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<DataCollector friendlyName="XPlat Code Coverage">
1212
<Configuration>
1313
<ExcludeByFile>**/test/**/*.*</ExcludeByFile>
14-
<Exclude>[*]JsonApiDotNetCore.OpenApi.JsonApiObjects.*</Exclude>
14+
<Exclude>[*]JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.*</Exclude>
1515
<ExcludeByAttribute>ObsoleteAttribute,GeneratedCodeAttribute,TestSDKAutoGeneratedCode</ExcludeByAttribute>
1616
<DeterministicReport>true</DeterministicReport>
1717
</Configuration>

0 commit comments

Comments
 (0)