Documentation
Table of Contents

License behaviour

IntentSharp checks your license key on the machine it runs on, when a client is built. It never phones home and makes no network call to check a key. With every kind of key but one, the client is built and every call runs; the library writes a notice to your logs. The one exception is a paid key on a release dated after the key's maintenance date: then Build() throws a LicenseException.

Each kind of key

Your key The client Logged What to do
No key Keeps working Warning, when built, then at most once an hour while used Set your key, or ask for an evaluation key
A key that is not valid (damaged when copied, or not issued by C2Consultants) Keeps working Error, when built, then at most once an hour Copy the whole key again, or write for a replacement
Evaluation key, up to and including its last day Keeps working Information, once, when built Buy before the evaluation ends
Evaluation key after its last day Keeps working Error, when built, then at most once an hour Buy a license
Paid key, up to and including its paid-through date Keeps working Information, once, when built Nothing
Paid key in the 30 days after its paid-through date (renewal due) Keeps working Warning, when built, then at most once an hour Renew
Paid key more than 30 days after its paid-through date (lapsed) Keeps working Error, when built, then at most once an hour Renew, or stay on the releases your key covers (see Upgrading)
Paid key on a release dated after the key's maintenance date Build() throws LicenseException; no client is built Nothing: the exception carries the message, each time a client is built Use a release dated on or before your maintenance date, or renew

The Logged column gives the level, then how often the notice is written. Dates are calendar dates in UTC. The paid-through date and the maintenance date are the two dates in your key (see What your key says).

The one case where Build() throws: a release after your maintenance date

Every IntentSharp release carries its release date. When a paid key's maintenance date is earlier than that date, building the client throws a LicenseException that names the license, its dates and how to renew. This is what lets a lapsed license keep using the releases it covers: releases dated on or before the maintenance date accept the key, and later ones do not.

  • It applies to paid keys only. An evaluation key never causes it, whatever the release; an evaluation is reported by its own dates.
  • It is checked only when a client is built. A process that is already running is never stopped, and no call is ever refused because of the license.
  • With AddIntentSharp under a .NET host, the client is built while the host starts, so the exception is thrown then and the host does not start. Without a host, it is thrown when the client is first resolved. It never comes from a request.

Time-based states only log

By default, the paid-through date and the end of an evaluation only change what is logged; with FailWhenUnlicensed on, an ended evaluation makes the next Build() throw (below). A long-running application moves from licensed to renewal due to lapsed, or from evaluation to an ended evaluation, on the right day, without a restart: the date is checked again at most once per reminder interval, on the next call. The release date check is not repeated while the application runs.

How often notices repeat

A notice that repeats is written when the client is built, and again at the start of a call once the reminder interval has passed since the last one. The interval is one hour by default; set IntentClientOptions.LicenseReminderInterval (or IntentSharp:Options:LicenseReminderInterval in configuration) to change it. It must be greater than zero. A client that makes no calls writes no further notices.

Notices go to the logging you give the client: WithLoggerFactory on the builder, or the application's logging when you use AddIntentSharp. Without a logger factory nothing is logged. Every license notice has the event id 9100, named IntentSharp.License, so you can route it to its own sink. LicenseInfo.NoticeEventId holds it.

Check the license in your code

client.License shows the state as of the last check, with the dates of a valid key. The last check is when the client was built, or the latest call that started after a reminder interval had passed (Time-based states only log):

LicenseStatus license = client.License;
Console.WriteLine($"State: {license.State}");   // for example Licensed, or None
Console.WriteLine($"Days left: {license.DaysRemaining?.ToString() ?? "n/a"}");
if (license.Payload is { } key)
{
    Console.WriteLine($"{key.Licensee}, {key.Edition} edition");
    Console.WriteLine($"Paid through {key.Expires}");
    Console.WriteLine($"Covers releases up to {key.MaintenanceUntil}");
}

State is one of None, Invalid, Evaluation, EvaluationExpired, Licensed, RenewalDue and Lapsed, the first seven rows of the table above. The eighth value, VersionGated, appears only on LicenseException.State, because no client is built in that case (see License problems). DaysRemaining counts the days left in an evaluation, in a paid term, or in the 30 days of a renewal due, and is 0 on the last day; it is empty in the other states. Payload is empty when there is no key or the key is not valid.

Turn a missing key into an error

FailWhenUnlicensed is off by default. When you turn it on, Build() throws a LicenseException with no key, a key that is not valid, or an ended evaluation, instead of logging. A renewal due and a lapsed key still build and log. Use it where you want a missing key to fail a pipeline or a deployment check.

var client = new IntentClientBuilder()
    .UseProvidersFromEnvironment()
    .Configure(options => options.FailWhenUnlicensed = true)
    .Build();   // throws LicenseException with no key, for example

With AddIntentSharp, set IntentSharp:Options:FailWhenUnlicensed to true; the host then fails to start in those cases.

What the check does not do

  • It makes no network call, and sends nothing to C2Consultants.
  • It does not count developers, machines or deployments. The number of developers in a key is for your records; your order sets what you may use.
  • It never stops a running process, and never fails a call.

The license still applies however the library behaves: removing or changing the license notices is a breach of the license. Licensing covers who needs a license.