Skip to content

Commit f91c0fd

Browse files
committed
(maint) Ignore CA1416 warnings
With Visual Studio 2026 installed, warnings are treated as errors, and there are a few places that this warning is emitted. This wraps those locations with pragma warning disable statements so that the build succeeds.
1 parent 0d7a79d commit f91c0fd

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/NuGet.Core/NuGet.Packaging/Signing/Authoring/SignPackageRequest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ protected virtual void Dispose(bool disposing)
9898
Chain?.Dispose();
9999

100100
#if IS_SIGNING_SUPPORTED
101+
#pragma warning disable CA1416
101102
PrivateKey?.Dispose();
103+
#pragma warning restore CA1416
102104
#endif
103105
}
104106

src/NuGet.Core/NuGet.Packaging/Signing/Cms/NativeUtility.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ internal unsafe static CMSG_SIGNER_ENCODE_INFO CreateSignerInfo(
120120

121121
signerInfo.cbSize = (uint)Marshal.SizeOf(signerInfo);
122122
signerInfo.pCertInfo = MarshalUtility.PtrToStructure<CERT_CONTEXT>(cmsSigner.Certificate.Handle).pCertInfo;
123+
#pragma warning disable CA1416
123124
signerInfo.hCryptProvOrhNCryptKey = privateKey.Handle.DangerousGetHandle();
125+
#pragma warning restore CA1416
124126
signerInfo.HashAlgorithm.pszObjId = cmsSigner.DigestAlgorithm.Value;
125127

126128
if (cmsSigner.SignerIdentifierType == SubjectIdentifierType.SubjectKeyIdentifier)

0 commit comments

Comments
 (0)