Skip to content

Rewrite hostmisc C++ components to wrap C implementations#126367

Draft
Copilot wants to merge 38 commits intomainfrom
copilot/rewrite-apphost-in-c
Draft

Rewrite hostmisc C++ components to wrap C implementations#126367
Copilot wants to merge 38 commits intomainfrom
copilot/rewrite-apphost-in-c

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

Rewrites the corehost "hostmisc" and apphost components to expose C-compatible APIs and build more of the host stack from C sources. C++ wrappers are retained where needed (notably Windows PAL wrappers). The goal is to allow C entrypoints (apphost_main.c, fxr_resolver.c, etc.) to call into platform abstractions consistently across Windows and Unix.

Changes Made

  • C implementations: Introduces C implementations for trace, utils, fx_ver, and fxr_resolver, plus corresponding C-compatible headers embedded into existing headers via #ifdef __cplusplus.
  • PAL: Adds Windows C PAL wrapper implementations (pal.windows.c_impl.cpp) and a Unix C PAL implementation (pal.unix.c) for C consumers. pal_char_t typedef maps to wchar_t on Windows and char on non-Windows.
  • Combined headers: All _c.h variants inlined into their C++ counterparts (pal.h, trace.h, utils.h, fxr_resolver.h, bundle_marker.h, fx_ver.h); C++ surface area gated under #ifdef __cplusplus.
  • Entry points: Both standalone apphost (Windows and non-Windows) and singlefilehost now use apphost_main.c as the entry point. corehost.cpp moved to src/native/corehost/dotnet/dotnet.cpp and rebuilt only as the dotnet muxer.
  • Build wiring: hostmisc CMake targets link minipal via target_link_libraries rather than including source files directly. apphost_main.c and apphost_hostfxr_resolver.h moved to src/native/corehost/apphost/. dn-containers include directories moved into src/native/containers/CMakeLists.txt. minipal_objects added to libnethost and libhostfxr static library targets so that minipal mutex symbols are included in the shipped archives. The hostmisc_c OBJECT library (which contains fxr_resolver.c and depends on dn-vector.h/minipal) is skipped on the browser-wasm build, where only the C++ hostmisc library is consumed and dn-containers/minipal are not pulled in. The minipal link dependency on the C++ hostmisc target is also skipped on browser-wasm, since the browser corehost build does not add the minipal subdirectory (libminipal is supplied directly via NATIVE_LIBS for the browserhost link step).
  • Bug fixes (from code review):
    • Fixed _X macro in pal.h — uses #ifdef __cplusplus to select the right expansion strategy: single-step L ## s in C++ mode (required for MSVC non-conforming preprocessor compatibility with __FUNCTION__ in pal.windows.cpp) and two-step _X_HELPER(s) in C mode (required for MSVC C11 conforming preprocessor to expand macro arguments like HOST_VERSION before the L## paste in apphost_main.c).
    • Fixed off-by-one in utils_get_directory_alloc and utils_get_directorydir_len already includes the trailing separator; removed the extra separator write.
    • Fixed trace_error_writer_fn calling convention — typedef now uses __cdecl on Windows (gated under #ifdef _WIN32) and no annotation on non-Windows, ensuring type compatibility with hostfxr_error_writer_fn on all platforms including Windows x86 where calling conventions are distinct.
    • Fixed race condition in trace_ensure_lock_initialized using InitOnceExecuteOnce on Windows and pthread_once on non-Windows.
    • Added missing Windows-only includes (<locale.h>, <share.h>) to trace.c.
    • Fixed memory leak in get_latest_fxr — properly call c_fx_ver_cleanup on non-selected versions and on max_ver after use.
    • Fixed fxr_resolver search logic — else if (search_global) changed to if (dotnet_root == NULL && search_global) so global install is tried as a fallback when both env and global flags are set but no env var is found.
    • Fixed error message in apphost_main.c — removed reference to app_dll in the unbound-executable error path since app_dll is not yet populated at that point.
    • Fixed "64 bytes" comment in bundle_marker.c (the signature array is 32 bytes, matching SHA-256).
    • Fixed MSVC C4210 error — moved extern void apphost_static_init(void) declaration to file scope in apphost_main.c to avoid the "nonstandard extension used: function given file scope" warning treated as error under /std:c11.
    • Consolidated the TEST_ONLY_MARKER embedded byte sequence into a single is_test_only_enabled() helper in utils.c. Both the C++ test_only_getenv (in utils.cpp) and the C test_only_getenv (in pal.unix.c) now delegate to it. Previously the marker was embedded twice in the shipped Unix binaries (once per translation unit), and BinaryUtils.SearchAndReplace only flips the first occurrence found by KMP search, leaving the second copy stale. This caused TestOnlyProductBehavior.Enable to leave behavior partially enabled across tests, producing failures like "The backup directory …/.libhostfxr.backup already exists" in FrameworkResolutionError_ListOtherArchitectures and other "test only product behavior" tests on Linux/macOS.
    • Fixed CoreCLR browser-wasm build failures: gated the hostmisc_c target on non-browser builds, and skipped the target_link_libraries(... minipal) call on browser-wasm in hostmisc/CMakeLists.txt (the browser corehost build does not add the minipal CMake subdirectory, so referencing the minipal target broke the browserhost link step).

Testing

  • Build system changes validated against the existing CMake structure.
  • Logic changes follow the same patterns as the existing C++ implementations they replace.
  • Verified that each shipped Unix binary (libhostfxr.so/.a, libnethost.so/.a, apphost, dotnet) now contains exactly one copy of the test-only marker (was two before the consolidation).

Copilot AI and others added 10 commits March 27, 2026 05:20
Create C source files for apphost that replace the C++ implementation:
- apphost_main.c: main entry point
- apphost_pal.c/h: platform abstraction layer (Unix)
- apphost_trace.c/h: tracing system
- apphost_utils.c/h: utility functions
- apphost_fx_ver.c/h: semantic version parsing
- apphost_fxr_resolver.c/h: hostfxr path resolution
- apphost_bundle_marker.c/h: bundle detection
- apphost_hostfxr_resolver.c/h: hostfxr loading

Uses dn-vector from src/native/containers for collections.
Windows builds retain existing C++ sources.

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/2c33d365-8b70-4325-8eee-7f004ba86639

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
- Add stddef.h includes for size_t in headers
- Fix HAVE_DIRENT_D_TYPE guard to use config.h
- Fix dn_vector_at calls to pass element size
- Add test_only_getenv for test install location overrides
- Add test overrides in pal_get_dotnet_self_registered_dir and pal_get_default_installation_dir
- Add ctype.h include for tolower

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/2c33d365-8b70-4325-8eee-7f004ba86639

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
- Remove dead code block (always-false DIR_SEPARATOR check) in apphost_main.c
- Remove unused free_string_entry function in apphost_fxr_resolver.c
- Add explicit errno.h include in apphost_pal.c

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/2c33d365-8b70-4325-8eee-7f004ba86639

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Move C source files from apphost/standalone/ to hostmisc/:
- apphost_trace.c/h, apphost_pal.c/h, apphost_utils.c/h
- apphost_fx_ver.c/h, apphost_fxr_resolver.c/h, apphost_bundle_marker.c/h

Create hostmisc_c OBJECT library target in hostmisc/CMakeLists.txt
with proper include directories and dependencies.

Update apphost/standalone/CMakeLists.txt to use hostmisc_c and
dn-containers CMake targets instead of compiling C files directly.

Add dn-containers subdirectory to corehost and singlefilehost builds
for non-Windows platforms.

Update apphost_fxr_resolver.c to use <dn-vector.h> include path
consistent with the dn-containers CMake target.

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6be87a85-902f-4646-92e6-2fb6783a5f57

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Rewrite bundle_marker.h as a C++ wrapper around the C implementation
in apphost_bundle_marker.c. Add extern "C" guards to
apphost_bundle_marker.h for C++ compatibility.

Remove bundle_marker.cpp since the C implementation in hostmisc_c
(apphost_bundle_marker.c) is now the single source of truth.

Update standalone/CMakeLists.txt and static/CMakeLists.txt to use
apphost_bundle_marker.c instead of the removed bundle_marker.cpp.

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/65fd3a5e-99f8-4acc-830f-644976f2cfb1

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
…mutex

- Removed trace.cpp (C++ implementation)
- Updated apphost_trace.h: Added pal_char_t typedef (wchar_t on Windows,
  char on Unix), extern C guards, va_list function variants
- Updated apphost_trace.c: Added Windows support (wide chars, OutputDebugStringW,
  WriteConsoleW), replaced spinlock with minipal mutex, added _v versions
  of variadic functions for C++ forwarding
- Updated trace.h: Now a thin C++ wrapper calling C functions via va_list
- Updated CMakeLists.txt: Use apphost_trace.c instead of trace.cpp, add
  minipal/mutex.c to both hostmisc and hostmisc_c"

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/2c57cab1-6ebb-4ab7-bbbf-38835b4336b3

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Inline the getenv and xtoi helpers directly in apphost_trace.c
to avoid depending on apphost_pal.c which is only in hostmisc_c."

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/2c57cab1-6ebb-4ab7-bbbf-38835b4336b3

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
- trace_error_v: Copy va_list before any consumption to avoid
  using a consumed va_list (undefined behavior per C11 §7.16.1)
- trace_warning: Delegate to trace_warning_v instead of duplicating
  the implementation inline

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/2c57cab1-6ebb-4ab7-bbbf-38835b4336b3

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
- fx_ver.cpp: Rewrite to delegate to apphost_fx_ver.c for parse(),
  compare(), and as_str() operations. Handles char/wchar_t conversion
  for Windows compatibility.
- utils.cpp: On non-Windows, delegate get_current_arch_name(),
  get_runtime_id(), get_host_version_description(), and
  get_dotnet_root_env_var_for_arch() to apphost_utils.c.
- apphost_fx_ver.h: Add extern "C" guards, rename to c_fx_ver_t to
  avoid collision with C++ fx_ver_t struct.
- apphost_utils.h: Add extern "C" guards, guard macros with #ifndef
  to avoid conflicts with utils.h.
- apphost_pal.h: Add extern "C" guards.
- CMakeLists.txt: Add apphost_fx_ver.c to all platforms, add
  apphost_pal.c and apphost_utils.c on non-Windows.

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/15a555ca-6237-4c3e-9a6a-93b3c993d1e9

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
- Revert get_dotnet_root_env_var_for_arch to C++ implementation
  since the C version ignores the arch parameter
- Replace 'auto' with explicit 'pal::char_t' in palstr_to_narrow

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/15a555ca-6237-4c3e-9a6a-93b3c993d1e9

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
@elinor-fung

This comment was marked as resolved.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung
See info in area-owners.md if you want to be subscribed.

Rename all hostmisc C files per review feedback:
- apphost_trace.c → trace.c, apphost_trace.h → trace_c.h
- apphost_fx_ver.c → fx_ver.c, apphost_fx_ver.h → fx_ver_c.h
- apphost_pal.c → pal.c, apphost_pal.h → pal_c.h
- apphost_utils.c → utils.c, apphost_utils.h → utils_c.h
- apphost_fxr_resolver.c → fxr_resolver.c, apphost_fxr_resolver.h → fxr_resolver_c.h
- apphost_bundle_marker.c → bundle_marker.c, apphost_bundle_marker.h → bundle_marker_c.h

Update all #include directives, CMakeLists.txt references, header guards,
and comments to use the new names.

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/869a7b2a-c34a-4b37-ab96-28caca72225e

Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot rename the hostmisc C files prefixed with apphost_ to drop the apphost_ prefix. They should be .c versions living next to their corresponding .cpp files. For the header files, they can ha...

Done in 7b1a73c. Renamed all hostmisc C files to drop the apphost_ prefix (e.g., apphost_trace.ctrace.c) and headers to use _c suffix (e.g., apphost_trace.htrace_c.h). Updated all #include directives, CMakeLists.txt references, and header guards.

Comment thread src/native/corehost/hostmisc/pal.c Outdated
Move the pal_char_t typedef from trace_c.h to pal_c.h as the canonical
location. Define it cross-platform (wchar_t on Windows, char on non-Windows)
with #ifndef guards to avoid redefinition conflicts with pal.h (C++ PAL).

Update function signatures in pal_c.h, pal.c, utils_c.h, and utils.c to
use pal_char_t instead of raw char for platform string parameters.

Make trace_c.h include pal_c.h for the typedef instead of defining it
locally. Restructure pal_c.h to be includable on all platforms (cross-
platform types at top, POSIX-specific parts guarded with #if !defined(_WIN32)).

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/88526fd5-afd6-42dc-b551-5b6cd904b449

Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Comment thread src/native/corehost/apphost/standalone/apphost_hostfxr_resolver.h Outdated
Change hostfxr_resolver_t struct to use char* instead of char[4096].
Change fxr_resolver_try_get_path API to return malloc'd strings via char**
instead of writing to fixed-size caller-provided buffers.
Convert local path buffers in apphost_main.c and fxr_resolver.c to use
malloc/free instead of stack-allocated fixed arrays.
Add utils_file_exists_in_dir_alloc and utils_get_directory_alloc helpers
that return dynamically allocated strings.

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/84b0096a-a181-477e-a6b7-04df74e9919c

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 20, 2026 21:34
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 20, 2026

@copilot please fix the following failure:

FAILED: [code=2] Corehost.Static/CMakeFiles/singlefilehost.dir/D_/a/_work/1/s/src/native/corehost/apphost/apphost_main.c.obj
...

Fixed in b14e833.

The root cause: MSVC enables its conforming C preprocessor when compiling with /std:c11, which suppresses macro argument expansion before ##. So _X(HOST_VERSION)L ## HOST_VERSIONLHOST_VERSION (an invalid identifier instead of a wide string literal).

The fix splits _X by compilation mode in the Windows branch:

  • C++ mode (#ifdef __cplusplus): keeps the original single-step L ## s, which is needed for _STRINGIFY(__FUNCTION__) in pal.windows.cpp to produce the correct L__FUNCTION__ token.
  • C mode (else): uses a two-step _X_HELPER(s) pattern so macro arguments like HOST_VERSION are fully expanded before L## is applied, producing L"0.0.0-dev" correctly under the conforming preprocessor.

@elinor-fung
Copy link
Copy Markdown
Member

@copilot fix the build errors

On Windows:

FAILED: [code=2] Corehost.Static/CMakeFiles/singlefilehost.dir/D_/a/_work/1/s/src/native/corehost/apphost/apphost_main.c.obj 
  C:\PROGRA~1\MICROS~1\18\ENTERP~1\VC\Tools\MSVC\1450~1.357\bin\Hostx64\x64\cl.exe  /nologo -DCORECLR_EMBEDDED -DFEATURE_APPHOST=1 -DFEATURE_STATICALLY_LINKED -DFEATURE_STATIC_HOST=1 -DHOST_64BIT -DHOST_AMD64 -DHOST_WINDOWS -DNATIVE_LIBS_EMBEDDED -DNDEBUG -DRAPIDJSON_HAS_CXX17 -DTARGET_64BIT -DTARGET_AMD64 -DTARGET_WINDOWS -DUNICODE -DURTBLDENV_FRIENDLY=Retail -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Dsinglefilehost_EXPORTS -ID:\a\_work\1\s\src\native -ID:\a\_work\1\s\src\native\inc -ID:\a\_work\1\s\src\native\corehost\apphost\static\.. -ID:\a\_work\1\s\src\native\corehost\apphost\static\..\.. -ID:\a\_work\1\s\src\native\corehost\apphost\static\..\..\hostmisc -ID:\a\_work\1\s\src\native\corehost\apphost\static\..\..\json -ID:\a\_work\1\s\src\native\libs\System.IO.Compression.Native -ID:\a\_work\1\s\src\native\libs\Common -ID:\a\_work\1\s\artifacts\obj -ID:\a\_work\1\s\src\native\external -ID:\a\_work\1\s\src\native\corehost\fxr\..\json -ID:\a\_work\1\s\src\native\corehost\fxr\..\fxr -ID:\a\_work\1\s\src\native\corehost\hostpolicy\..\fxr -ID:\a\_work\1\s\src\native\corehost\hostpolicy\..\json -ID:\a\_work\1\s\src\native\corehost\hostcommon\..\fxr -ID:\a\_work\1\s\src\coreclr\debug\datadescriptor-shared\inc -ID:\a\_work\1\s\src\native\external\brotli\c\include -ID:\a\_work\1\s\src\native\external\zstd\build\cmake\..\..\lib -ID:\a\_work\1\s\artifacts\obj\coreclr\windows.x64.Release\_deps\fetchzlibng-build -ID:\a\_work\1\s\src\native\external\zlib-ng -ID:\a\_work\1\s\artifacts\obj\coreclr\windows.x64.Release\Corehost.Static\hostmisc -ID:\a\_work\1\s\src\native\corehost\hostmisc -ID:\a\_work\1\s\artifacts\obj\coreclr\windows.x64.Release\inc\corehost /DWIN32 /D_WINDOWS /O2 /Ob2 /DNDEBUG -std:c11 -MT -Zi /GL /Ox /nologo /W4 /WX /sdl /Oi /Oy- /Gm- /Zp8 /Gy /fp:precise /FC /MP /Zm200 /Zc:strictStrings /Zc:wchar_t /Zc:inline /Zc:forScope /wd4065 /wd4100 /wd4127 /wd4131 /wd4189 /wd4200 /wd4201 /wd4206 /wd4239 /wd4245 /wd4291 /wd4310 /wd4324 /wd4366 /wd4456 /wd4457 /wd4458 /wd4459 /wd4463 /wd4505 /wd4702 /wd4706 /wd4733 /wd4815 /wd4838 /wd4918 /wd4960 /wd4961 /wd5105 /wd5205 /we4007 /we4013 /we4102 /we4551 /we4640 /we4806 /we4018 /we4055 /we4242 /we4244 /we4267 /we4302 /we4509 /we4510 /we4610 /we4611 /we4701 /w34092 /w34121 /w34125 /w34130 /w34132 /w34212 /w34530 /w35038 /w44177 /ZH:SHA_256 /source-charset:utf-8 /guard:cf /guard:ehcont /showIncludes /FoCorehost.Static\CMakeFiles\singlefilehost.dir\D_\a\_work\1\s\src\native\corehost\apphost\apphost_main.c.obj /FdCorehost.Static\CMakeFiles\singlefilehost.dir\ /FS -c D:\a\_work\1\s\src\native\corehost\apphost\apphost_main.c
  D:\a\_work\1\s\src\native\corehost\apphost\apphost_main.c(158): error C2220: the following warning is treated as an error
  D:\a\_work\1\s\src\native\corehost\apphost\apphost_main.c(158): warning C4210: nonstandard extension used: function given file scope

And osx-arm64:

  Undefined symbols for architecture arm64:
    "_minipal_mutex_enter", referenced from:
        _trace_lock_acquire in libnethost.a[2](trace.c.o)
    "_minipal_mutex_init", referenced from:
        _trace_init_lock in libnethost.a[2](trace.c.o)
    "_minipal_mutex_leave", referenced from:
        _trace_lock_release in libnethost.a[2](trace.c.o)
  ld: symbol(s) not found for architecture arm64
##[error]clang(0,0): error : (NETCORE_ENGINEERING_TELEMETRY=Build) linker command failed with exit code 1 (use -v to see invocation)
clang : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/runner/work/1/s/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj]
##[error].packages/dnne/2.0.5/build/DNNE.targets(184,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command ""/usr/bin/clang" -g -O0 -shared -fpic -D DNNE_ASSEMBLY_NAME=Microsoft.Interop.Tests.NativeExports -D DNNE_COMPILE_AS_SOURCE -I "/Users/runner/work/1/s/.packages/dnne/2.0.5/tools/platform" -I "/Users/runner/work/1/s/artifacts/bin/osx-arm64.Debug/corehost" -o "/Users/runner/work/1/s/artifacts/obj/NativeExports/Debug/net11.0/osx-arm64/dnne/bin/Microsoft.Interop.Tests.NativeExportsNE.dylib" -isysroot "/Applications/Xcode_16.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk" -target arm64-apple-macos14.0 "/Users/runner/work/1/s/artifacts/obj/NativeExports/Debug/net11.0/osx-arm64/dnne/Microsoft.Interop.Tests.NativeExports.g.c" "/Users/runner/work/1/s/.packages/dnne/2.0.5/tools/platform/platform.c" -lstdc++ "/Users/runner/work/1/s/artifacts/bin/osx-arm64.Debug/corehost/libnethost.a" -target arm64-apple-macos14.0 " exited with code 1.
/Users/runner/work/1/s/.packages/dnne/2.0.5/build/DNNE.targets(184,5): error MSB3073: The command ""/usr/bin/clang" -g -O0 -shared -fpic -D DNNE_ASSEMBLY_NAME=Microsoft.Interop.Tests.NativeExports -D DNNE_COMPILE_AS_SOURCE -I "/Users/runner/work/1/s/.packages/dnne/2.0.5/tools/platform" -I "/Users/runner/work/1/s/artifacts/bin/osx-arm64.Debug/corehost" -o "/Users/runner/work/1/s/artifacts/obj/NativeExports/Debug/net11.0/osx-arm64/dnne/bin/Microsoft.Interop.Tests.NativeExportsNE.dylib" -isysroot "/Applications/Xcode_16.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk" -target arm64-apple-macos14.0 "/Users/runner/work/1/s/artifacts/obj/NativeExports/Debug/net11.0/osx-arm64/dnne/Microsoft.Interop.Tests.NativeExports.g.c" "/Users/runner/work/1/s/.packages/dnne/2.0.5/tools/platform/platform.c" -lstdc++ "/Users/runner/work/1/s/artifacts/bin/osx-arm64.Debug/corehost/libnethost.a" -target arm64-apple-macos14.0 " exited with code 1. [/Users/runner/work/1/s/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj]

- Move extern void apphost_static_init(void) to file scope to fix MSVC C4210
  warning treated as error (nonstandard function declaration in block scope)
- Add minipal_objects to libnethost and libhostfxr link libraries so that
  minipal mutex symbols are included in the shipped static library archives

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c10177cd-ead8-4be3-9190-52ceb27856e9

Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 24, 2026 18:10
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 24, 2026

@copilot fix the build errors

On Windows:
...

Fixed in 919d9a4:

  1. Windows C4210 (nonstandard extension used: function given file scope): Moved extern void apphost_static_init(void); from inside exe_start() to file scope in apphost_main.c, guarded by #if defined(FEATURE_STATIC_HOST). MSVC with /we4210 (warning-as-error) rejects function declarations at block scope.

  2. macOS ARM64 missing minipal_mutex_*: Added minipal_objects to libnethost and libhostfxr link libraries. When hostmisc_public (an OBJECT library) links minipal_objects (another OBJECT library) via PUBLIC, CMake doesn't automatically include those objects in STATIC library archives that depend on hostmisc_public. Explicitly linking minipal_objects into libnethost and libhostfxr ensures the mutex symbols are included.

@jkoritzinsky
Copy link
Copy Markdown
Member

@copilot please fix the following error from win-x86 (likely due to differing calling convention):

FAILED: [code=2] Corehost.Static/CMakeFiles/singlefilehost.dir/D_/a/work/1/s/src/native/corehost/fxr/hostfxr.cpp.obj
C:\PROGRA1\MICROS1\18\ENTERP1\VC\Tools\MSVC\14501.357\bin\Hostx64\x86\cl.exe /nologo /TP -DBUILDENV_CHECKED=1 -DCORECLR_EMBEDDED -DDEBUG -DFEATURE_APPHOST=1 -DFEATURE_STATICALLY_LINKED -DFEATURE_STATIC_HOST=1 -DHOST_WINDOWS -DHOST_X86 -DNATIVE_LIBS_EMBEDDED -DRAPIDJSON_HAS_CXX17 -DTARGET_32BIT -DTARGET_WINDOWS -DTARGET_X86 -DUNICODE -DURTBLDENV_FRIENDLY=Checked -D_DBG -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Dsinglefilehost_EXPORTS -ID:\a_work\1\s\src\native -ID:\a_work\1\s\src\native\inc -ID:\a_work\1\s\src\native\corehost\apphost\static.. -ID:\a_work\1\s\src\native\corehost\apphost\static.... -ID:\a_work\1\s\src\native\corehost\apphost\static....\hostmisc -ID:\a_work\1\s\src\native\corehost\apphost\static....\json -ID:\a_work\1\s\src\native\libs\System.IO.Compression.Native -ID:\a_work\1\s\src\native\libs\Common -ID:\a_work\1\s\artifacts\obj -ID:\a_work\1\s\src\native\external -ID:\a_work\1\s\src\native\corehost\fxr..\json -ID:\a_work\1\s\src\native\corehost\fxr..\fxr -ID:\a_work\1\s\src\native\corehost\hostpolicy..\fxr -ID:\a_work\1\s\src\native\corehost\hostpolicy..\json -ID:\a_work\1\s\src\native\corehost\hostcommon..\fxr -ID:\a_work\1\s\src\coreclr\debug\datadescriptor-shared\inc -ID:\a_work\1\s\src\native\external\brotli\c\include -ID:\a_work\1\s\src\native\external\zstd\build\cmake....\lib -ID:\a_work\1\s\artifacts\obj\coreclr\windows.x86.Checked_deps\fetchzlibng-build -ID:\a_work\1\s\src\native\external\zlib-ng -ID:\a_work\1\s\artifacts\obj\coreclr\windows.x86.Checked\Corehost.Static\hostmisc -ID:\a_work\1\s\src\native\corehost\hostmisc -ID:\a_work\1\s\artifacts\obj\coreclr\windows.x86.Checked\inc\corehost /DWIN32 /D_WINDOWS /GR- -std:c++17 -MTd -Zi /O2 /EHsc /nologo /W4 /WX /sdl /Oi /Oy- /Gm- /Zp8 /Gy /fp:precise /FC /MP /Zm200 /Zc:strictStrings /Zc:wchar_t /Zc:inline /Zc:forScope /wd4065 /wd4100 /wd4127 /wd4131 /wd4189 /wd4200 /wd4201 /wd4206 /wd4239 /wd4245 /wd4291 /wd4310 /wd4324 /wd4366 /wd4456 /wd4457 /wd4458 /wd4459 /wd4463 /wd4505 /wd4702 /wd4706 /wd4733 /wd4815 /wd4838 /wd4918 /wd4960 /wd4961 /wd5105 /wd5205 /we4007 /we4013 /we4102 /we4551 /we4640 /we4806 /we4018 /we4055 /we4242 /we4244 /we4267 /we4302 /we4509 /we4510 /we4610 /we4611 /we4701 /w34092 /w34121 /w34125 /w34130 /w34132 /w34212 /w34530 /w35038 /w44177 /ZH:SHA_256 /source-charset:utf-8 /Gz /guard:cf /showIncludes /FoCorehost.Static\CMakeFiles\singlefilehost.dir\D
\a_work\1\s\src\native\corehost\fxr\hostfxr.cpp.obj /FdCorehost.Static\CMakeFiles\singlefilehost.dir\ /FS -c D:\a_work\1\s\src\native\corehost\fxr\hostfxr.cpp
D:\a_work\1\s\src\native\corehost\fxr\hostfxr.cpp(553): error C2664: 'trace::error_writer_fn trace::set_error_writer(trace::error_writer_fn)': cannot convert argument 1 from 'hostfxr_error_writer_fn' to 'trace::error_writer_fn'
D:\a_work\1\s\src\native\corehost\fxr\hostfxr.cpp(553): note: This conversion requires a reinterpret_cast, a C-style cast or parenthesized function-style cast
D:\a_work\1\s\src\native\corehost\hostmisc\trace.h(111): note: see declaration of 'trace::set_error_writer'
D:\a_work\1\s\src\native\corehost\fxr\hostfxr.cpp(553): note: while trying to match the argument list '(hostfxr_error_writer_fn)'

Also fix this error that is only present on browser-wasm builds

FAILED: [code=1] hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o
D:\a_work\1\s\src\mono\browser\emsdk\emscripten\emcc.bat -DCOMPILER_SUPPORTS_W_RESERVED_IDENTIFIER -DDISABLE_CONTRACTS -DFALLBACK_OS_IS_SAME_AS_TARGET_OS -DHOST_32BIT=1 -DHOST_BROWSER -DHOST_UNIX -DHOST_WASM -DNDEBUG -DTARGET_32BIT -DTARGET_BROWSER -DTARGET_UNIX -DTARGET_WASM -DTARGET_WASM32 -DURTBLDENV_FRIENDLY=Retail -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -ID:/a/_work/1/s/artifacts/obj/browser-wasm.Release/corehost/hostmisc -ID:/a/_work/1/s/src/native/corehost/hostmisc -ID:/a/_work/1/s/artifacts/obj/browser-wasm.Release/corehost -ID:/a/_work/1/s/src/native/corehost -ID:/a/_work/1/s/artifacts/obj -ID:/a/_work/1/s/src/native -O3 -DNDEBUG -std=gnu11 -fwasm-exceptions -mbulk-memory -msimd128 -O3 -Wall -Wno-null-conversion -glldb -Wno-unused-parameter -Wno-alloca -Wno-implicit-int-float-conversion -fno-omit-frame-pointer -fno-strict-overflow -fno-strict-aliasing -Werror -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-tautological-compare -Wno-unknown-pragmas -Wimplicit-fallthrough -Wno-unused-but-set-variable -ffp-contract=off -Wno-unknown-warning-option -ferror-limit=4096 -Wno-unused-private-field -Wno-constant-logical-operand -Wno-pragma-pack -Wno-incompatible-ms-struct -Wno-reserved-identifier -Wno-unsafe-buffer-usage -Wno-single-bit-bitfield-constant-conversion -Wno-cast-function-type-strict -Wno-switch-default -fsigned-char -fvisibility=hidden -ffunction-sections -MD -MT hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o -MF hostmisc\CMakeFiles\hostmisc_c.dir\fxr_resolver.c.o.d -o hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o -c D:/a/_work/1/s/src/native/corehost/hostmisc/fxr_resolver.c
D:/a/_work/1/s/src/native/corehost/hostmisc/fxr_resolver.c:9:10: fatal error: 'dn-vector.h' file not found
9 | #include <dn-vector.h>
| ^~~~~~~~~~~~~
1 error generated.

…riter_fn on Windows

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/efbd098c-d9b7-4fcd-80c9-13feacccdbb6

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 24, 2026 21:29
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 24, 2026

@copilot please fix the following error from win-x86 (likely due to differing calling convention):

FAILED: [code=2] Corehost.Static/CMakeFiles/singlefilehost.dir/D_/a/_work/1/s/src/native/corehos...

Fixed in f5b55d9. On Windows x86, hostfxr_error_writer_fn is void(__cdecl*) but trace_error_writer_fn had no calling convention annotation, making them incompatible types. Added __cdecl back to trace_error_writer_fn on Windows (guarded by #ifdef _WIN32) — __cdecl is a built-in MSVC compiler keyword available in both C and C++ mode so this works for C consumers too.

@jkoritzinsky
Copy link
Copy Markdown
Member

@copilot the tests that use the "test only product behavior" on linux and mac are failing with The backup directory /datadisks/disk1/work/A191093B/w/AC9F094F/e/test_artifacts/2i2lvf0s.d35/HostCommands/exe/host/fxr/11.0.0-ci/.libhostfxr.backup` already exists.

For example, Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.FrameworkResolution.FrameworkResolutionError_ListOtherArchitectures is one such test. Please confirm if these failures are due to this PR and fix the failures if that is the case.

Copilot AI review requested due to automatic review settings April 27, 2026 21:25
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot the tests that use the "test only product behavior" on linux and mac are failing with The backup directory /datadisks/disk1/work/A191093B/w/AC9F094F/e/test_artifacts/2i2lvf0...

Confirmed — these failures are caused by this PR. Fixed in b3c62e3.

Root cause: the new pal.unix.c introduced a second static test_only_getenv with its own embedded TEST_ONLY_MARKER, in addition to the one in utils.cpp. So Linux/macOS binaries shipped with two copies of the marker. BinaryUtils.SearchAndReplace only flips the first occurrence found by KMP search, leaving the other stale at 'd'. As a result, depending on which copy a given test_only_getenv call landed in, the runtime would still behave as if test-only mode was disabled, breaking the TestOnlyProductBehavior lifecycle and surfacing as the "backup directory already exists" error on the next test run.

Fix: introduced a single is_test_only_enabled() in utils.c that owns the embedded marker, and made both test_only_getenv implementations delegate to it. Verified each shipped binary (libhostfxr.so/.a, libnethost.so/.a, apphost, dotnet) now contains exactly one copy of the marker (was two on Unix before this fix).

@jkoritzinsky
Copy link
Copy Markdown
Member

@copilot please fix the following error in the CoreCLR browser-wasm build:

FAILED: hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o
/__w/1/s/src/mono/browser/emsdk/emscripten/emcc -DCOMPILER_SUPPORTS_W_RESERVED_IDENTIFIER -DDISABLE_CONTRACTS -DHOST_32BIT=1 -DHOST_BROWSER -DHOST_UNIX -DHOST_WASM -DNDEBUG -DTARGET_32BIT -DTARGET_BROWSER -DTARGET_UNIX -DTARGET_WASM -DTARGET_WASM32 -DURTBLDENV_FRIENDLY=Retail -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -I/__w/1/s/artifacts/obj/browser-wasm.Release/hostmisc -I/__w/1/s/src/native/corehost/hostmisc -I/__w/1/s/artifacts/obj/browser-wasm.Release -I/__w/1/s/src/native/corehost -I/__w/1/s/artifacts/obj -I/__w/1/s/src/native -O3 -DNDEBUG -std=gnu11 -fwasm-exceptions -mbulk-memory -msimd128 -O3 -Wall -Wno-null-conversion -glldb -Wno-unused-parameter -Wno-alloca -Wno-implicit-int-float-conversion -fno-omit-frame-pointer -fno-strict-overflow -fno-strict-aliasing -Werror -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-tautological-compare -Wno-unknown-pragmas -Wimplicit-fallthrough -Wno-unused-but-set-variable -ffp-contract=off -Wno-unknown-warning-option -ferror-limit=4096 -Wno-unused-private-field -Wno-constant-logical-operand -Wno-pragma-pack -Wno-incompatible-ms-struct -Wno-reserved-identifier -Wno-unsafe-buffer-usage -Wno-single-bit-bitfield-constant-conversion -Wno-cast-function-type-strict -Wno-switch-default -fsigned-char -fvisibility=hidden -ffunction-sections -MD -MT hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o -MF hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o.d -o hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o -c /__w/1/s/src/native/corehost/hostmisc/fxr_resolver.c
/__w/1/s/src/native/corehost/hostmisc/fxr_resolver.c:9:10: fatal error: 'dn-vector.h' file not found
9 | #include <dn-vector.h>
| ^~~~~~~~~~~~~

… available there

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/460f8e93-e56e-42d8-87f0-2647308d061e

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

@copilot please fix the following error in the CoreCLR browser-wasm build:

FAILED: hostmisc/CMakeFiles/hostmisc_c.dir/fxr_resolver.c.o
...

Fixed in 234bc43. BrowserHost-Static only consumes the C++ hostmisc library, and the browser corehost build does not pull in dn-containers/minipal (those add_subdirectory calls are gated under if(NOT CLR_CMAKE_TARGET_BROWSER) in corehost/CMakeLists.txt). Wrapped the entire hostmisc_c definition (including fxr_resolver.c) in if(NOT CLR_CMAKE_TARGET_BROWSER) so it is only built for non-browser targets.

@am11
Copy link
Copy Markdown
Member

am11 commented Apr 28, 2026

Test failure:

[+1184/x0/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.LoadAssembly.ComponentContext_Bytes(loadSymbolBytes: False) (1m 38s)

failed HostActivation.Tests.InstallLocation.SearchOptions_Precedence(expectedResult: EnvironmentVariable) (219ms)
  **WARNING** failure message 'The command error output did not contain expected result: 'Using environment variable DOTNET_ROOT=[/private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/env] as runtime location.'
  File Name: /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/HelloWorld
  Arguments:
  Environment:
    DOTNET_CreateDumpDiagnostics = 1
    DOTNET_CLI_HOME = /tmp/helix/working/AFD809A9/w/A3300916/e/.dotnet
    DOTNET_CreateDumpVerboseDiagnostics = 1
    DOTNET_DbgMiniDumpType = 4
    DOTNET_DbgMiniDumpName = /private/tmp/helix/working/AFD809A9/w/A3300916/e/HostActivation.Tests_%p_crash.dmp
    DOTNET_ROOT = /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/env
    DOTNET_CLI_TELEMETRY_OPTOUT = 1
    DOTNET_DbgEnableMiniDump = 1
    DOTNET_ROOT_ARM64 =
    DOTNET_ROOT(x86) = /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/env
    DOTNET_HOST_TRACE = 1
  Exit Code: 0x83
  StdOut:
  
  StdErr:
  Tracing enabled
  --- Invoked apphost [version: 11.0.0-ci @Commit: c948b592279254b6654c02340f951edf720ac30d] main = {
  /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/HelloWorld
  }
  The managed DLL bound to this executable is: 'HelloWorld.dll'
  Embedded app-relative .NET path: 'rel'
  .NET root search location options: 15
  Looking for architecture-specific install_location file in '/private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/installLocationOverride20082/install_location_arm64'.
  Found registered install location '/private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/global'.
  Using global install location [/private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/global] as runtime location.
  The required library libhostfxr.dylib could not be found. Search location options [0xf]
  Looking for architecture-specific install_location file in '/private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/installLocationOverride20082/install_location_arm64'.
  Found registered install location '/private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/global'.
  You must install .NET to run this application.
  
  App: /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/HelloWorld
  Architecture: arm64
  App host version: 11.0.0-ci
  .NET location: Not found
  
  The following locations were searched:
    Application directory:
      /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/
    App-relative location:
      /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/rel
    Environment variable:
      DOTNET_ROOT_ARM64 = <not set>
      DOTNET_ROOT = <not set>
    Registered location:
      /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/installLocationOverride20082/install_location_arm64 = /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/201pj4b4.cof/HelloWorld/global
  
  Learn more:
  https://aka.ms/dotnet/app-launch-failed
  
  Download the .NET runtime:
  https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=arm64&rid=osx-arm64&os=osx&apphost_version=11.0.0-ci
  ' could not be formatted with string.Format
     at System.String.FormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
     at FluentAssertions.Execution.FailureMessageFormatter.FormatArgumentPlaceholders(String failureMessage, Object[] failureArgs)
    at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message)
    at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
    at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
    at Microsoft.DotNet.CoreSetup.Test.CommandResultAssertions.HaveStdErrContaining(String pattern) in /_/src/installer/tests/TestUtils/Assertions/CommandResultAssertions.cs:100
    at HostActivation.Tests.InstallLocationCommandResultExtensions.HaveUsedDotNetRootInstallLocation(CommandResultAssertions assertion, String installLocation, String rid, String arch) in /_/src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs:36
    at HostActivation.Tests.InstallLocationCommandResultExtensions.HaveUsedDotNetRootInstallLocation(CommandResultAssertions assertion, String installLocation, String rid) in /_/src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs:21
    at HostActivation.Tests.InstallLocation.SearchOptions_Precedence(SearchLocation expectedResult) in /_/src/installer/tests/HostActivation.Tests/InstallLocation.cs:483
    at InvokeStub_InstallLocation.SearchOptions_Precedence(Object, Span`1)
    at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[+1203/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.InstallLocation.SearchOptions_Precedence(expectedResult: AppRelative) (1m 42s)

[+1266/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableAppRidAssetResolution.MostSpecificRidAssemblySelectedPerType(hasRuntimeFallbacks: True, useRidGraph: True) (1m 45s)

[+1415/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableComponentOnSelfContainedAppRidAssetResolution.RidSpecificAssembly_CurrentRid(rid: null, hasRuntimeFallbacks: True, useRidGraph: False) (1m 48s)

[+1428/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableComponentOnSelfContainedAppRidAssetResolution.MostSpecificRidAssemblySelectedPerType(hasRuntimeFallbacks: True, useRidGraph: False) (1m 51s)

[+1443/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableComponentOnSelfContainedAppRidAssetResolution.MostSpecificRidNativeLibrarySelected(includeCurrentArch: True, hasRuntimeFallbacks: False, useRidGraph: True) (1m 54s)

[+1458/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableComponentOnSelfContainedAppRidAssetResolution.RidSpecificNativeLibrary_CurrentRid(rid: "unknown-rid", hasRuntimeFallbacks: True, useRidGraph: False) (1m 57s)

[+1472/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableComponentOnSelfContainedAppRidAssetResolution.RidSpecificNativeLibrary_UnknownRid(useRidGraph: False) (2m 00s)

[+1486/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableComponentOnSelfContainedAppRidAssetResolution.MostSpecificRidAssemblySelectedPerTypeMultipleAssets_RidGraph(rid: "win10-x64", expectedAssemblyPath: "win/ManagedWin.dll;win/AnotherWin.dll", expectedNativePath: "native/win10-x64;native/win10-x64-2") (2m 03s)

[+1496/x1/?11] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.PortableComponentOnSelfContainedAppRidAssetResolution.RidSpecificAssembly_RidGraph(rid: "win", includedPath: "win/WindowsAssembly.dll", excludedPath: "linux/LinuxAssembly.dll;osx/MacOSAssembly.dll") (2m 06s)

skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass_ContextConfig(inDefaultContext: True) (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass_ContextConfig(inDefaultContext: False) (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.LoadTypeLibraries (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass_ValidateIErrorInfoResult (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass(count: 10, synchronous: False) (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass(count: 1, synchronous: True) (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass(count: 10, synchronous: True) (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass_IgnoreAppLocalHostFxr (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.Comhost.ActivateClass_IgnoreWorkingDirectory (0ms)
  COM activation is only supported on Windows
[+1534/x1/?20] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.AdditionalProbingPath.PlaceholderArchTfm (2m 09s)

[+1550/x1/?20] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SymbolicLinks.Put_satellite_assembly_behind_symlink (2m 13s)

[+1702/x1/?20] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.DependencyResolution.ComponentPerAssemblyVersionResolutionMultipleFrameworks.AppWithSameAssemblyAsFramework(testAssemblyName: "Test.Assembly.BothVersions", appAsmVersion: "3.0.0.0", appFileVersion: null, frameWorkWins: null) (2m 16s)

skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkDependentAppLaunch.AppHost_DisableCetCompat (0ms)
  Condition(s) not met: "IsSupported"
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "7.0.0", tfm: "net8.0", multiLevelLookup: null, resolvedVersion: "7.1.2") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "6.0.0", tfm: "netcoreapp3.1", multiLevelLookup: True, resolvedVersion: "6.1.4") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "6.0.0", tfm: "netcoreapp3.1", multiLevelLookup: False, resolvedVersion: "6.1.3") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "7.0.0", tfm: "net8.0", multiLevelLookup: False, resolvedVersion: "7.1.2") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "6.2.0", tfm: "net6.0", multiLevelLookup: null, resolvedVersion: "6.2.1") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "7.0.0", tfm: "net8.0", multiLevelLookup: True, resolvedVersion: "7.1.2") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "6.2.0", tfm: "net6.0", multiLevelLookup: True, resolvedVersion: "6.2.1") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "6.0.0", tfm: "netcoreapp3.1", multiLevelLookup: null, resolvedVersion: "6.1.4") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection(requestedVersion: "6.2.0", tfm: "net6.0", multiLevelLookup: False, resolvedVersion: "6.2.1") (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkResolutionError (0ms)
  Multi-level lookup is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution.MultilevelLookup.FrameworkHiveSelection_CurrentDirectoryIsIgnored (0ms)
  Multi-level lookup is only supported on Windows
[+1781/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "disable", requested: "9999.1.501", allowPrerelease: False, expected: null, installed: ["9999.1.500", "9999.2.100-preview1"]) (2m 19s)

[+1792/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "feature", requested: "9999.1.501", allowPrerelease: True, expected: "9999.1.605-preview4", installed: ["9998.0.300", "9999.1.500", "9999.1.601", "9999.1.604-preview3", "9999.1.604", ···]) (2m 22s)

[+1804/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "latestMinor", requested: "9999.1.501", allowPrerelease: False, expected: null, installed: ["9999.1.500", "9999.2.100-preview1"]) (2m 25s)

[+1817/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "minor", requested: "9999.1.501", allowPrerelease: False, expected: "9999.1.505", installed: ["9998.0.300", "9999.1.500", "9999.1.503", "9999.1.505-preview2", "9999.1.505", ···]) (2m 28s)

[+1830/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "patch", requested: "9999.1.501", allowPrerelease: True, expected: "9999.1.506-preview1", installed: ["9998.0.300", "9999.1.500", "9999.1.503", "9999.1.505-preview2", "9999.1.505", ···]) (2m 31s)

[+1843/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: null, requested: "9999.1.501", allowPrerelease: False, expected: null, installed: ["9998.0.300", "9999.1.500", "9999.1.601", "9999.1.604-preview3", "9999.1.604", ···]) (2m 34s)

[+1856/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "invalid", requested: "9999.1.501", allowPrerelease: True, expected: "10000.0.100", installed: ["9998.0.300", "9999.1.500", "9999.1.601", "9999.1.604-preview3", "9999.1.604", ···]) (2m 37s)

[+1869/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "patch", requested: "9999.1.501", allowPrerelease: True, expected: "9999.1.501", installed: ["9998.0.300", "9999.1.500", "9999.1.501", "9999.1.503-preview5", "9999.1.503", ···]) (2m 40s)

[+1880/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "latestMajor", requested: "9999.1.501", allowPrerelease: True, expected: "10000.3.102-preview3", installed: ["9998.0.300", "9999.1.500", "10000.0.100", "10000.0.105-preview1", "10000.0.105", ···]) (2m 44s)

[+1893/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: null, requested: "9999.1.501", allowPrerelease: False, expected: "9999.1.501", installed: ["9998.0.300", "9999.1.500", "9999.1.501", "9999.1.503-preview5", "9999.1.503", ···]) (2m 47s)

[+1907/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForward(policy: "disable", requested: "9999.1.501", allowPrerelease: False, expected: null, installed: ["9998.0.300", "9999.1.500", "9999.2.101-preview4", "9999.2.101", "9999.2.102-preview1", ···]) (2m 50s)

[+1918/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.RollForwardPolicy_CaseInsensitive(rollForward: "LatestPatch") (2m 53s)

[+1929/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.InvalidGlobalJson_FallsBackToLatestSdk(globalJsonContents: "{ \"sdk\": { \"version\": 1 } }", messages: ["Expected a string for the 'sdk/version' value", "Ignoring SDK settings in global.json: the latest i"···]) (2m 56s)

[+1939/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SDKLookup.AllowPrereleaseFalse_UseLatestRelease (2m 59s)

[+1944/x1/?32] HostActivation.Tests.dll (net11.0|arm64) - HostActivation.Tests.SelfContainedAppLaunch.RenameApphost (3m 02s)

skipped HostActivation.Tests.SelfContainedAppLaunch.AppHost_DisableCetCompat (0ms)
  CET not supported on this platform
[+1950/x1/?33] HostActivation.Tests.dll (net11.0|arm64) - Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.GetFunctionPointer.CallDelegateOnComponentContext(validType: True, validMethod: True) (3m 05s)

skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.ComhostSideBySide.ManagedHost(selfContained: False) (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.ComhostSideBySide.ManagedHost(selfContained: True) (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.ComhostSideBySide.ActivateClass (0ms)
  COM activation is only supported on Windows
skipped Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting.ComhostSideBySide.LocateEmbeddedTlb (0ms)
  COM activation is only supported on Windows
Microsoft.NETCore.App 11.0.0-ci [/private/tmp/helix/working/AFD809A9/p/test_assets/sharedFrameworkPublish/shared/Microsoft.NETCore.App]
failed Microsoft.DotNet.CoreSetup.Test.HostActivation.Tracing.TracingOnToDirectory (8ms)
  **WARNING** failure message 'The command error output contained a result it should not have contained: '--- Invoked dotnet'
  File Name: /private/tmp/helix/working/AFD809A9/p/test_assets/sharedFrameworkPublish/dotnet
  Arguments: --list-runtimes
  Environment:
    DOTNET_CreateDumpDiagnostics = 1
    DOTNET_CLI_HOME = /tmp/helix/working/AFD809A9/w/A3300916/e/.dotnet
    DOTNET_CreateDumpVerboseDiagnostics = 1
    DOTNET_DbgMiniDumpType = 4
    DOTNET_DbgMiniDumpName = /private/tmp/helix/working/AFD809A9/w/A3300916/e/HostActivation.Tests_%p_crash.dmp
    DOTNET_ROOT =
    DOTNET_CLI_TELEMETRY_OPTOUT = 1
    DOTNET_DbgEnableMiniDump = 1
    DOTNET_ROOT_ARM64 =
    DOTNET_ROOT(x86) =
    DOTNET_NOLOGO = 1
    DOTNET_MULTILEVEL_LOOKUP = 0
    DOTNET_HOST_TRACE = 1
    DOTNET_HOST_TRACEFILE = /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/3dbrvtet.2rq/trace
  Exit Code: 0x0
  StdOut:
  Microsoft.NETCore.App 11.0.0-ci [/private/tmp/helix/working/AFD809A9/p/test_assets/sharedFrameworkPublish/shared/Microsoft.NETCore.App]
  
  StdErr:
  Unable to open specified trace file for writing: /private/tmp/helix/working/AFD809A9/w/A3300916/e/test_artifacts/3dbrvtet.2rq/trace
  Tracing enabled
  --- Invoked dotnet [version: 11.0.0-ci @Commit: c948b592279254b6654c02340f951edf720ac30d] main = {
  /private/tmp/helix/working/AFD809A9/p/test_assets/sharedFrameworkPublish/dotnet
  --list-runtimes
  }

wasm build failure:

  [18/20] Linking CXX static library browserhost/libBrowserHost.a
  [19/20] Linking CXX executable browserhost/dotnet.native.js
  FAILED: browserhost/dotnet.native.js 
  : && /__w/1/s/src/mono/browser/emsdk/emscripten/em++ -O3 -DNDEBUG -fuse-ld=lld   --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.js --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.Utils.js --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Runtime.InteropServices.JavaScript.Native.js --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libBrowserHost.js --extern-post-js /__w/1/s/src/native/corehost/browserhost/../../libs/System.Native.Browser/libSystem.Native.Browser.extpost.js  -fwasm-exceptions -Wno-unused-command-line-argument -Wl,--error-limit=0 -nostdlib -lbulkmemory -lstubs -lc -lmalloc -lcompiler_rt -lc++ -lc++abi -lunwind -sINITIAL_MEMORY=134217728 -sMAXIMUM_MEMORY=2147483648 -sALLOW_MEMORY_GROWTH=1 -sSTACK_SIZE=5MB -sWASM_BIGINT=1 -sMODULARIZE=1 -sEXPORT_ES6=1 -sEXIT_RUNTIME=1 -sALLOW_TABLE_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=BROWSER_HOST,FS,out,err,ccall,cwrap,setValue,getValue,UTF8ToString,UTF8ArrayToString,lengthBytesUTF8,stringToUTF8Array,safeSetTimeout,runtimeKeepalivePush,runtimeKeepalivePop,abort -sEXPORTED_FUNCTIONS=_free,_htons,_malloc,_sbrk,_memalign,_posix_memalign,_memset,_ntohs,stackAlloc,stackRestore,stackSave -sEXPORT_NAME=createDotnetRuntime -sENVIRONMENT=web,webview,worker,node,shell --emit-symbol-map browserhost/CMakeFiles/browserhost.dir/empty.c.o -o browserhost/dotnet.native.js  browserhost/libBrowserHost.a  /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclr_static.a  /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libnativeresourcestring.a  /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libgcinfo_unix_wasm.a  /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrminipal.a  /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrpal.a  /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libminipal.a  /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.a  /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Runtime.InteropServices.JavaScript.Native.a  /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.a  /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Globalization.Native.a  /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicuuc.a  /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicui18n.a  /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicudata.a  /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.IO.Compression.Native.a  /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libz.a  /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.TimeZoneData.a  hostmisc/libhostmisc.a  -lminipal && :
  wasm-ld: error: unable to find library -lminipal
  em++: error: '/__w/1/s/src/mono/browser/emsdk/bin/wasm-ld -o browserhost/dotnet.native.wasm --error-limit=0 -lbulkmemory -lstubs -lc -ldlmalloc -lcompiler_rt-wasm-sjlj -lc++-except -lc++abi-except -lunwind-except browserhost/CMakeFiles/browserhost.dir/empty.c.o browserhost/libBrowserHost.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclr_static.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libnativeresourcestring.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libgcinfo_unix_wasm.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrminipal.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrpal.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libminipal.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Runtime.InteropServices.JavaScript.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Globalization.Native.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicuuc.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicui18n.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicudata.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.IO.Compression.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libz.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.TimeZoneData.a hostmisc/libhostmisc.a -lminipal -L/__w/1/s/src/mono/browser/emsdk/emscripten/cache/sysroot/lib/wasm32-emscripten -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -mllvm -wasm-enable-eh -mllvm -exception-model=wasm /tmp/tmpai0x2aiglibemscripten_js_symbols.so --export=free --export=htons --export=malloc --export=sbrk --export=memalign --export=posix_memalign --export=memset --export=ntohs --export=stackAlloc --export=stackRestore --export=stackSave --export=stackAlloc --export=__funcs_on_exit --export=__trap --export=__wasm_call_ctors --export=wasm_load_icu_data --export=BrowserHost_CreateHostContract --export=BrowserHost_InitializeDotnet --export=BrowserHost_ExecuteAssembly --export=BrowserHost_ShutdownDotnet --export=SystemInteropJS_GetManagedStackTrace --export=SystemInteropJS_CallDelegate --export=SystemInteropJS_CompleteTask --export=SystemInteropJS_ReleaseJSOwnedObjectByGCHandle --export=SystemInteropJS_BindAssemblyExports --export=SystemInteropJS_CallJSExport --export=SystemJS_ExecuteTimerCallback --export=SystemJS_ExecuteBackgroundJobCallback --export=SystemJS_ExecuteFinalizationCallback --export=SystemJS_ExecuteDiagnosticServerCallback --export=GetDotNetRuntimeContractDescriptor --export=_exit --export=stackSave --export=stackRestore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=fflush --export-table --growable-table -z stack-size=5242880 --max-memory=2147483648 --initial-memory=134217728 --no-entry --table-base=1 --global-base=1024' failed (returned 1)
  ninja: build stopped: subcommand failed.
##[error]src/native/corehost/corehost.proj(100,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command ""/__w/1/s/src/native/corehost/build.sh" Release wasm -commithash "c948b592279254b6654c02340f951edf720ac30d" -os browser -cmakeargs "-DVERSION_FILE_PATH=/__w/1/s/artifacts/obj/_version.c" -ninja -runtimeflavor CoreCLR -targetrid browser-wasm -cmakeargs "-DCLR_CMAKE_BUILD_HOST_TESTS=FALSE" -cmakeargs "-DCLR_CMAKE_BUILD_HOST_PRODUCT=TRUE" -cmakeargs "-DCMAKE_ICU_DIR=/__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native" -cmakeargs "-DCMAKE_TZD_DIR=/__w/1/s/.packages/system.runtime.timezonedata/11.0.0-beta.26180.1/contentFiles/any/any/data" -cmakeargs "-DCLR_CMAKE_RUNTIME_CORECLR=1" -cmakeargs "-DCMAKE_PRODUCT_VERSION=11.0.0" -cmakeargs "-DCMAKE_CONTINUOUS_INTEGRATION_BUILD=true" -cmakeargs "-DCMAKE_NET_CORE_APP_CURRENT_VERSION=11.0" -cmakeargs "-DCMAKE_BUILD_LIBRARIES_CONFIGURATION=Release" -cmakeargs "-DCMAKE_BUILD_RUNTIME_CONFIGURATION=Release" -cmakeargs "-DCMAKE_BUILD_RUNTIME_FLAVOR=CoreCLR" -cmakeargs "-DBUILD_LIBS_NATIVE_BROWSER=1" -cmakeargs "-DGEN_PINVOKE=1" -cmakeargs "-DFEATURE_PERFTRACING_PAL_WS=1" -cmakeargs "-DFEATURE_PERFTRACING_DISABLE_PERFTRACING_LISTEN_PORTS=1" -cmakeargs "-DFEATURE_PERFTRACING_DISABLE_DEFAULT_LISTEN_PORT=1" -cmakeargs "-DFEATURE_PERFTRACING_DISABLE_THREADS=1" -cmakeargs "-DCMAKE_EMCC_EXPORTED_RUNTIME_METHODS=FS,out,err,ccall,cwrap,setValue,getValue,UTF8ToString,UTF8ArrayToString,lengthBytesUTF8,stringToUTF8Array,safeSetTimeout,runtimeKeepalivePush,runtimeKeepalivePop,abort" -cmakeargs "-DCMAKE_EMCC_EXPORTED_FUNCTIONS=_free,_htons,_malloc,_sbrk,_memalign,_posix_memalign,_memset,_ntohs,stackAlloc,stackRestore,stackSave"" exited with code 1.
/__w/1/s/src/native/corehost/corehost.proj(100,5): error MSB3073: The command ""/__w/1/s/src/native/corehost/build.sh" Release wasm -commithash "c948b592279254b6654c02340f951edf720ac30d" -os browser -cmakeargs "-DVERSION_FILE_PATH=/__w/1/s/artifacts/obj/_version.c" -ninja -runtimeflavor CoreCLR -targetrid browser-wasm -cmakeargs "-DCLR_CMAKE_BUILD_HOST_TESTS=FALSE" -cmakeargs "-DCLR_CMAKE_BUILD_HOST_PRODUCT=TRUE" -cmakeargs "-DCMAKE_ICU_DIR=/__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native" -cmakeargs "-DCMAKE_TZD_DIR=/__w/1/s/.packages/system.runtime.timezonedata/11.0.0-beta.26180.1/contentFiles/any/any/data" -cmakeargs "-DCLR_CMAKE_RUNTIME_CORECLR=1" -cmakeargs "-DCMAKE_PRODUCT_VERSION=11.0.0" -cmakeargs "-DCMAKE_CONTINUOUS_INTEGRATION_BUILD=true" -cmakeargs "-DCMAKE_NET_CORE_APP_CURRENT_VERSION=11.0" -cmakeargs "-DCMAKE_BUILD_LIBRARIES_CONFIGURATION=Release" -cmakeargs "-DCMAKE_BUILD_RUNTIME_CONFIGURATION=Release" -cmakeargs "-DCMAKE_BUILD_RUNTIME_FLAVOR=CoreCLR" -cmakeargs "-DBUILD_LIBS_NATIVE_BROWSER=1" -cmakeargs "-DGEN_PINVOKE=1" -cmakeargs "-DFEATURE_PERFTRACING_PAL_WS=1" -cmakeargs "-DFEATURE_PERFTRACING_DISABLE_PERFTRACING_LISTEN_PORTS=1" -cmakeargs "-DFEATURE_PERFTRACING_DISABLE_DEFAULT_LISTEN_PORT=1" -cmakeargs "-DFEATURE_PERFTRACING_DISABLE_THREADS=1" -cmakeargs "-DCMAKE_EMCC_EXPORTED_RUNTIME_METHODS=FS,out,err,ccall,cwrap,setValue,getValue,UTF8ToString,UTF8ArrayToString,lengthBytesUTF8,stringToUTF8Array,safeSetTimeout,runtimeKeepalivePush,runtimeKeepalivePop,abort" -cmakeargs "-DCMAKE_EMCC_EXPORTED_FUNCTIONS=_free,_htons,_malloc,_sbrk,_memalign,_posix_memalign,_memset,_ntohs,stackAlloc,stackRestore,stackSave"" exited with code 1.

@jkoritzinsky
Copy link
Copy Markdown
Member

@copilot browser WASM CoreCLR is still failing with the following error. Please fix the error, validate the build, fix any subsequent issues, and then push the fix

FAILED: browserhost/dotnet.native.js
: && /__w/1/s/src/mono/browser/emsdk/emscripten/em++ -O3 -DNDEBUG -fuse-ld=lld --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.js --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.Utils.js --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Runtime.InteropServices.JavaScript.Native.js --js-library /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libBrowserHost.js --extern-post-js /__w/1/s/src/native/corehost/browserhost/../../libs/System.Native.Browser/libSystem.Native.Browser.extpost.js -fwasm-exceptions -Wno-unused-command-line-argument -Wl,--error-limit=0 -nostdlib -lbulkmemory -lstubs -lc -lmalloc -lcompiler_rt -lc++ -lc++abi -lunwind -sINITIAL_MEMORY=134217728 -sMAXIMUM_MEMORY=2147483648 -sALLOW_MEMORY_GROWTH=1 -sSTACK_SIZE=5MB -sWASM_BIGINT=1 -sMODULARIZE=1 -sEXPORT_ES6=1 -sEXIT_RUNTIME=1 -sALLOW_TABLE_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=BROWSER_HOST,FS,out,err,ccall,cwrap,setValue,getValue,UTF8ToString,UTF8ArrayToString,lengthBytesUTF8,stringToUTF8Array,safeSetTimeout,runtimeKeepalivePush,runtimeKeepalivePop,abort -sEXPORTED_FUNCTIONS=_free,_htons,_malloc,_sbrk,_memalign,_posix_memalign,_memset,_ntohs,stackAlloc,stackRestore,stackSave -sEXPORT_NAME=createDotnetRuntime -sENVIRONMENT=web,webview,worker,node,shell --emit-symbol-map browserhost/CMakeFiles/browserhost.dir/empty.c.o -o browserhost/dotnet.native.js browserhost/libBrowserHost.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclr_static.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libnativeresourcestring.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libgcinfo_unix_wasm.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrminipal.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrpal.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libminipal.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Runtime.InteropServices.JavaScript.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Globalization.Native.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicuuc.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicui18n.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicudata.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.IO.Compression.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libz.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.TimeZoneData.a hostmisc/libhostmisc.a -lminipal && :
wasm-ld: error: unable to find library -lminipal
em++: error: '/__w/1/s/src/mono/browser/emsdk/bin/wasm-ld -o browserhost/dotnet.native.wasm --error-limit=0 -lbulkmemory -lstubs -lc -ldlmalloc -lcompiler_rt-wasm-sjlj -lc++-except -lc++abi-except -lunwind-except browserhost/CMakeFiles/browserhost.dir/empty.c.o browserhost/libBrowserHost.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclr_static.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libnativeresourcestring.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libgcinfo_unix_wasm.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrminipal.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libcoreclrpal.a /__w/1/s/artifacts/bin/coreclr/browser.wasm.Release/sharedFramework/libminipal.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.Browser.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Runtime.InteropServices.JavaScript.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Globalization.Native.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicuuc.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicui18n.a /__w/1/s/.packages/microsoft.netcore.runtime.icu.transport/11.0.0-alpha.1.26181.1/runtimes/browser-wasm/native/lib/libicudata.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.IO.Compression.Native.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libz.a /__w/1/s/artifacts/bin/native/net11.0-browser-Release-wasm/sharedFramework/libSystem.Native.TimeZoneData.a hostmisc/libhostmisc.a -lminipal -L/__w/1/s/src/mono/browser/emsdk/emscripten/cache/sysroot/lib/wasm32-emscripten -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -mllvm -wasm-enable-eh -mllvm -exception-model=wasm /tmp/tmpai0x2aiglibemscripten_js_symbols.so --export=free --export=htons --export=malloc --export=sbrk --export=memalign --export=posix_memalign --export=memset --export=ntohs --export=stackAlloc --export=stackRestore --export=stackSave --export=stackAlloc --export=__funcs_on_exit --export=__trap --export=__wasm_call_ctors --export=wasm_load_icu_data --export=BrowserHost_CreateHostContract --export=BrowserHost_InitializeDotnet --export=BrowserHost_ExecuteAssembly --export=BrowserHost_ShutdownDotnet --export=SystemInteropJS_GetManagedStackTrace --export=SystemInteropJS_CallDelegate --export=SystemInteropJS_CompleteTask --export=SystemInteropJS_ReleaseJSOwnedObjectByGCHandle --export=SystemInteropJS_BindAssemblyExports --export=SystemInteropJS_CallJSExport --export=SystemJS_ExecuteTimerCallback --export=SystemJS_ExecuteBackgroundJobCallback --export=SystemJS_ExecuteFinalizationCallback --export=SystemJS_ExecuteDiagnosticServerCallback --export=GetDotNetRuntimeContractDescriptor --export=_exit --export=stackSave --export=stackRestore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=fflush --export-table --growable-table -z stack-size=5242880 --max-memory=2147483648 --initial-memory=134217728 --no-entry --table-base=1 --global-base=1024' failed (returned 1)
ninja: build stopped: subcommand failed.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

@copilot browser WASM CoreCLR is still failing with the following error. Please fix the error, validate the build, fix any subsequent issues, and then push the fix

FAILED: browserhost/dotnet.native....

Fixed in 5fb4435. The actual error was wasm-ld: error: unable to find library -lminipal. The browser-wasm corehost build doesn't add the minipal subdirectory (it's gated under if(NOT CLR_CMAKE_TARGET_BROWSER) in corehost/CMakeLists.txt), so minipal wasn't a known target — target_link_libraries(hostmisc PUBLIC ... minipal) from my earlier change leaked through as a literal -lminipal in the browserhost link. Gated the minipal/minipal_objects link in hostmisc/CMakeLists.txt on NOT CLR_CMAKE_TARGET_BROWSER. The browser link still gets minipal symbols directly from libminipal.a (already in NATIVE_LIBS via the CoreCLR build), so no functional change there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants