[UWP] PlayReady crashes whole app when iterating licenses in release configuration

Jan Drozd 111 Reputation points
2021-03-25T19:47:36.75+00:00

Hi to all!

Once more, I've strange behavior of UWP application I develop I would like to ask help with. Below is the code I use to get information about licenses present on device.

That code works nicely, when I debug the app in Visual Studio 2019. I can see all the license details. However, when I build my application in Release configuration (for MS Store) the code causes crash.

  • Application crashes without any stack trace. The only available information is in event viewer (see bottom)
  • Using try/catch block in following code does not affect behavior. It crashes the app anyway
  • By debugging I've found that it crashes when this line is called: var licenses = new PlayReadyLicenseIterable();
  • However to crash application, at least one PlayReady license must be acquired (if there's no license acquired, the app won't crash)
     internal static string GetPlayreadyLicensesDebugInfo()  
             {  
                 string result = "";  
    
                 var licenses = new PlayReadyLicenseIterable();  
    
                 if (licenses != null)  
                 {  
                     foreach (var license in licenses)  
                     {  
                         if (license != null)  
                         {  
                             string kid = license.GetKIDAtChainDepth(0).ToString();  
    
                             result += "Chain depth: " + license.ChainDepth.ToString() + "\r\n";  
                             result += "KeyID: " + kid + "\r\n";  
                             result += "Expiration date: " + license.ExpirationDate.ToString() + "\r\n";  
                             result += "Fully evaluated: " + license.FullyEvaluated.ToString() + "\r\n";  
                             result += "Usable for play: " + license.UsableForPlay.ToString() + "\r\n";  
    
                         }  
                         else  
                         {  
                             result += "Empty license object\r\n";  
                         }  
    
                         result += "--------------------------------\r\n";  
                     }  
                 }  
    
                 return result;  
             }  
    
    Faulting application name: myapp.exe, version: 1.0.0.0, time stamp: 0x605ce24a
    Faulting module name: SharedLibrary.dll, version: 2.2.29512.0, time stamp: 0x5fad1b28
    Exception code: 0x80004005
    Fault offset: 0x0064da0e
    Faulting process id: 0x3ba4
    Faulting application start time: 0x01d721ae252b42ad
    Faulting application path: C:\Program Files\WindowsApps\Mypackage.myapp_1.0.479.0_x86__3p48kjqbq46a6\myapp.exe
    Faulting module path: C:\Program Files\WindowsApps\Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x86__8wekyb3d8bbwe\SharedLibrary.dll
    Report Id: 714afbbb-2c55-4d01-a8b4-0cd9b2e1aab2
    Faulting package full name: Mypackage.myapp_1.0.479.0_x86__3p48kjqbq46a6
    Faulting package-relative application ID: App

Any help is greatly appreciated.

Edit:

I have decided to verify claim about the "coding issue" on our side. I've taken MS PlayReady sample from here: https://learn.microsoft.com/en-us/samples/microsoft/windows-universal-samples/playready/

and compiled it in RELEASE configuration. The issue happens even in this sample. My whole project including binaries to reproduce this issue: https://jandrozd.eu/playready/PlayReady_sample.zip

Steps to reproduce the issue:

  1. Install app from install folder
  2. Open it and go to second tab "Proactive license request"
  3. Click "Get license"
  4. App will crash

This happens, again, on line

    var licenses = new PlayReadyLicenseIterable(contentHeader, false);  

If you compile (or publish) the app in Debug configuration, issue won't happen.

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.
10,223 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,851 Reputation points
    2021-03-26T02:19:47.957+00:00

    Hello, Welcome to Micorosoft Q&A,

    During testing above code, unfortunately, we can't reproduce your problem,
    For your scenario, the better way is ask store team check that, I'd suggest you open a free support ticket here: Contact Us. Choose to Contact us, select Dashboard for Topic, and select App submissions and management for issue type.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.