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://docs.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:
Install app from install folder
Open it and go to second tab "Proactive license request"
Click "Get license"
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.