diff --git a/test/OpenTelemetry.Instrumentation.Owin.Tests/Controllers/TestController.cs b/test/OpenTelemetry.Instrumentation.Owin.Tests/Controllers/TestController.cs
index bf7f20b9ae..d6d9145462 100644
--- a/test/OpenTelemetry.Instrumentation.Owin.Tests/Controllers/TestController.cs
+++ b/test/OpenTelemetry.Instrumentation.Owin.Tests/Controllers/TestController.cs
@@ -8,7 +8,7 @@ namespace OpenTelemetry.Instrumentation.Owin.Tests.Controllers;
public class TestController : ApiController
{
// GET api/test/{id}
- public string Get(string id = null)
+ public string Get(string? id = null)
{
return $"id:{id}";
}
diff --git a/test/OpenTelemetry.Instrumentation.Owin.Tests/DiagnosticsMiddlewareTests.cs b/test/OpenTelemetry.Instrumentation.Owin.Tests/DiagnosticsMiddlewareTests.cs
index fa89a01b00..d2111ab468 100644
--- a/test/OpenTelemetry.Instrumentation.Owin.Tests/DiagnosticsMiddlewareTests.cs
+++ b/test/OpenTelemetry.Instrumentation.Owin.Tests/DiagnosticsMiddlewareTests.cs
@@ -22,19 +22,18 @@ namespace OpenTelemetry.Instrumentation.Owin.Tests;
public class DiagnosticsMiddlewareTests : IDisposable
{
private readonly Uri serviceBaseUri;
- private readonly IDisposable listener;
+ private readonly IDisposable? listener;
private readonly EventWaitHandle requestCompleteHandle = new(false, EventResetMode.AutoReset);
public DiagnosticsMiddlewareTests()
{
Random random = new Random();
var retryCount = 5;
- while (retryCount > 0)
+ do
{
+ this.serviceBaseUri = new Uri($"http://localhost:{random.Next(2000, 5000)}/");
try
{
- this.serviceBaseUri = new Uri($"http://localhost:{random.Next(2000, 5000)}/");
-
this.listener = WebApp.Start(
this.serviceBaseUri.ToString(),
appBuilder =>
@@ -81,6 +80,7 @@ public DiagnosticsMiddlewareTests()
retryCount--;
}
}
+ while (retryCount > 0);
if (this.listener == null)
{
diff --git a/test/OpenTelemetry.Instrumentation.Owin.Tests/OpenTelemetry.Instrumentation.Owin.Tests.csproj b/test/OpenTelemetry.Instrumentation.Owin.Tests/OpenTelemetry.Instrumentation.Owin.Tests.csproj
index 1ef3fee142..e61f3950e7 100644
--- a/test/OpenTelemetry.Instrumentation.Owin.Tests/OpenTelemetry.Instrumentation.Owin.Tests.csproj
+++ b/test/OpenTelemetry.Instrumentation.Owin.Tests/OpenTelemetry.Instrumentation.Owin.Tests.csproj
@@ -3,7 +3,6 @@
Unit test project for OpenTelemetry OWIN instrumentation
$(NetFrameworkMinimumSupportedVersion)
- disable