dotnet/runtime · error · Error
Locale info for locale=
Error message
Locale info for locale=${localeName} is null or empty. What it means
Thrown by SystemJS_GetLocaleInfo in globalization-locale.ts when Intl.DisplayNames produced empty/undefined values for both LanguageName and RegionName, so the joined result (separated by ##) is empty. This means the ICU/display-names data could not produce any string for the requested locale. Like error 21 it is caught locally and forwarded to managed code as an error string without aborting.
Solutions
- Ship the full ICU data archive (icudt.dat) or the shard that covers the requested locale.
- Switch globalizationMode to All, or use a Custom ICU archive that covers the cultures you query.
- Validate the locale against navigator.languages / a known list before requesting display names.
Example fix
// before: only EFIGS shard shipped, querying ja-JP fails
// dotnet.native.js config: resources.icu = [{ name:'icudt_EFIGS.dat' }]
// after: ship full archive
resources.icu = [{ name:'icudt.dat' }] Defensive patterns
Strategy: validation
Validate before calling
// validate locale coverage before requesting display names
const supported = Intl.DisplayNames.supportedLocalesOf([localeName], { type: 'language' });
if (supported.length === 0) return; // ICU does not cover this locale Try / catch
// SystemJS_GetLocaleInfo already wraps the throw in try/catch and forwards the string. // On the managed side, inspect dstLength == -1 and fall back gracefully.
Prevention
- Ship an ICU archive that covers every locale your app queries.
- Use GlobalizationMode.All if you cannot predict locales at build time.
- Test locale queries against the actual shipped ICU shard.
When it happens
Trigger: Requesting display names for a locale the loaded ICU archive does not cover (e.g. a CJK locale loaded with the EFIGS shard); invariant or minimal globalization data shipped; a locale whose region part is invalid and the fallback also returns undefined.
Common situations: Using sharded ICU data (icudt_EFIGS.dat) and requesting a locale outside that shard; enabling invariant mode but still querying display names; mismatched applicationCulture and shipped ICU archive.
Related errors
- Locale or culture name is null or empty. localeName=
- Failed to initialize ICU data
- Failed to load ICU data
- invariant globalization mode is inactive and no ICU data…
- Locale info for locale=
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/49c97b2c0e403d69.
Report an issue: GitHub.
Appendix: source
Thrown at src/mono/browser/runtime/globalization-locale.ts:82
// handle non-standard or malformed locales by forwarding the locale code, e.g. "xx-u-xx"
stringToUTF16(dst, dst + 2 * localeNameOriginal.length, localeNameOriginal);
setI32(dstLength, localeNameOriginal.length);
return VoidPtrNull;
}
throw error;
}
} else {
throw error;
}
}
const localeInfo = {
LanguageName: languageName,
RegionName: regionName,
};
const result = Object.values(localeInfo).join(OUTER_SEPARATOR);
if (!result)
throw new Error(`Locale info for locale=${localeName} is null or empty.`);
if (result.length > dstMaxLength)
throw new Error(`Locale info for locale=${localeName} exceeds length of ${dstMaxLength}.`);
stringToUTF16(dst, dst + 2 * result.length, result);
setI32(dstLength, result.length);
return VoidPtrNull;
} catch (ex: any) {
setI32(dstLength, -1);
return stringToUTF16Ptr(ex.toString());
}
}
View on GitHub (pinned to 60108ba66e)