Documentation
Table of Contents

License problems

This page explains the LicenseException that Build() can throw and each license message in your logs, with what to do. What the library does with each kind of key is on License behaviour.

Build() throws LicenseException

Build() throws a LicenseException in two cases, and its State says which. With AddIntentSharp, the exception is thrown, unwrapped, while the host starts. A client that was built never throws it from a call.

try
{
    return new IntentClientBuilder()
        .UseProvidersFromEnvironment()
        .Build();
}
catch (LicenseException ex)
{
    // ex.State says why: VersionGated, or, when FailWhenUnlicensed is set,
    // None, Invalid or EvaluationExpired.
    // ex.Message says what is wrong and what to do.
    Console.Error.WriteLine($"IntentSharp license: {ex.State}. {ex.Message}");
    throw;
}

State is VersionGated. The message begins "This IntentSharp build" and names the release, its date, your license and its maintenance date. The release you installed is dated after the last release your paid key covers. Either install a release dated on or before your maintenance date (the changelog gives each release's date, and Upgrading shows how to pin it), or renew and use the renewed key.

State is None, Invalid or EvaluationExpired. This happens only when FailWhenUnlicensed is on, and the message ends "FailWhenUnlicensed is set, so the client was not built." Set a valid key (see Your license key), buy a license if the evaluation has ended, or turn FailWhenUnlicensed off where a run without a key is expected.

The license messages in your logs

Every license message has the event id 9100, named IntentSharp.License. Each one begins with the words below.

The message begins Level What it means What to do
"No IntentSharp license key is configured." Warning The client found no key in code, in configuration or in INTENTSHARP_LICENSE_KEY. Set your key, or see The logs say there is no key below.
"The configured IntentSharp license key is not valid:" Error The key was found but could not be read, or was not issued by C2Consultants. The rest of the message says which. See The key is not valid below.
"IntentSharp evaluation key for" Information A current evaluation key, with the days left. Buy before it ends.
"The IntentSharp evaluation for" Error The evaluation ended; the message says when. Buy a license.
"IntentSharp is licensed to" Information A current paid key, with its edition, paid-through date and maintenance date. Nothing.
"The paid term of the IntentSharp" Warning The paid term ended, and you are in the 30 days to renew. Renew. If you already have, see A renewed key is not used.
"The IntentSharp" followed by your edition and "has lapsed" Error More than 30 days have passed since the paid term ended. Renew, or keep to the releases your key covers.

Except for the no-key and not-valid messages, each message names the license id, which starts with lic_. Quote it when you write to us; you do not need to send the key.

The logs say there is no key

  • The key is in configuration, but the client is built with IntentClientBuilder. The builder does not read configuration. Pass the key to WithLicenseKey, or set INTENTSHARP_LICENSE_KEY.
  • The configuration section has another name. With AddIntentSharp(configuration, "MySection"), the key is MySection:Options:LicenseKey.
  • The environment variable is set somewhere the application does not see it, such as another shell or another user account. Set it in the environment the application runs in, and restart it.
  • The key was set after the client was built. The key is read once, when the client is built. Restart the application.

The key is not valid

  • The key was changed when it was copied. Copy it again from the email as one line, with nothing added: no quotes, spaces or line breaks inside it.
  • A placeholder is set in code or configuration, such as YOUR-LICENSE-KEY. A key set there is used even when it is not valid, so INTENTSHARP_LICENSE_KEY is ignored. Remove the placeholder.
  • It is still not valid. Write to licensing@c2consultants.net with the message and the license id from your email, and we will send a replacement.

A renewed key is not used

After a renewal, the logs keep showing the renewal reminder until the application builds its client with the new key. Put the new key everywhere the old one is set, then restart. The information line then shows the new dates.

No license message at all

The client logs through the logger factory you give it. Without one (no WithLoggerFactory, and not registered with AddIntentSharp in a host with logging), nothing is logged, license messages included. A current key logs at Information level only, so a filter set to Warning or above hides it; client.License still shows the state (see Check the license in your code).

Still stuck

Write to licensing@c2consultants.net with the message, the IntentSharp version and the license id.