Blog

Latest news and updates from the PlayFab developers

by Paul Gilmore 2016-11-07

C# SDK Updated

We have introduced a wide range of upgrades to the C# SDK:

  • Restoring Xamarin support
  • Significant UUnit test framework upgrades
  • Support for multiple/alternate JSON frameworks
    • Newtonsoft.Json is no longer a required NuGet package
    • Our customized SimpleJson is now built-in
  • Support for multiple/alternate HTTPS frameworks
  • API methods now have a customData contextual-relay-object
  • PlayFabRequestCommon base class for API requests
  • A bunch of miscellaneous code cleanup

This is a big jump forward and our testing is now comprehensive, so we’re incrementing the version number to 1.0 (From the current 0.40). If that’s all you need to know, you can download the PlayFab C# SDK or PlayFab Xamarin SDK now!

Most of these upgrades come from existing code in the Unity SDK. These two projects share the same language, but support very different environments, so we can’t always develop all features in parallel.

Upgrade Guide

In most cases, upgrading C# SDK from 0.x to 1.0 should be painless. All existing API methods and DataTypes should work unchanged. Most of the changes are internal. If you have any issues, please contact us on the forums.

Xamarin

Xamarin is in our list of SDKs and links directly to our C# SDK. In order to claim full support, we resolved several issues, and added fully automated testing around a Xamarin-based-project to ensure everything continues to work going forward.

UUnit Test Framework

Our Unity SDK utilizes a test framework called UUnit, which we have since upgraded. PlayFab has a bunch of requirements when it comes to testing, so we have to make significant upgrades to any test framework we start with (or just write our own from scratch). We started with UUnit but we’ve now modified it so heavily that it bears no resemblance to the original. Specific test framework features:

  • Asynchronous test functions
    • A test can run in multiple threads, and/or take multiple ticks (or even several seconds) to complete
    • Since it’s multi-thread aware, tests can now generate reports while executing, for a live view of test progress
  • Support for WinRT’s limited reflection
  • Test Filtering
    • A basic string filter based on test name
  • ClassSetUp and ClassTearDown for every collection of tests (UUnitTestCase)
  • SetUp and TearDown for every individual test
  • Expanded test-asserts, messaging, and reporting from the original UUnit system

We like it a lot, and we encourage anybody needing a good C# testing framework to use it.

Multiple JSON Frameworks

In our own testing, we found that no single JSON library can solve all problems on all possible platforms. We attempted to do this with our own customization of SimpleJson, but our customers often found cases where their favorite serializer was better for them in some case. We added a feature to Unity SDK which allows customers to define their own JSON Serializer, and we integrated tests into every SDK, so that our customers could verify quickly if their own serializer met all of PlayFab’s JSON requirements. We’ve ported all of that code from Unity SDK to C# SDK, so all those same customizations and options are now available in both SDKs. Specifically, if you want to use our SimpleJson implementation, it now comes built into our SDK. If you want to continue using the Newtonsoft.Json NuGet package we suggested in past versions, that’s fine too. And if you have your own custom JSON serialization, we now support that as well.

Multiple HTTPS Frameworks

The HTTPS framework that was built into the earlier C# SDK did not support some limited WindowsRT platforms. We had already learned our lesson about JSON customization, and multiple HTTPS implementations in Unity. So, everything we say above about JSON, applies to HTTPS, here. It’s much less likely that you will customize this, but all of the same options are available.

CustomData in API Calls

Every API call now has a custom parameter called “customData”. This can be any object which provides context to the result of any API call. As an example, if you make character-related API calls, you can pass a character object in this slot, and in the response, you can read data from the API result, and write it to the character object.

Base Classes for API Requests and Results

This is mostly invisible to customers, but it helps with code-clarity and robustness.

Thanks!

We hope that these changes are useful, and thanks for using PlayFab!