cefsharp/CefSharp · error · ArgumentNullException
converter
Error message
converter
What it means
Thrown by CefTimeUtils.UseBaseTimeConveter when the supplied IBaseTimeConverter is null. The static converter is used to translate between DateTime and CEF's CefBaseTime (microseconds since the 1601 Windows epoch); a null converter would cause NullReferenceExceptions later during DateTime conversions in JS binding, so it is rejected upfront. Note the method name is misspelled (Conveter) but is the documented public API.
Source
Thrown at CefSharp/Internals/CefTimeUtils.cs:29
/// </summary>
public static class CefTimeUtils
{
private static IBaseTimeConverter BaseTimeConverter = new BaseTimeConverter();
/// <summary>
/// Assign your own custom <see cref="IBaseTimeConverter"/> converter
/// used to convert <see cref="DateTime"/> to/from CefBaseTime
/// </summary>
/// <param name="converter">converter</param>
/// <remarks>
/// Must be called in all processes for custom conversion of DateTime
/// used by the Sync Javascript Binding (.Net 4.x only)
/// </remarks>
public static void UseBaseTimeConveter(IBaseTimeConverter converter)
{
if (converter == null)
{
throw new ArgumentNullException(nameof(converter));
}
BaseTimeConverter = converter;
}
/// <summary>
/// Converts from CefBaseTime to DateTime?
/// </summary>
/// <param name="val">
/// Represents a wall clock time in UTC. Values are not guaranteed to be monotonically
/// non-decreasing and are subject to large amounts of skew. Time is stored internally
/// as microseconds since the Windows epoch (1601).
/// </param>
/// <returns>if <paramref name="val"/> is 0 then returns null otherwise returns a <see cref="DateTime"/> of <see cref="DateTimeKind.Local"/></returns>
public static DateTime? FromBaseTimeToNullableDateTime(long val)
{
if(val == 0)
{View on GitHub (pinned to 16bc6e0711)
Solutions
- Pass a concrete IBaseTimeConverter implementation (or new BaseTimeConverter() for the default behavior).
- Verify the converter instance is non-null before the call, especially when resolved from a factory/DI container.
- Call UseBaseTimeConveter in every process (browser and renderer) if you rely on sync JS binding, per the API remarks.
Example fix
// before CefTimeUtils.UseBaseTimeConveter(converter); // after if (converter == null) converter = new BaseTimeConverter(); CefTimeUtils.UseBaseTimeConveter(converter);
Defensive patterns
Strategy: validation
Validate before calling
if (converter == null)
{
converter = new BaseTimeConverter();
}
CefTimeUtils.UseBaseTimeConveter(converter); Type guard
static bool IsValidConverter(IBaseTimeConverter c) => c != null;
Prevention
- Instantiate the converter explicitly before assigning it.
- Call UseBaseTimeConveter in all processes when using custom DateTime conversion for sync JS binding.
- Validate converter instances resolved from DI/factories.
When it happens
Trigger: Calling CefTimeUtils.UseBaseTimeConveter(null), or passing a converter variable that was not initialized. Must be called in all processes when customizing DateTime conversion for sync JS binding (.NET 4.x).
Common situations: Setting up a custom base-time converter for non-standard timezone/epoch handling in sync JS binding and forgetting to instantiate it; a DI/factory returning null; copy-paste that dropped the constructor argument.
Related errors
AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13).
Data as JSON: /api/errors/5a1023cb7381534f.
Report an issue: GitHub.