Starcounter 2.2: Faster and simpler in use, with Polymer 1.4

April 19, 2016 8:51 am Published by Leave your thoughts

Today we released Starcounter 2.2 (Stable 2.2.1834, April 19 2016). In this release we introduce usability enhancements, performance improvements and a number of simplifications, also addressing stability issues discovered by some of our users. Improvements and code changes have also been introduced in prefab apps (Launcher, SignIn) to reflect to recent changes in the platform and get up to date with the Web Components ecosystem as well as increase the cross-browser compatibility. We have upgraded to the latest Polymer 1.4. All of the sample apps are now running in Chrome, Firefox, Safari, Edge and IE 11.

Below are the highlights to the major improvements for the release.

Database and app host

  • Significantly improved throughput of task scheduling. Reported improvements show a change from thousands of tasks to millions of tasks scheduled per second with lesser CPU load. The ScErrInputQueueFull exception is eliminated and the task queue in now elastic.
  • Simplified task scheduling interface using new static method Scheduling.ScheduleTask(). The interfaces RunSync and RunAsync are now deprecated. The change is another step on preparing users to utilising .NET native scheduler over Starcounter-based scheduler (will be introduced by Starcounter 3.0 in 2017).
  • Added overloads for Db.Transact that allows specifying delegates that take input and output parameters.
  • Wrapped unhandled exception from a scheduled task inside a Starcounter exception to preserve stacktrace.
  • Fixed a potential problem with long-running transactions and scheduling a task for a session that used the same scheduler.
  • Metadata: Added excecptions with information about failed table to upgrade.
  • Fixed a bug that it was not possible to use same class names as meta-tables.
  • Useful syntactic sugar for iteration of property values
  • Support for transient classes and assembly level [Database] declaration.
  • Extended weaver diagnostics emitted by scweaver --verbosity=diagnostic.
  • Fixed bug caused by using synonyms in new builds.
  • Improved diagnostic content when weaver is unable to resolve an application dependency. Now include the probably referring assembly.

Networking and handlers

  • Improved static resources HTTP caching policy, fixing the default aggressive behaviour.
  • Added functionality to unregister existing HTTP handlers.
  • Added a possibility to stream data over TCP, WebSockets and HTTP responses via support for Response.BodyStream property.
  • Added possibility to use straight handlers paramters notation “{?}” in URIs when doing mapping. Paramter type notation “@w” is still supported but is temporary and will be removed in future.
  • Added possibility to register internal codehost handlers with HandlerOptions.SelfOnly.
  • Added property Request.HandlerAppName to know to which application this request belongs.
  • Fixed issue with setting outgoing fields and using outgoing filters in relation to static file resources responses.
  • Changed so that working directory is no longer a resource directory by default. Changed so that implicit resource directories are discovered based on the working directory.
  • Renamed the MiddlewareFiltersEnabled database flag to RequestFiltersEnabled.
  • It is no longer possible to register handlers with same signature. For example, one can’t register handler “GET /{?}” with string parameter, and handler “GET /{?}” with integer parameter.
  • Syntax for getting headers in request and response changed from r["Headername"] to r.Headers["Headername"]. Changed API for getting all headers string to r.GetAllHeaders() for both request and response.
  • In Http and Node receive timeout parameter has changed from milliseconds to seconds (no reasons to have it with milliseconds precision). In Http and Node functions the userObject parameter is gone. Because of that the userDelegate parameter which was previously Action<Response, Object> became just Action<Response>.

