System.DirectoryServices.AccountManagement.PrincipalContext broken after Windows 10 update

北慕城南 提交于 2019-11-28 05:46:30

One final Google before I started rolling back my machine to the previous build and I found this https://connect.microsoft.com/IE/feedback/details/1904887/windows-10-insider-preview-build-10565

the problem is caused by missing registry entries in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion, specifically: RegisteredOwner and RegisteredOrganization

EDIT: Run the Registry Editor by pressing Windows R and typing regedit.exe. Browse to the location above

Just right click on the CurrentVersion in the Registry Editor and select New > String Value. After you add each entry ( RegisteredOwner and RegisteredOrganization ) edit their values. You can use your username and company name respectively.

Uncheck the Prefer 32-bit checkbox in your project's properties window under the Build tab, it is checked by default - see screenshot. This fixed it for me! Checking the checkbox again will cause the exceptions you describe to re-appear. I'm guessing this will force it to run in 64-bit mode if possible, and therefore use the 64-bit registry path rather than the WOW6432Node registry path and hence it will find the correct keys it needs.

Uncheck 'Prefer 32-bit' screenshot

Try change your build platform target to "AnyCPU", i found that if my platform target is x86, I have this issue!

Why, yet have no idea, seems like win 10 bug!!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!