Search code examples
.netwindows-8windows-runtimewindows-storeargumentnullexception

PackageManager.FindPackagesForUser throwing ArgumentNullException for argument that is allowed to be null?


I'm trying to get reference to a package for the current user by using[PackageManager.FindPackagesForUser(string usersid, string packagename, string publisher)

The MSDN documentation specifically says

userSecurityId

Type: System.String [.NET] | Platform::String [C++]

The user security identifier (SID). If this parameter is null, the packages are retrieved for the current user.

So, I call it like so FindPackageForUser(null, name, publisher) where neither name nor publisher is null(I checked while debugging). Yet, it throws an ArgumentNullException

Is this a bug in this class or am I doing something wrong?


Solution

  • The documentation is wrong. There are no "null strings" in the Windows Runtime. Pass an empty string to enumerate the packages for the current user.