[UWP] Item Count Exception

kranthi kumar 206 Reputation points
2023-03-08T14:49:58.1766667+00:00

when i am trying to use Search Query Options & get items count from AppData folder (Path: C:\Users\mine\AppData\Local\Packages) an exception, please see attached image, issue

not sure what is the issue with my code, any clue ?

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
7,632 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
609 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 41,431 Reputation points
    2023-03-08T16:48:08.0833333+00:00

    I don't know anything about this method but the error itself indicates you are using query options that are invalid. Looking at the documentation for the method I notice it is inconsistent as to what is allowed making this really hard to figure out. However it does mention the AreQueryOptionsSupported method that you can call to confirm that the options you want to use are valid for the given folder. I recommend you call this method with your configured options first and see if it returns success. If it says they are valid then the subsequent call should be fine. If not then your query options are incorrect for the folder you're trying to use.