Skip to content

Commit

Permalink
Fix all warnings and treat warnings as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bgavrilMS committed Jan 2, 2025
1 parent aef501f commit 7a9400f
Show file tree
Hide file tree
Showing 42 changed files with 92 additions and 168 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<!-- Projects must set this individually -->
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Label="For CI build" Condition="'$(TF_BUILD)' == 'true'">
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageVersion Include="MSTest.TestFramework" Version="3.1.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="NSubstitute" Version="4.4.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.15" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="NuGet.Versioning" Version="6.8.0" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
20 changes: 0 additions & 20 deletions LibsAndSamples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ Global
{24D2AF71-A01E-4450-8C3F-B9923A81134B}.Debug + MobileApps|x86.ActiveCfg = Debug + MobileApps|Any CPU
{24D2AF71-A01E-4450-8C3F-B9923A81134B}.Debug + MobileApps|x86.Build.0 = Debug + MobileApps|Any CPU
{24D2AF71-A01E-4450-8C3F-B9923A81134B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24D2AF71-A01E-4450-8C3F-B9923A81134B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24D2AF71-A01E-4450-8C3F-B9923A81134B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{24D2AF71-A01E-4450-8C3F-B9923A81134B}.Debug|ARM.Build.0 = Debug|Any CPU
{24D2AF71-A01E-4450-8C3F-B9923A81134B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -609,7 +608,6 @@ Global
{959A47D9-07E7-4BF3-A0F7-6D9CD42A2C46}.Debug|x86.ActiveCfg = Debug|Any CPU
{959A47D9-07E7-4BF3-A0F7-6D9CD42A2C46}.Debug|x86.Build.0 = Debug|Any CPU
{959A47D9-07E7-4BF3-A0F7-6D9CD42A2C46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{959A47D9-07E7-4BF3-A0F7-6D9CD42A2C46}.Release|Any CPU.Build.0 = Release|Any CPU
{959A47D9-07E7-4BF3-A0F7-6D9CD42A2C46}.Release|ARM.ActiveCfg = Release|Any CPU
{959A47D9-07E7-4BF3-A0F7-6D9CD42A2C46}.Release|ARM.Build.0 = Release|Any CPU
{959A47D9-07E7-4BF3-A0F7-6D9CD42A2C46}.Release|ARM64.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -721,7 +719,6 @@ Global
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug + MobileApps|x86.ActiveCfg = Debug + MobileApps|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug + MobileApps|x86.Build.0 = Debug + MobileApps|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug|ARM.ActiveCfg = Debug|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug|ARM.Build.0 = Debug|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand All @@ -735,7 +732,6 @@ Global
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug|x86.ActiveCfg = Debug|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Debug|x86.Build.0 = Debug|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Release|Any CPU.Build.0 = Release|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Release|ARM.ActiveCfg = Release|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Release|ARM.Build.0 = Release|Any CPU
{E7EB3226-D0F5-4A93-87DC-FAAC9A24D684}.Release|ARM64.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -763,7 +759,6 @@ Global
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug + MobileApps|x86.ActiveCfg = Debug + MobileApps|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug + MobileApps|x86.Build.0 = Debug + MobileApps|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug|Any CPU.Build.0 = Debug|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug|ARM.ActiveCfg = Debug|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug|ARM.Build.0 = Debug|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand All @@ -777,7 +772,6 @@ Global
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug|x86.ActiveCfg = Debug|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Debug|x86.Build.0 = Debug|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Release|Any CPU.ActiveCfg = Release|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Release|Any CPU.Build.0 = Release|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Release|ARM.ActiveCfg = Release|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Release|ARM.Build.0 = Release|Any CPU
{339E0B2B-4408-4947-B134-E8C5AAB11286}.Release|ARM64.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -805,7 +799,6 @@ Global
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug + MobileApps|x86.ActiveCfg = Debug + MobileApps|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug + MobileApps|x86.Build.0 = Debug + MobileApps|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug|ARM.ActiveCfg = Debug|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug|ARM.Build.0 = Debug|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand All @@ -819,7 +812,6 @@ Global
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug|x86.ActiveCfg = Debug|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Debug|x86.Build.0 = Debug|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Release|Any CPU.Build.0 = Release|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Release|ARM.ActiveCfg = Release|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Release|ARM.Build.0 = Release|Any CPU
{2AF48872-DD47-4DA1-A153-DF4DA13882C2}.Release|ARM64.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -1014,7 +1006,6 @@ Global
{998D38B3-344C-4F19-833E-6181B0834AF6}.Debug + MobileApps|x86.ActiveCfg = Debug + MobileApps|Any CPU
{998D38B3-344C-4F19-833E-6181B0834AF6}.Debug + MobileApps|x86.Build.0 = Debug + MobileApps|Any CPU
{998D38B3-344C-4F19-833E-6181B0834AF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{998D38B3-344C-4F19-833E-6181B0834AF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{998D38B3-344C-4F19-833E-6181B0834AF6}.Debug|ARM.ActiveCfg = Debug|Any CPU
{998D38B3-344C-4F19-833E-6181B0834AF6}.Debug|ARM.Build.0 = Debug|Any CPU
{998D38B3-344C-4F19-833E-6181B0834AF6}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -1182,7 +1173,6 @@ Global
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug + MobileApps|x86.ActiveCfg = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug + MobileApps|x86.Build.0 = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug|ARM.Build.0 = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand All @@ -1196,7 +1186,6 @@ Global
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug|x86.ActiveCfg = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Debug|x86.Build.0 = Debug|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Release|Any CPU.Build.0 = Release|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Release|ARM.ActiveCfg = Release|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Release|ARM.Build.0 = Release|Any CPU
{3A2042E9-8B03-4F2D-A2B7-EA4BEC36340C}.Release|ARM64.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -1231,8 +1220,6 @@ Global
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug + MobileApps|x86.Build.0 = Debug|x86
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug + MobileApps|x86.Deploy.0 = Debug|x86
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|ARM.ActiveCfg = Debug|ARM
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|ARM.Build.0 = Debug|ARM
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|ARM.Deploy.0 = Debug|ARM
Expand All @@ -1252,8 +1239,6 @@ Global
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|x86.Build.0 = Debug|x86
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Debug|x86.Deploy.0 = Debug|x86
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Release|Any CPU.Build.0 = Release|Any CPU
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Release|Any CPU.Deploy.0 = Release|Any CPU
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Release|ARM.ActiveCfg = Release|ARM
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Release|ARM.Build.0 = Release|ARM
{34E323E8-E706-4DF4-B916-D614FC8CFCEB}.Release|ARM.Deploy.0 = Release|ARM
Expand Down Expand Up @@ -1371,7 +1356,6 @@ Global
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug + MobileApps|x86.ActiveCfg = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug + MobileApps|x86.Build.0 = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug|ARM.Build.0 = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand All @@ -1385,7 +1369,6 @@ Global
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug|x86.ActiveCfg = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Debug|x86.Build.0 = Debug|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Release|Any CPU.Build.0 = Release|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Release|ARM.ActiveCfg = Release|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Release|ARM.Build.0 = Release|Any CPU
{B381269F-44DA-4E46-8F51-1F1DF7D1F61D}.Release|ARM64.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -1413,7 +1396,6 @@ Global
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug + MobileApps|x86.ActiveCfg = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug + MobileApps|x86.Build.0 = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug|ARM.ActiveCfg = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug|ARM.Build.0 = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand All @@ -1427,7 +1409,6 @@ Global
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug|x86.ActiveCfg = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Debug|x86.Build.0 = Debug|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Release|Any CPU.Build.0 = Release|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Release|ARM.ActiveCfg = Release|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Release|ARM.Build.0 = Release|Any CPU
{4EA542D2-D4C9-403C-B615-0047D0A62790}.Release|ARM64.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -1455,7 +1436,6 @@ Global
{1B047736-9325-4F59-906B-89A3E12AC8FB}.Debug + MobileApps|x86.ActiveCfg = Debug|Any CPU
{1B047736-9325-4F59-906B-89A3E12AC8FB}.Debug + MobileApps|x86.Build.0 = Debug|Any CPU
{1B047736-9325-4F59-906B-89A3E12AC8FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B047736-9325-4F59-906B-89A3E12AC8FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B047736-9325-4F59-906B-89A3E12AC8FB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{1B047736-9325-4F59-906B-89A3E12AC8FB}.Debug|ARM.Build.0 = Debug|Any CPU
{1B047736-9325-4F59-906B-89A3E12AC8FB}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<IsPackable>true</IsPackable>

<PlatformTarget>AnyCPU</PlatformTarget>

</PropertyGroup>

<ItemGroup Label="Build Tools" Condition="$([MSBuild]::IsOsPlatform('Windows'))">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public MsalCachePersistenceException(string message, Exception innerException) :
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
[Obsolete]
protected MsalCachePersistenceException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ private Intent CreateIntentFromInteractiveBundle(Bundle accountManagerResult, Br
_logger.Info("[Android broker] Android account manager didn't return any results for interactive broker request. ");
}

#pragma warning disable CA1422 // Validate platform compatibility
Intent interactiveIntent = (Intent)accountManagerResult?.GetParcelable(AccountManager.KeyIntent);
#pragma warning restore CA1422 // Validate platform compatibility

// Validate that the intent was created successfully.
if (interactiveIntent != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ private string GetRedirectUriForBroker()
return string.Empty;
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1422:Validate platform compatibility", Justification = "<Pending>")]
private string GetCurrentSignatureForPackage(string packageName)
{
try
Expand Down Expand Up @@ -347,6 +348,7 @@ private void VerifyCertificateChain(List<X509Certificate2> certificates)
}
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1422:Validate platform compatibility", Justification = "<Pending>")]
private List<X509Certificate2> ReadCertDataForBrokerApp(string brokerPackageName)
{
#pragma warning disable CS0618 // Type or member is obsolete https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/1854
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public override void OnLoadResource(WebView view, string url)
}

[Obsolete] // because parent is obsolete
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
public override bool ShouldOverrideUrlLoading(WebView view, string url)
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
{
Uri uri = new Uri(url);
if (url.StartsWith(BrokerConstants.BrowserExtPrefix, StringComparison.OrdinalIgnoreCase))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ private Dictionary<string, string> CreateBrokerRequestDictionary(
return brokerRequest;
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1422:Validate platform compatibility", Justification = "<Pending>")]
public void HandleInstallUrl(string appLink)
{
DispatchQueue.MainQueue.DispatchAsync(() => UIApplication.SharedApplication.OpenUrl(new NSUrl(appLink)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool canInitWithRequest(NSUrlRequest request)
}

[Export("canonicalRequestForRequest:")]
public new static NSUrlRequest GetCanonicalRequest(NSUrlRequest request)
public static new NSUrlRequest GetCanonicalRequest(NSUrlRequest request)
{
return request;
}
Expand All @@ -45,7 +45,9 @@ public override void StartLoading()

NSMutableUrlRequest mutableRequest = (NSMutableUrlRequest)Request.MutableCopy();
SetProperty(new NSString("YES"), "ADURLProtocol", mutableRequest);
#pragma warning disable CA1422 // Validate platform compatibility
connection = new NSUrlConnection(mutableRequest, new CoreCustomConnectionDelegate(this), true);
#pragma warning restore CA1422 // Validate platform compatibility
}

public override void StopLoading()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class EmbeddedWebUI : WebviewBase
public RequestContext RequestContext { get; internal set; }
public CoreUIParent CoreUIParent { get; set; }

public async override Task<AuthorizationResult> AcquireAuthorizationAsync(
public override async Task<AuthorizationResult> AcquireAuthorizationAsync(
Uri authorizationUri,
Uri redirectUri,
RequestContext requestContext,
Expand Down Expand Up @@ -46,7 +46,9 @@ public void Authenticate(Uri authorizationUri, Uri redirectUri, RequestContext r
UIViewController viewController = null;
InvokeOnMainThread(() =>
{
#pragma warning disable CA1422 // Validate platform compatibility
UIWindow window = UIApplication.SharedApplication.KeyWindow;
#pragma warning restore CA1422 // Validate platform compatibility
viewController = CoreUIParent.FindCurrentViewController(window.RootViewController);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ public override void DecidePolicy(WKWebView webView, WKNavigationAction navigati
};
requestUrlString = httpsUrlBuilder.Uri.AbsoluteUri;

#pragma warning disable CA1422 // Validate platform compatibility
DispatchQueue.MainQueue.DispatchAsync(
() => UIApplication.SharedApplication.OpenUrl(new NSUrl(requestUrlString)));
#pragma warning restore CA1422 // Validate platform compatibility
_authenticationAgentUIViewController.DismissViewController(true, null);
decisionHandler(WKNavigationActionPolicy.Cancel);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ internal class ASWebAuthenticationPresentationContextProviderWindow : NSObject,
{
public UIWindow GetPresentationAnchor(ASWebAuthenticationSession session)
{
#pragma warning disable CA1422 // Validate platform compatibility
return UIApplication.SharedApplication.KeyWindow;
#pragma warning restore CA1422 // Validate platform compatibility
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public override async Task<AuthorizationResult> AcquireAuthorizationAsync(
s_viewController = null;
InvokeOnMainThread(() =>
{
#pragma warning disable CA1422 // Validate platform compatibility
UIWindow window = UIApplication.SharedApplication.KeyWindow;
#pragma warning restore CA1422 // Validate platform compatibility
s_viewController = CoreUIParent.FindCurrentViewController(window.RootViewController);
});

Expand All @@ -59,6 +61,7 @@ public void Authenticate(Uri authorizationUri, Uri redirectUri, RequestContext r
{
if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0))
{
#pragma warning disable CA1422 // Validate platform compatibility
asWebAuthenticationSession = new AuthenticationServices.ASWebAuthenticationSession(new NSUrl(authorizationUri.AbsoluteUri),
redirectUri.Scheme, (callbackUrl, error) =>
{
Expand All @@ -71,6 +74,7 @@ public void Authenticate(Uri authorizationUri, Uri redirectUri, RequestContext r
ContinueAuthentication(callbackUrl.ToString(), RequestContext.Logger);
}
});
#pragma warning restore CA1422 // Validate platform compatibility

asWebAuthenticationSession.BeginInvokeOnMainThread(() =>
{
Expand Down
Loading

0 comments on commit 7a9400f

Please sign in to comment.