Skip to content

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Sep 26, 2025

On top of #119866
Just 763ab3c and after

This PR brings interesting question of which final JS module should contain string and memory helpers. They will be used mostly with JS interop, so they would belong to dotnet.runtime.js from that perspective. But this creates dependency arrow in wrong direction. From dotnet.native.js to dotnet.runtime.js, in the case we wanted to make JS interop optional. Adding them as untrimmable closure to dotnet.native.js would solve it.

This is the managed caller

private unsafe (string, string) JSGetLocaleInfo(string cultureName, string localeName)
{
ReadOnlySpan<char> cultureNameSpan = cultureName.AsSpan();
ReadOnlySpan<char> localeNameSpan = localeName.AsSpan();
fixed (char* pCultureName = &MemoryMarshal.GetReference(cultureNameSpan))
fixed (char* pLocaleName = &MemoryMarshal.GetReference(localeNameSpan))
{
char* buffer = stackalloc char[LOCALE_INFO_BUFFER_LEN];
nint exceptionPtr = Interop.JsGlobalization.GetLocaleInfo(pCultureName, cultureNameSpan.Length, pLocaleName, localeNameSpan.Length, buffer, LOCALE_INFO_BUFFER_LEN, out int resultLength);

And maybe we don't need SystemJS_GetLocaleInfo and JSGetNativeDisplayName at all @ilonatommy ?

cc @maraf

@pavelsavara pavelsavara added this to the 11.0.0 milestone Sep 26, 2025
@pavelsavara pavelsavara self-assigned this Sep 26, 2025
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Sep 26, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

import { InternalExchangeIndex } from "../types";

export { SystemJS_RandomBytes } from "./crypto";

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export { SystemJS_GetLocaleInfo } from "./globalization-locale";

@pavelsavara
Copy link
Member Author

I solved the problem in #119866

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-System.Globalization os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants