{"record":{"id":"5a1023cb7381534f","repo":"cefsharp/CefSharp","slug":"converter","errorCode":null,"errorMessage":"converter","messagePattern":"converter","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"CefSharp/Internals/CefTimeUtils.cs","lineNumber":29,"sourceCode":"    /// </summary>\n    public static class CefTimeUtils\n    {\n        private static IBaseTimeConverter BaseTimeConverter = new BaseTimeConverter();\n\n        /// <summary>\n        /// Assign your own custom <see cref=\"IBaseTimeConverter\"/> converter\n        /// used to convert <see cref=\"DateTime\"/> to/from CefBaseTime\n        /// </summary>\n        /// <param name=\"converter\">converter</param>\n        /// <remarks>\n        /// Must be called in all processes for custom conversion of DateTime\n        /// used by the Sync Javascript Binding (.Net 4.x only)\n        /// </remarks>\n        public static void UseBaseTimeConveter(IBaseTimeConverter converter)\n        {\n            if (converter == null)\n            {\n                throw new ArgumentNullException(nameof(converter));\n            }\n\n            BaseTimeConverter = converter;\n        }\n\n        /// <summary>\n        /// Converts from CefBaseTime to DateTime?\n        /// </summary>\n        /// <param name=\"val\">\n        /// Represents a wall clock time in UTC. Values are not guaranteed to be monotonically\n        /// non-decreasing and are subject to large amounts of skew. Time is stored internally\n        /// as microseconds since the Windows epoch (1601).\n        /// </param>\n        /// <returns>if <paramref name=\"val\"/> is 0 then returns null otherwise returns a <see cref=\"DateTime\"/> of <see cref=\"DateTimeKind.Local\"/></returns>\n        public static DateTime? FromBaseTimeToNullableDateTime(long val)\n        {\n            if(val == 0)\n            {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/cefsharp/CefSharp/blob/16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec/CefSharp/Internals/CefTimeUtils.cs#L11-L47","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nCefTimeUtils.UseBaseTimeConveter(converter);\n\n// after\nif (converter == null) converter = new BaseTimeConverter();\nCefTimeUtils.UseBaseTimeConveter(converter);","handlingStrategy":"validation","validationCode":"if (converter == null)\n{\n    converter = new BaseTimeConverter();\n}\nCefTimeUtils.UseBaseTimeConveter(converter);","typeGuard":"static bool IsValidConverter(IBaseTimeConverter c) => c != null;","tryCatchPattern":null,"preventionTips":["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."],"tags":["validation","null-reference","datetime","configuration","cefsharp"],"backgroundTag":null,"analyzedSha":"16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec","analyzedAt":"2026-08-13T19:57:05.828Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}