fix: replace deprecated API usage in Platform SDK samples#181
Open
alafleur-genetec wants to merge 1 commit into
Open
fix: replace deprecated API usage in Platform SDK samples#181alafleur-genetec wants to merge 1 commit into
alafleur-genetec wants to merge 1 commit into
Conversation
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.
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves four obsolete-API warnings surfaced by a clean rebuild:
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.