{"record":{"id":"df82cb13a72ce7ae","repo":"dotnet/runtime","slug":"locale-info-for-locale-localename-exceeds-lengt","errorCode":null,"errorMessage":"Locale info for locale=${localeName} exceeds length of ${dstMaxLength}.","messagePattern":"Locale info for locale=(.+?) exceeds length of (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/globalization-locale.ts","lineNumber":85,"sourceCode":"                        return VoidPtrNull;\n                    }\n                    throw error;\n                }\n            } else {\n                throw error;\n            }\n        }\n        const localeInfo = {\n            LanguageName: languageName,\n            RegionName: regionName,\n        };\n        const result = Object.values(localeInfo).join(OUTER_SEPARATOR);\n\n        if (!result)\n            throw new Error(`Locale info for locale=${localeName} is null or empty.`);\n\n        if (result.length > dstMaxLength)\n            throw new Error(`Locale info for locale=${localeName} exceeds length of ${dstMaxLength}.`);\n\n        stringToUTF16(dst, dst + 2 * result.length, result);\n        setI32(dstLength, result.length);\n        return VoidPtrNull;\n    } catch (ex: any) {\n        setI32(dstLength, -1);\n        return stringToUTF16Ptr(ex.toString());\n    }\n}\n","sourceCodeStart":67,"sourceCodeEnd":95,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/mono/browser/runtime/globalization-locale.ts#L67-L95","documentation":"Thrown by SystemJS_GetLocaleInfo when the resolved locale-info string (LanguageName##RegionName) is longer than the destination buffer (dstMaxLength) allocated by the .NET caller. The runtime refuses to truncate and instead surfaces a contract violation between the managed buffer size and the JS-produced string.","triggerScenarios":"Produced when the .NET-side caller passes a destination buffer whose dstMaxLength is smaller than the combined length of the resolved LanguageName and RegionName display strings, e.g. a culture whose localized names are very long (some languages produce long display names) being written into a short buffer.","commonSituations":"Hitting this typically means an internal version mismatch between the JS runtime and the managed marshaler that sizes the buffer, or a locale whose localized display-name forms are unexpectedly long. End-user code almost never triggers this directly; it surfaces during culture initialization.","solutions":["Update the .NET runtime WASM packages and the Microsoft.NET.Sdk.Web SDK to matching versions so the buffer sizing contract is consistent.","Use a culture whose display names are shorter, or a more standard culture tag, as a workaround during development.","If you maintain a custom host, ensure the managed buffer allocated for locale info is large enough (at least several hundred UTF-16 code units) for any culture you support."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the JS runtime and managed marshalers version-aligned (matching NuGet/SDK versions).","Avoid custom cultures with unusually long display names.","If forking the runtime, ensure the managed buffer for locale info is sized generously."],"tags":["globalization","icu","locale","buffer"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}