Page 1 of 1

Beta 12.2 of C#/XAML for HTML5 released (15 new features and new WCF Stack)

Posted: Fri Oct 13, 2017 7:41 am
by JS-Support @Userware
Dear CSHTML5 users,

We are pleased to inform you that the Beta 12.2 of C#/XAML for HTML5 - the extension for Visual Studio that lets you build cross-platform HTML5 apps in standard C# and XAML - is available for download!

(25.58 MiB) Downloaded 486 times

Learn More about C#/XAML for HTML5.

WARNING: This experimental build contains important changes (a new WCF stack) that may temporarily break the compilation of your app. Wait for a future build if you are not willing to experiment with the new WCF stack.

IMPORTANT: You MUST remove the [XmlSerializerFormat] attribute that is located in the service class (on the server-side) in order to use the new WCF stack without errors. Previously, you had to add the [XmlSerializerFormat] attribute to make WCF work (cf. this old page), but now you need to remove that attribute.

Then, you need to "Update Service Reference" in the CSHTML5 project.

Here is what's new (since Beta 12.1):
  • New WCF Stack based on the DataContractSerializer rather than the XmlSerializer.

    • No more "sgen.exe"
    • Much smaller code produced
    • Faster application loading and faster WCF
    • Compatibility with XML namespaces and improved WCF compatibility
    • Fixed many of the limitations of the XmlSerializer and WCF. More limitations will be fixed in the coming days.

    Note: You must remove the [XmlSerializerFormat] attribute that is located in the service class (on the server-side) in order to use the new WCF stack without errors. Previously, you had to add the [XmlSerializerFormat] attribute to make WCF work (cf. this old page), but now you need to remove that attribute.

    Known issues with the new WCF stack:
    • Support for types inheritance and "KnownTypes" is limited: at the moment, if you deserialize a property of type "object" or "ClassA" that contains a "ClassB" that inherits from ClassA, the deserializer will not know which class to instantiate. We are working to fix this issue.
    • Web methods that return a nullable, in case that the nullable has no value
    (please report other issues by posting on this topic or by contacting

    Download a sample WCF project:
    Here you can download a sample WCF project that tests the various types of web methods:
    (65.96 KiB) Downloaded 440 times

    Other new features:
  • Clicking on an error in the Errors pane now correctly jumps to the error location in XAML files
  • Improved DataContractSerializer: support for Char, null values, DateTime, serialization of nested classes, more
  • XAttribute support
  • XContainer.Element and XContainer.Elements
  • RepeatButton
  • Application.Startup
  • Application.OnLaunched
  • ClickMode.Press, ClickMode.Release
  • NumericUpDown (this is an early implementation, it will be improved in the next 14 days)
  • ChildWindow.ShowAndWait() that uses the async/await pattern
  • UIElement.OnLostPointerCapture (and UIElement.OnMouseCaptureLost)
  • UIElement.PointerCaptureLost event (and UIElement.LostMouseCapture event)
  • ButtonBase.IsPressed
  • FaultContractAttribute
  • TemplatePartAttribute
  • TemplateVisualStateAttribute
  • Easier Silverlight Toolkit migration because the namespace "" now points to the built-in "System.Windows.Controls".
  • New Uri constructor
  • HashSet2 now implements ISet2

    Bug fixes:
  • Fixed the OverflowException that happened when an enum value inherited from a ULong bigger than a Long
  • Fixed XName.Equals
  • Fixed an issue where the compilation error "No default content property exists for element" was displayed in case of enums declared in XAML
  • Fixed an issue where if some XAML direct text content was placed after some properties, it was ignored (like in <Button><Button.Background>...</Button.Background>Direct Text Content Placed After Background</Button>)
  • Fixed an issue where direct text content inside a XAML property element was not supported (such as <Button.HorizontalAlignment>Left</Button.HorizontalAlignment>)
  • Fixed an issue where two <Run> tags where not rendered separated by a space (eg. <Run>This is a</Run><Run>test</Run> did not display a space between "a" and "test")
  • Fixed default(nullable)
  • Added "migration tips" for <tooltip:DockPanel>, <controls:GridSplitter>, <controls:DataGrid>, <toolkit:Expander> and <toolkit:NumericUpDown>

Here is some sample code for the new DataContractSerializer:

Code: Select all

public class Person
    public void Init()
        this.FullName = "John Doe";
        this.Age = 30;
        this.MailingAddress = "";
        this.TelephoneNumber = "0123456789";

    // This member is serialized.
    internal string FullName;

    // This is serialized even though it is private.
    private int Age;

    // This is not serialized because the DataMemberAttribute
    // has not been applied.
    private string MailingAddress;

    // This is not serialized, but the property is.
    private string telephoneNumberValue;

    public string TelephoneNumber
        get { return telephoneNumberValue; }
        set { telephoneNumberValue = value; }

public void Serialize()
    var person = new Person();

    var dataContractSerializer = new DataContractSerializer(typeof(Person));
    var xml = dataContractSerializer.SerializeToString(person);

public void Deserialize()
    string xml = @"<?xml version=""1.0"" encoding=""UTF-8""?>
<Person xmlns="""" xmlns:i="""">
<FullName>John Doe</FullName>
    var dataContractSerializer = new DataContractSerializer(typeof(Person));
    var person = (Person)dataContractSerializer.DeserializeFromString(xml);
    MessageBox.Show("Person name: " + person.FullName + Environment.NewLine + "Person phone number: " + person.TelephoneNumber);

We are also working on many other features and we will release them as soon as they are ready.

You may also be interested to read:

Notes about installation:
  • Before installing this update, it is recommended that you close all the open instances of Visual Studio.
  • If for some reason you need to revert to the previous Beta, simply uninstall this one (from the Control Panel) and reinstall the previous Beta.

We hope you will enjoy this build! If you find any issues, please post them on the forums or send an email to

Thank you.