Skip to content

Commit

Permalink
Fix remaining .NET 9.0 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que committed Jan 15, 2025
1 parent 1894475 commit c970afe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Docker.Registry.DotNet.Helpers
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;

using Docker.Registry.DotNet.QueryParameters;
Expand All @@ -16,12 +17,13 @@ internal static class QueryStringExtensions
/// <typeparam name="T"></typeparam>
/// <param name="queryString"></param>
/// <param name="instance"></param>
internal static void AddFromObjectWithQueryParameters<T>(this QueryString queryString, [NotNull] T instance)
internal static void AddFromObjectWithQueryParameters<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(this QueryString queryString, [JetBrains.Annotations.NotNull] T instance)
where T : class
{
if (instance == null) throw new ArgumentNullException(nameof(instance));
if (instance.GetType() != typeof(T)) throw new ArgumentException("Expected instance to exactly match T type.", nameof(instance));

var propertyInfos = instance.GetType().GetProperties();
var propertyInfos = typeof(T).GetProperties();

foreach (var p in propertyInfos)
{
Expand Down
4 changes: 2 additions & 2 deletions UET/uet/Commands/AppleCert/AppleCertFinalizeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public async Task<int> ExecuteAsync(InvocationContext context)
}

// Import the signed certificate from Apple.
var publicCertificate = new X509Certificate2(Path.Combine(storagePath.FullName, $"{name}.cer"), (string?)null, X509KeyStorageFlags.Exportable);
var publicCertificate = X509CertificateLoader.LoadCertificateFromFile(Path.Combine(storagePath.FullName, $"{name}.cer"));

// Attach the private key to the public certificate.
publicCertificate = publicCertificate.CopyWithPrivateKey(privateKey);
Expand All @@ -126,7 +126,7 @@ public async Task<int> ExecuteAsync(InvocationContext context)
{
var bytes = new byte[embeddedResourceStream.Length];
embeddedResourceStream.ReadExactly(bytes);
intermediateCertificates.Add(new X509Certificate2(bytes, (string?)null));
intermediateCertificates.Add(X509CertificateLoader.LoadCertificate(bytes));
}
}
}
Expand Down

0 comments on commit c970afe

Please sign in to comment.