microsoft / xbox-live-unity-plugin

The Xbox Live Unity Plugin provides a way for developers in the Xbox Live Creators Program to quickly and easily integrate Xbox Live functionality into their Unity based game. For ID@Xbox developers, this Xbox Live Unity Plugin does not yet support all the features you will need. Instead, contact your Microsoft representative.
MIT License
167 stars 62 forks source link

140.C.dll crashes on app exit and repo needs build settings update #312

Open NoelStephensNILC opened 3 years ago

NoelStephensNILC commented 3 years ago

I have been tracking down a memory access violation upon the Unity Player UWP application exiting that is occurring here: image

While I would love to be able to build the existing repo and debug this issue, it would seem that this repo is still using VS2015 and definitely doesn't compile easily based on the instructions provided.
Here are some examples: Errors.h could be out of date There are direct references to the _NOEXCEPT define with no checks for it existing within the xbox_services_error_code_category_impl class on lines 1158, 1164, 1177, and 1194.

_Neither the PowerShell script nor the projects within the solution contain any define for the required XSAPIU define, which my assumption is that this is done through some PowerShell script one must setup when installing the XSAPI repo.

Upon adding this define to the Microsoft.Xbox.Services.140.UWP.C project's preprocessor definitions, everything compiles but the following: image

Browsing through the leaderboard.cpp file (first one to throw the compile error) one will notice that there is a #if !defined(XBOX_LIVE_CREATORS_SDK) section...one could only guess that this should be excluded for Creator's Club builds since most all other builds would use the full XDK suite (i.e. id@xbox or higher level developer/publisher).

Upon adding this to define to the Microsoft.Xbox.Services.140.UWP.C project's preprocessor definitions, the previous errors go away (i.e. that code is not compiled) however it then generates 30+ new errors that are based around defines that get excluded from the leaderboard_c.h file when the XBOX_LIVE_CREATORS_SDK preprocessor is included.

Beyond combing through the entire repository, it would seem that this repo could use some attention in these arease: Build instructions: -- How to build the solution from scratch (i.e. this would help the community find bugs and possibly contribute to fix them faster) -- The instructions still reference Unity 5.5, which that naming convention has no longer been used for several years now.

The Solution and Source Files: -- The solution itself is still configured for VS2015, references a much older version of .NET and Windows -- The source files include older XSAPI header and I believe source files

The memory access violation was the original reason I went down this rabbit hole and does not seem to violate anything the Creators Club certification process. I have made sure to check that anything within the managed side of things (i.e. running within the Unity player) is properly disposed of and/or destroyed prior to calling Application.Quit(). When debugging, the unity side of things (attached debugger) disconnects completely after the application has begun the post exit process, however the Microsoft.Xbox.Services.140.UWP.C.DLL leaves a few threads still running and trying to access memory (Native to Managed cross boundary access) that no longer exists (i.e. the managed DLLS have been unloaded). As such, this is a bug within the Native libraries side of things and I would be more than happy to help track this issue down...but there is the previously above mentioned issues with compiling this repo based on the instructions provided.

Since this issue does not seem to throw any flags in the certification process (local and submission), one can still publish their titles to the Microsoft Store. However, the downside to this is that every time a published and active title/application exits it will generate a "Memory failure" report: image While one could easily ignore this (i.e. since the application has passed certification and people can use it, then why worry about it) when visiting their partner center, I can only imagine that this could eventually create undesired resource consumption for Microsoft's partner center and associated databases.

Unfortunately, I don't have the time to allocate in order to dig deeper into this issue (other than the time I have spent tracking down several open bugs in this repository) and it sure would be great if whoever at Microsoft is in charge of this repo could look into updating this Xbox Live plugin by resolving some of the more recent issues (including an overhaul on the solution, associated source files, and updated build notes) that could help simplify the submission process as well as reduce resource consumption in the Partner Center's health databases and associated VMs.

Thank you for providing this Xbox Live plugin for Unity, and looking forward to (hopefully) near-future updates that will help make creating Xbox Live enabled Unity applications and games an easier and more fulfilling process!

Cheers!