dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.42k stars 4.76k forks source link

[wasm] unify Interop.GetHostName #107741

Open pavelsavara opened 2 months ago

pavelsavara commented 2 months ago

From comment

nit: it feels slightly wrong doing this special case in the Interop.GetHostName.cs managed binding layer, but calling into native code just for getting a constant string feels wrong too.

Btw. after looking at it some more I think we have an issue on Browser: we do use emscripten's gethostname() which returns the string emscripten and we just paper over it here: https://github.com/dotnet/runtime/blob/4cdbfdcca352e0f12e4829eb3fec638d717add51/src/libraries/System.Private.CoreLib/src/System/Environment.Browser.cs#L13-L15

But Interop.Sys.GetHostName() is used in more places and those would get the "wrong" hostname on Browser. I think I'd be in favor of unifying this and adding the special case for Browser here too.

dotnet-policy-service[bot] commented 2 months ago

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

dotnet-policy-service[bot] commented 2 months ago

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

pavelsavara commented 2 months ago

cc @akoeplinger