{"record":{"id":"e230fcc9a69116c8","repo":"lionsoul2014/ip2region","slug":"dbpath","errorCode":null,"errorMessage":"dbPath","messagePattern":"dbPath","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"binding/csharp/IP2Region.Net/XDB/Util.cs","lineNumber":40,"sourceCode":"        var address = IPAddress.Parse(ipAddress);\n        return IpAddressToUInt32(address);\n    }\n\n    public static uint IpAddressToUInt32(IPAddress ipAddress)\n    {\n        byte[] bytes = ipAddress.GetAddressBytes();\n        Array.Reverse(bytes);\n        return MemoryMarshal.Read<uint>(bytes);\n    }\n\n    public static uint GetMidIp(uint x, uint y)\n        => (x & y) + ((x ^ y) >> 1);\n\n    public static async Task<XdbVersion> GetVersionAsync(string dbPath, CancellationToken token = default)\n    {\n        if (string.IsNullOrEmpty(dbPath))\n        {\n            throw new ArgumentNullException(nameof(dbPath));\n        }\n\n        if (!File.Exists(dbPath))\n        {\n            throw new FileNotFoundException(\"xdb file not found.\", dbPath);\n        }\n\n        using var reader = File.OpenRead(dbPath);\n        return await GetVersionAsync(reader, token);\n    }\n\n    internal static async Task<XdbVersion> GetVersionAsync(FileStream reader, CancellationToken token = default)\n    {\n        XdbVersion ret = default;\n        var buffer = ArrayPool<byte>.Shared.Rent(256);\n\n        try\n        {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/csharp/IP2Region.Net/XDB/Util.cs#L22-L58","documentation":"Standard .NET ArgumentNullException thrown by GetVersionAsync when the dbPath argument is null or empty: a required argument guard, not a file or format problem. The named parameter identifies dbPath as the faulting input.","triggerScenarios":"Thrown at binding/csharp/IP2Region.Net/XDB/Util.cs:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-empty xdb file path to GetVersionAsync","Check configuration loading so the dbPath setting is never silently null","Guard callers with string.IsNullOrWhiteSpace before invoking the API"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1","analyzedAt":"2026-09-02T16:58:39.988Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}