Skip to content

fix: replace deprecated API usage in Platform SDK samples#181

Open
alafleur-genetec wants to merge 1 commit into
mainfrom
fix/replace-deprecated-api-usage
Open

fix: replace deprecated API usage in Platform SDK samples#181
alafleur-genetec wants to merge 1 commit into
mainfrom
fix/replace-deprecated-api-usage

Conversation

@alafleur-genetec
Copy link
Copy Markdown
Member

Resolves four obsolete-API warnings surfaced by a clean rebuild:

  • CredentialBuilderSample: KeypadCredentialFormat(short) -> KeypadCredentialFormat(string). The short overload is obsolete because it does not preserve leading zeros in credential codes.
  • EntityCacheSample: suppress CS0612 around the EntityType enumeration. The sample explicitly excludes EntityType.ReportTemplate (now obsolete) from the iterated set, so the reference is intentional. Pragma documents intent and silences the warning.
  • ArchiverRoleSample / RoleSample: cert.PublicKey.Key.KeyExchangeAlgorithm -> cert.PublicKey.Oid.FriendlyName. The .Key property is obsolete on .NET 8; Oid.FriendlyName returns the algorithm name (RSA, ECC, DSA) without the deprecated AsymmetricAlgorithm round-trip, and works on both target frameworks.

Verified locally (rebased onto fix/restore-vcard-per-project for build): all four projects compile with zero deprecated-API warnings remaining.

Note: this branch is based on main, which currently has the broken VCard build (resolved by PR #179). Reviewers will see CI failures from the VCard issue until #179 lands; the diff in this PR is independent and clean.

Resolves four obsolete-API warnings surfaced by a clean rebuild:

- CredentialBuilderSample: KeypadCredentialFormat(short) -> KeypadCredentialFormat(string).
  The short overload is obsolete because it does not preserve leading zeros
  in credential codes.
- EntityCacheSample: suppress CS0612 around the EntityType enumeration.
  The sample explicitly excludes EntityType.ReportTemplate (now obsolete)
  from the iterated set, so the reference is intentional. Pragma documents
  intent and silences the warning.
- ArchiverRoleSample / RoleSample: cert.PublicKey.Key.KeyExchangeAlgorithm
  -> cert.PublicKey.Oid.FriendlyName. The .Key property is obsolete on .NET 8;
  Oid.FriendlyName returns the algorithm name (RSA, ECC, DSA) without the
  deprecated AsymmetricAlgorithm round-trip, works on both target frameworks.

Verified locally (rebased onto fix/restore-vcard-per-project for build):
all four projects compile with zero deprecated-API warnings remaining.

Note: this branch is based on main, which currently has the broken VCard
build (resolved by PR #179). Reviewers will see CI failures from the VCard
issue until #179 lands; the diff in this PR is independent and clean.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes obsolete API usage from Platform SDK samples while preserving the samples’ intended behavior.

Changes:

  • Replaced deprecated keypad credential constructor usage with the string-based overload.
  • Suppressed the intentional obsolete enum reference used only for filtering.
  • Replaced deprecated certificate public-key access with PublicKey.Oid.FriendlyName.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
Samples/Platform SDK/RoleSample/RoleSample.cs Updates certificate public key algorithm display to avoid deprecated .Key usage.
Samples/Platform SDK/EntityCacheSample/EntityCacheSample.cs Adds targeted pragma suppression around the intentional obsolete enum member reference.
Samples/Platform SDK/CredentialBuilderSample/CredentialBuilderSample.cs Uses the string keypad credential constructor to preserve credential formatting.
Samples/Platform SDK/ArchiverRoleSample/ArchiverRoleSample.cs Updates certificate public key algorithm display to avoid deprecated .Key usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants