Skip to content

Commit

Permalink
Clean-up warnings. they prented to see signal in the noise (#2790)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmprieur authored Apr 23, 2024
1 parent f35b28f commit f8102a9
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 16 deletions.
4 changes: 2 additions & 2 deletions benchmark/TokenAcquisitionBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ static TokenAcquisitionBenchmark()
public async Task CreateAuthorizationHeader()
{
// Get the authorization request creator service
IAuthorizationHeaderProvider authorizationHeaderProvider = s_serviceProvider.GetRequiredService<IAuthorizationHeaderProvider>();
IAuthorizationHeaderProvider authorizationHeaderProvider = s_serviceProvider!.GetRequiredService<IAuthorizationHeaderProvider>();
await authorizationHeaderProvider.CreateAuthorizationHeaderForAppAsync("https://graph.microsoft.com/.default");
}

[Benchmark]
public async Task GetTokenAcquirer()
{
// Get the token acquisition service
ITokenAcquirer tokenAcquirer = s_tokenAcquirerFactory.GetTokenAcquirer();
ITokenAcquirer tokenAcquirer = s_tokenAcquirerFactory!.GetTokenAcquirer();
await tokenAcquirer.GetTokenForAppAsync("https://graph.microsoft.com/.default");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ private async Task<IConfidentialClientApplication> BuildConfidentialClientApplic
if (mergedOptions.PreserveAuthority && !string.IsNullOrEmpty(mergedOptions.Authority))
{
authority = mergedOptions.Authority!;
builder.WithGenericAuthority(authority);
builder.WithOidcAuthority(authority);
}
else if (mergedOptions.IsB2C)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/DevApps/aspnet-mvc/OwinWebApi/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0A613F4DD989E8AE" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.59.0.0" newVersion="4.59.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.60.3.0" newVersion="4.60.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="ADB9793829DDAE60" culture="neutral"/>
Expand Down Expand Up @@ -174,7 +174,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159E12E44C8" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.36.0.0" newVersion="1.36.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-1.38.0.0" newVersion="1.38.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="EB42632606E9261F" culture="neutral"/>
Expand Down
4 changes: 2 additions & 2 deletions tests/DevApps/aspnet-mvc/OwinWebApp/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0A613F4DD989E8AE" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.59.0.0" newVersion="4.59.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.60.3.0" newVersion="4.60.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="ADB9793829DDAE60" culture="neutral"/>
Expand Down Expand Up @@ -167,7 +167,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159E12E44C8" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.36.0.0" newVersion="1.36.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-1.38.0.0" newVersion="1.38.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="EB42632606E9261F" culture="neutral"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFrameworks>net7.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWip>true</UseWip>
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 11 additions & 3 deletions tests/E2E Tests/WebAppUiTests/TestingWebAppLocally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
using System.Runtime.Versioning;
using System.Threading.Tasks;
using Microsoft.Identity.Lab.Api;
using TC = Microsoft.Identity.Web.Test.Common.TestConstants;
using Microsoft.Playwright;
using Xunit;
using Xunit.Abstractions;
using System.Threading;
using System.Net;
using TC = Microsoft.Identity.Web.Test.Common.TestConstants;

namespace WebAppUiTests;

Expand Down Expand Up @@ -122,7 +120,17 @@ private async Task ExecuteWebAppCallsGraphFlow(string upn, string credential, Di
Queue<Process> processes = new();
if (process != null)
{ processes.Enqueue(process); }

#if WINDOWS
UiTestHelpers.KillProcessTrees(processes);
#else
while (processes.Count > 0)
{
Process p = processes.Dequeue();
p.Kill();
p.WaitForExit();
}
#endif

// Cleanup Playwright
// Stop tracing and export it into a zip archive.
Expand Down
28 changes: 22 additions & 6 deletions tests/E2E Tests/WebAppUiTests/WebAppCallsApiCallsGraphLocally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
{TC.KestrelEndpointEnvVar, TC.HttpsStarColon + TodoListClientPort}
};

Dictionary<string, Process> processes = null;
Dictionary<string, Process>? processes = null;

// Arrange Playwright setup, to see the browser UI set Headless = false.
const string TraceFileName = TraceFileClassName + "_TodoAppFunctionsCorrectly";
using IPlaywright playwright = await Playwright.CreateAsync();
IBrowser browser = await playwright.Chromium.LaunchAsync(new() { Headless = true });
IBrowserContext context = await browser.NewContextAsync(new BrowserNewContextOptions { IgnoreHTTPSErrors = true });
await context.Tracing.StartAsync(new() { Screenshots = true, Snapshots = true, Sources = true });
IPage page = null;
IPage? page = null;

try
{
Expand Down Expand Up @@ -150,7 +150,10 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
var guid = Guid.NewGuid().ToString();
try
{
await page.ScreenshotAsync(new PageScreenshotOptions() { Path = $"ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds_TodoAppFunctionsCorrectlyScreenshotFail{guid}.png", FullPage = true });
if (page != null)
{
await page.ScreenshotAsync(new PageScreenshotOptions() { Path = $"ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds_TodoAppFunctionsCorrectlyScreenshotFail{guid}.png", FullPage = true });
}
}
catch
{
Expand Down Expand Up @@ -200,15 +203,15 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
{TC.KestrelEndpointEnvVar, TC.HttpsStarColon + WebAppCiamPort}
};

Dictionary<string, Process> processes = null;
Dictionary<string, Process>? processes = null;

// Arrange Playwright setup, to see the browser UI set Headless = false.
const string TraceFileName = TraceFileClassName + "_CiamWebApp_WebApiFunctionsCorrectly";
using IPlaywright playwright = await Playwright.CreateAsync();
IBrowser browser = await playwright.Chromium.LaunchAsync(new() { Headless = true });
IBrowserContext context = await browser.NewContextAsync(new BrowserNewContextOptions { IgnoreHTTPSErrors = true });
await context.Tracing.StartAsync(new() { Screenshots = true, Snapshots = true, Sources = true });
IPage page = null;
IPage? page = null;

try
{
Expand Down Expand Up @@ -261,7 +264,10 @@ public async Task ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds
var guid = Guid.NewGuid().ToString();
try
{
await page.ScreenshotAsync(new PageScreenshotOptions() { Path = $"ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds_CallsDownStreamApiWithCiamScreenshotFail{guid}.png", FullPage = true });
if (page != null)
{
await page.ScreenshotAsync(new PageScreenshotOptions() { Path = $"ChallengeUser_MicrosoftIdFlow_LocalApp_ValidEmailPasswordCreds_CallsDownStreamApiWithCiamScreenshotFail{guid}.png", FullPage = true });
}
}
catch
{
Expand Down Expand Up @@ -313,7 +319,17 @@ private void EndProcesses(Dictionary<string, Process>? processes)
processQueue.Enqueue(process.Value);
}
}

#if WINDOWS
UiTestHelpers.KillProcessTrees(processQueue);
#else
while (processQueue.Count > 0)
{
Process p = processQueue.Dequeue();
p.Kill();
p.WaitForExit();
}
#endif
}

private async Task<IPage> NavigateToWebApp(IBrowserContext context, uint port)
Expand Down

0 comments on commit f8102a9

Please sign in to comment.