'PDKPR008E Attribute name [xyz] does not exist' error when retrieving password using .NET SDK
Symptom
The following error is consistently thrown when running the .NET SDK sample code:
CyberArk.AAM.NetStandardPasswordSDK.Exceptions.PSDKException: 'PDKPR008E Attribute name [xyz] does not exist'
Environment
11.1;11;11.2;11.3;11.4;11.5;11.6;11.7;12.0;12.1;12.2;11.9;11.8;12.4;12.3;12.5;12.6 Privileged Access Manager (PAM, self-hosted) Credential Provider Windows or Linux operating system
Credential Provider NET Standard SDK
.NET runtime: .NET 5, .NET 6, .NET 7
Thai language set as Windows Display Language or language of the thread set as Thai.
Cause
The problem can be reproduced in a Windows and Linux machines when thread locale is set to Thai. For Windows it is typical when Display Language is set as Thai.
If Windows language is not Thai but thread set locale to “th-TH” using Thread.CurrentThread.CurrentCulture the issue is also visible.
Please note that for the other non-Latin scripts the problem is not visible, for example Credential Provider works properly with ja-JP (Japan), zh-CN (China), km-KH (Kambodia), ar-SA (Arabic) and others.
The issue can be reproduced only when using .NET 5, .NET 6 and .NET 7.
For .NET 3.1, NetFramework 4.7.2 and NetFramework 4.8.0 everything is ok.
The root cause of the problem is change of globalisation API from NLS to ICU starting from .NET 5 (Windows 10 May 2019 Update). ICU is not fully backward compatible with NLS.
https://learn.microsoft.com/en-us/dotnet/core/compatibility/globalization/5.0/icu-globalization-api
Resolution
There are two solution for the issue:
- Change the Windows Display Language to different language than Thai, e.g. English US.
- Change locale of the thread before setting attributes (and optionally change it back to original locale).
- Switch back to NLS API
Solution #2
CultureInfo en = new CultureInfo("en-US", false);
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
PSDKPasswordRequest passRequest = new PSDKPasswordRequest();
Thread.CurrentThread.CurrentCulture = en; //set to english
passRequest.AppID = "appid";
passRequest.Reason = "reason";
Thread.CurrentThread.CurrentCulture = ci; //back to current language
Modification of Assembly Neutral Language does not resolve the issue.
Solution #3
It is possible to use run-time switch to force use of NLS (which does not cause problems) from ICU APIs.
Set true to use NLS and solve the issue.
| Setting name | Values | Introduced | |
|---|---|---|---|
| runtimeconfig.json | System.Globalization.UseNls | false - Use ICU globalization APIstrue - Use NLS globalization APIs | .NET 5 |
| Environment variable | DOTNET_SYSTEM_GLOBALIZATION_USENLS | false - Use ICU globalization APIstrue - Use NLS globalization APIs | .NET 5 |
See more on that on Microsoft documentation: