Frequently Asked Questions

Click on a question to open its answer.

Where are the libraries (DLL) ?

In the source code archive, they are in this directory \Source\DLL\.
Every platform has its own project.
For example:
Source\DLL\NET 4.5\UniversalSerializer for .NET 4.5\UniversalSerializer 3 for NET 4_5.csproj

Alternatively, You can compile all libraries at once:

  1. Install Visual Studio 2017 or later, Xamarin, Xamarin Forms, the Android SDK, and the UWP framework.
    You may consider installing the Android Studio first, and the API 27.
  2. Extract the source code archive of UniversalSerializer.
  3. Open this solution:
    Source\DLL\All DLLs as Release\All DLLs as Release.sln
  4. Run the solution (the default project is "Copy DLL files").
  5. All the libraries will be built and copied to this directory:
    Source\DLL\All DLLs as Release\DLLs
Is UniversalSerializer thread-safe ? Can it run on parallel threads ?

UniversalSerializer is thread-safe, but it is not concurrent.
You can serialize from different threads, but the serialization will not operate simultaneously.

How can I send you an Issue?

In case of a problem, please create an issue on GitHub.

You can give me a short example of code I can compile and test by myself.

Please ensure your problem is not in this Faq and has not already an issue on GitHub.

Is there a PCL (Portable Class Library) serializer ?

No. It seems Microsoft abandoned the PCL in favor to the UWP (Universal Windows) and to the .NET Standard.
Anyway, programming a PCL was painful, so I removed it.

Can I serialize to json on UWP ?

No, the json format is not available on UWP.
I may implement it someday. But it is not an easy job.

What does UniversalSerializer when the version of a serialized type has changed ?

When UniversalSerializer deserializes a type, it takes into account its version at the moment of the serialization.
If the version are different, UniversalSerializer will not recognize the type, then the deserialization will fail.

The reason is the declaration of the type may have changed on the new version:

  • Some fields/properties may have been added, removed or renamed.
  • The semantic of the fields/properties may have changed, even if their declaration did not.
  • Some constructors may have been added or removed.
The solution is not easy:
  1. The type author (you for example) would have to add attributes that explain the changes:
    •  When a member (field or property) has been renamed.
      The attributes gives the old name.
    • If the type of a member has been changed (for example Int32 to Double), then the author should add an attribute that gives a conversion function.
      The conversion from an Int32 to a Double can be trivial and implicit. But transcoding from an author type to another type needs such a function since the serializer can not guess how to do that.
      Another solution is to add an implicit converter to the type itself: "implicit operator" in C#.
  2. Then the serializer would use these attributes in order to transcode (convert) an old value to a new version of its type.

That is a lot of work, because I need to change the file format in deep, which in turn makes me change a good part of my source code.
Don't forget that is a spare-time project, not a commercial product.

What can I do if a third-party (or framework) type does not serialize ?

You can create a Container.

A container is a class or structure you create that will be serialized in place of another type (structure or class) that would not serialize or would be problematic (not efficient, missing fields, etc.).

If you write a container for a common type, please share it.
I will be more than happy to include it in the serializer.

What is the file extension of the serialization files ?

The file extensions I suggest are:

  • .uniser
    for the binary format.
  • .uniser.xml
    for the HTML format.
  • .uniser.json
    for the JSON format.
Who wrote UniversalSerializer ?

My name is Christophe Bertrand. You will find more information here.