Open
Description
Reproduction:
- WBT
Wasm.Build.Tests.Blazor.BuildPublishTests
- edit id to be$"blz_aot_{config}_{GetRandomId()}_TEST_OF_EXTREMELY_LONG_PATH"
, or anything that will result in path longer than 260 chars. - Run, first error will be connected with
g_fopen
code:
Unable to open trimming-eligible-methods-outfile specified file C:\Users\username\source\repos\runtime-fork\artifacts\bin\Wasm.Build.Tests\Release\net9.0\win-x64\wbt artifacts\blz_aot_Debug_tumnkn5b_5fc_TEST_OF_LONG_PATH\obj\Debug\net9.0\wasm\for-publish\tokens\Microsoft_Extensions_DependencyInjection_dll_compiled_methods.txt
and can be fixed by editing g_fopen (const gchar *path, const gchar *mode)
from gfile.c
to:
gchar *path_mod;
#ifdef HOST_WIN32
// add long-path prefix
path_mod = g_malloc(strlen(path) + 5);
strcpy(path_mod, "\\\\?\\");
strcat(path_mod, path);
if (is_ascii_string (path_mod) && is_ascii_string (mode)) {
fp = fopen (path_mod, mode);
} else {
gunichar2 *wPath = g_utf8_to_utf16 (path_mod, -1, 0, 0, 0);
gunichar2 *wMode = g_utf8_to_utf16 (mode, -1, 0, 0, 0);
if (!wPath || !wMode)
return NULL;
fp = _wfopen ((wchar_t *) wPath, (wchar_t *) wMode);
g_free (wPath);
g_free (wMode);
}
g_free (path_mod);
#else
Further errors come from aot_printerrf (acfg, "Failed to load methodspec 0x%x due to %s.\n", token, mono_error_get_message (error));
in aot-compiler.c
.
mono_get_method_checked Failed to load method 0x60001cc from 'C:\Users\source\repos\runtime-fork\artifacts\bin\Wasm.Build.Tests\Debug\net9.0\win-x64\wbt artifacts\blz_aot_Release_1t1y0tcq_4j1_TEST_OF_EXTREMELY_LONG_PATH\obj\Release\net9.0\wasm\for-publish\aot-in\Microsoft.AspNetCore.Components.WebAssembly.dll'
[] C:\Users\source\repos\runtime-fork\artifacts\bin\dotnet-latest\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\9.0.0-dev\Sdk\WasmApp.Common.targets(697,5): error : due to Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies..
[] C:\Users\source\repos\runtime-fork\artifacts\bin\dotnet-latest\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\9.0.0-dev\Sdk\WasmApp.Common.targets(697,5): error : Run with MONO_LOG_LEVEL=debug for more information.
[] C:\Users\source\repos\runtime-fork\artifacts\bin\dotnet-latest\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\9.0.0-dev\Sdk\WasmApp.Common.targets(697,5): error : AOT of image C:\Users\source\repos\runtime-fork\artifacts\bin\Wasm.Build.Tests\Debug\net9.0\win-x64\wbt artifacts\blz_aot_Release_1t1y0tcq_4j1_TEST_OF_EXTREMELY_LONG_PATH\obj\Release\net9.0\wasm\for-publish\aot-in\Microsoft.AspNetCore.Components.WebAssembly.dll failed
They are caused by mono_get_method_checked
from loader.c
getting empty result
but I am not able to track down the reason for it.
cc @kg, @BrzVlad any ideas what might be going wrong there?
For debugging it is helpful to switch off parallelization of library precompiling in MonoAOTCompiler
(PrecompileLibraryParallel
).