Typed JSON and JSON-Patch on server-side

  • Numerous stability improvements related to null references.
  • Fixed issue with missing AppName and PartialId in serialized json when running Launcher.
  • Fixed issue with patches for items in arrays for TypedJson sometimes having incorrect index.
  • Fixed matching metadata-properties with regular properties in JSON-by-example.
  • Wrapping all generated classes for TypedJSON inside namespace to avoid clashing of names
  • Added verification when generating code from JSON-by-example for TypedJSON to make sure all properties only contains valid characters.
  • Wrapping all generated classes for TypedJSON inside namespace to avoid clashing of names.
  • Added verification when generating code from JSON-by-example for TypedJSON to make sure all properties only contains valid characters.
  • Fixed sending only changed/added siblings instead of all siblings when sending patches to client.
  • Fixed a bug and improved errormessage when generating binding between dataobject and TypedJson where the property in TypedJson was an object or array.


  • Added Session.ToAsciiString() to convert an existing session into an ASCII string. Later this session ASCII string can be used as parameter to Session.ScheduleTask.
  • Added method(s) on Session taking a delegate to be run instead of using session.StartUsing() and session.StopUsing(), these two methods are no longer public.
  • Session API has been refactored. New Session.ScheduleTask is added. Session.ForAll has been refactored. Session.Destroyed is now replaced by Session.AddDestroyDelegate because of apps separation issues. Session.CargoId is removed.


  • Made Handle.AddRequestFilter and Handle.AddResponseFilter obsolete in favor new Application.Use() API.
  • Partial class with the support for implicit standalone mode
  • Changed signature of MIME providers, and gave them access to the Request.
  • Introduced support for multiple MIME providers / MIME type.
  • Redesigned MIME providers so that the are now chained, and responsible for invoking the “next” one.
  • Split up built-in provider HtmlFromJsonProvider into that, plus new PartialToStandaloneHtmlProvider.
  • Introduced new JsonAutoSessions MIME provider, supporting auto-creation of sessions as middleware.
  • Introduced new IMiddleware class and the new consolidated middleware Application.Use() API’s.
  • Introduced support to provision HTML (views) from JSON (view models) by means of middleware.
  • Make sure the request is passed as a parameter when constructing a response from a resource.


star.exe and staradmin.exe

  • staradmin improvements
  • Removed (not implemented) option staradmin delete log
  • Resource directories and the working directory are no longer mixed.


  • Fixed an issue when Administrator was starting faster than gateway process in scservice.
  • Fixed text input and text selection issues in Administrator.
  • Fixed mouse and keyboard scrolling issues in Administrator error log and SQL browser.

Visual Studio

  • Redesigned code host app bootstrapper to work better when apps start in concert.

Client side libraries

All of the client side libraries bundled with Starcounter have been upgraded to their current versions. The purpose of most of the changes it to get up to date with the Web Components ecosystem as well as increase the cross-browser compatibility.

All of the sample apps are now running in Chrome, Firefox, Safari, Edge and IE 11.


Polymer, used as a template engine for Puppet web apps, was upgraded from 1.1.4 to 1.4.0. Please review Polymer release notes to learn about the differences.

PuppetJs and puppet-client

PuppetJs was updated from 1.3.1 to 1.3.8. The biggest change for your apps is:

  • A pingInterval feature that extends the session duration. puppet-client sets this value to 60 by default, meaning that a tab session is extended every 60 seconds.
  • The availability of a new onConnectionError callback, which gets called when WebSocket connection drops. You can use this callback to show an error message to the user or attempt reconnection. We want to extend this in future to implement automatic reconnection.
  • Added a new callback onLocalChange, which is called every time a local (web browser) change is detected.

puppet-client, a Custom Element that we made for super easy binding of your client-side HTML presentation layer with the server-side JSON view-model, has been completely rewritten to get compatibility with Polymer 1.2, 1.3 and 1.4. This change should not affect you. Enjoy much better performance of Puppet-to-Polymer communication.


puppet-redirect, a Custom Element that we made to morph pages to a new URL, is now available under a changed path. It should now be imported from /sys/puppet-redirect/puppet-redirect.html. When used with Polymer’s template binding, url value can be bound two-way via property: <puppet-redirect url="{{model.RedirectURL$}}">


Fast-JSON-Patch, the library used for applying and discovering changes to JSON objects, was updated from 0.5.4 to 0.5.7. The major difference is that it no longer uses Object.observe. Instead, it has switched to built-in dirty checking.

Deprecated libraries

The upgrade of puppet-client makes dom-bind-notifier redundant. For compatibility reasons, dom-bind-notifier has not been removed from Starcounter. It was replaced with a warning. Future versions of Starcounter will not include dom-bind-notifier, so please remove it from your HTML templates if you use it.

The upgrade of puppet-client and fast-json-patch makes Object.observe and Array.observe shims redundant. They will be removed from distribution with future versions of Starcounter.

juicy-redirect was marked as deprecated. It will be removed from distribution with future versions of Starcounter. Puppet web apps should use puppet-redirect for morphing between pages.[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]

Categorised in: ,

This post was written by Dan Skatov

Leave a Reply

Your email address will not be published. Required fields are marked *