Ramsay Smith
Ramsay Smith

Reputation: 1108

Input data not in expected format in WindowsStoreProxy.xml

I am trying to do some testing on my app using the CurrentAppSimulator but it won't work. I have created WindowsStoreProxy.xml in my Assets directory and set build to None and Copy to Output Directory to Always.

StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
StorageFile proxyFile = await proxyDataFolder.GetFileAsync("WindowsStoreProxy.xml");
await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);

When I use the following code to load the proxy license, I get an error saying" The input data was not in the expected format or did not have the expected value." I have tried changing the proxy file but it doesn't seem to help, and I have tried using the example file from MSDN.

<?xml version="1.0" encoding="UTF-16"?>
<CurrentApp>
  <ListingInformation>
    <App>
      <AppId>9nblggh67n3b</AppId>
      <LinkUri>https://www.microsoft.com/store/apps/9nblggh67n3b</LinkUri>
      <CurrentMarket>en-US</CurrentMarket>
      <AgeRating>3</AgeRating>
      <MarketData xml:lang="en-us">
        <Name>Feline Strike</Name>
        <Description>Sample app for demonstrating trial license management</Description>
        <Price>4.99</Price>
        <CurrencySymbol>$</CurrencySymbol>
      </MarketData>
    </App>
  </ListingInformation>
  <LicenseInformation>
    <App>
      <IsActive>true</IsActive>
      <IsTrial>true</IsTrial>
    </App>
  </LicenseInformation>
  <Simulation SimulationMode="Automatic">
    <DefaultResponse MethodName="LoadListingInformationAsync_GetResult" HResult="E_FAIL"/>
  </Simulation>
</CurrentApp>

Upvotes: 3

Views: 449

Answers (1)

Petr Kolomytsev
Petr Kolomytsev

Reputation: 1

If you look at the generated WindowsStoreProxy.xml file, which is according to the docs located (on Windows) in the folder:

%UserProfile%\AppData\Local\Packages\<app package folder>\LocalState\Microsoft\Windows Store\ApiData

you will see that the file is encoded in UTF-16 LE.

I've faced the exact same problem. Changing the encoding of the manually created file to UTF-16 LE solved the issue for me.

Upd.: The docs also mention the encoding, but they don't really focus on it.

Upvotes: 0

Related Questions