Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAUI project with non-ASCII project name cannot release to my Android phone #83203

Closed
dellis1972 opened this issue Mar 9, 2023 · 13 comments
Closed

Comments

@dellis1972
Copy link

Description

Context https://i.azdo.io/1714603

When a user tries to use certain non-ascii characters for the project name AOT fails with the following error

[随机生成器.dll] Running: C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm\8.0.0-preview.2.23127.4\Sdk\..\tools\mono-aot-cross.exe --response="C:\Users\cloudtest\AppData\Local\Temp\tmp2we1dw.tmp" (TaskId:285)
                     [随机生成器.dll] Using working directory: C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器 (TaskId:285)
                     [随机生成器.dll] Setting environment variables for execution: (TaskId:285)
                     [随机生成器.dll] 	MONO_PATH = C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked; (TaskId:285)
                     [随机生成器.dll] 	MONO_ENV_OPTIONS =  (TaskId:285)
                     [随机生成器.dll] Exit code: 1 (TaskId:285)
                     [随机生成器.dll] Exec (with response file contents expanded) in C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器: MONO_PATH=C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked; MONO_ENV_OPTIONS= C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm\8.0.0-preview.2.23127.4\Sdk\..\tools\mono-aot-cross.exe --debug --nollvm "--aot=asmwriter,temp-path=obj\Release\android-arm\aot\armeabi-v7a\随机生成器,mtriple=armv7-linux-gnueabi,tool-prefix=C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\tools\binutils\bin\arm-linux-androideabi-,outfile=obj\Release\android-arm\aot\随机生成器.dll.so,ld-name=ld,ld-flags=--no-relax -s" "obj\Release\android-arm\linked\随机生成器.dll"
                      (TaskId:285)
17:04:39.276  1:12>C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : Precompiling failed for C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked\随机生成器.dll with exit code 1. [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : Unable to open file 'obj\Release\android-arm\aot\armeabi-v7a\随机生成器\temp.s': No such file or directory [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : AOT of image C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked\随机生成器.dll failed. [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : Mono Ahead of Time compiler - compiling assembly C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked\随机生成器.dll [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : AOTID 2F8A7A33-8DCF-C9B3-0A30-14ACE4513839 [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]

Reproduction Steps

dotnet new android -o 随机生成器
cd 随机生成器
dotnet build -c Release -f net7.0-android

Expected behavior

The application should build without any errors.

Actual behavior

The following error is raised

[随机生成器.dll] Running: C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm\8.0.0-preview.2.23127.4\Sdk\..\tools\mono-aot-cross.exe --response="C:\Users\cloudtest\AppData\Local\Temp\tmp2we1dw.tmp" (TaskId:285)
                     [随机生成器.dll] Using working directory: C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器 (TaskId:285)
                     [随机生成器.dll] Setting environment variables for execution: (TaskId:285)
                     [随机生成器.dll] 	MONO_PATH = C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked; (TaskId:285)
                     [随机生成器.dll] 	MONO_ENV_OPTIONS =  (TaskId:285)
                     [随机生成器.dll] Exit code: 1 (TaskId:285)
                     [随机生成器.dll] Exec (with response file contents expanded) in C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器: MONO_PATH=C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked; MONO_ENV_OPTIONS= C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm\8.0.0-preview.2.23127.4\Sdk\..\tools\mono-aot-cross.exe --debug --nollvm "--aot=asmwriter,temp-path=obj\Release\android-arm\aot\armeabi-v7a\随机生成器,mtriple=armv7-linux-gnueabi,tool-prefix=C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\tools\binutils\bin\arm-linux-androideabi-,outfile=obj\Release\android-arm\aot\随机生成器.dll.so,ld-name=ld,ld-flags=--no-relax -s" "obj\Release\android-arm\linked\随机生成器.dll"
                      (TaskId:285)
17:04:39.276  1:12>C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : Precompiling failed for C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked\随机生成器.dll with exit code 1. [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : Unable to open file 'obj\Release\android-arm\aot\armeabi-v7a\随机生成器\temp.s': No such file or directory [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : AOT of image C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked\随机生成器.dll failed. [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : Mono Ahead of Time compiler - compiling assembly C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\obj\Release\android-arm\linked\随机生成器.dll [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]
C:\a\_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.0-ci.pr.gh7710.204\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : AOTID 2F8A7A33-8DCF-C9B3-0A30-14ACE4513839 [C:\a\_work\1\a\TestRelease\03-08_16.56.43\temp\BuildAotApplicationWithSpecialCharactersInProject随机生成器True\随机生成器\随机生成器.csproj]

Regression?

Not sure if this is a regression, however the same dotnet new console -o 随机生成器 app will work correctly.

Known Workarounds

The only known workaround is to only use ASCII characters for project names.

Configuration

This can be re-produced on .net 7.0.200

Other information

No response

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Mar 9, 2023
@Xyncgas
Copy link

Xyncgas commented Mar 9, 2023

This likely to be a tool chain problem with android publishing, I had difficulty publishing with Japanese project name when I worked with Xamarin but it worked out some how (long ago)

I suggest renaming the project with the name you want instead of creating the project with the name you wanted

note BuildAotApplicationWithSpecialCharactersInProject in the error displayed

@akoeplinger
Copy link
Member

I tried reproducing on the Mac and it seems to work fine there, so it is probably a Windows-specific issue:

image

The only thing I noticed is that the non-ASCII characters in the .apk/.aab filename were replaced with underscores but I don't know whether that is an expected behavior from the Android toolchain @dellis1972

The app on the device has the correct title and everything.

@akoeplinger akoeplinger added os-windows and removed untriaged New issue has not been triaged by the area owner labels Mar 10, 2023
@akoeplinger akoeplinger added this to the 8.0.0 milestone Mar 10, 2023
@akoeplinger
Copy link
Member

@vargaz @lambdageek @SamMonoRT this seems relevant related to what we discussed for #82187, it seems using non-ASCII in general works with the AOT compiler at least on the Mac.

@dellis1972
Copy link
Author

The underscores thing is an android tool chain issue I think, its not relatd to this issue.
The reported error does only occur on windows.

@SamMonoRT
Copy link
Member

@lambdageek - this is a Windows only issue, not sure about the priority for 8.0?

@lambdageek
Copy link
Member

@SamMonoRT It's the AOT compiler running on Windows (ie: someone is using VS on Windows to develop an Android app). It's pretty high priority

@BrzVlad BrzVlad self-assigned this Aug 7, 2023
@BrzVlad
Copy link
Member

BrzVlad commented Aug 14, 2023

This doesn't seem to be a regression. We do have some issues with handling of non-ascii characters in file names that easily fixable. The problem is that we need to compile some files with such characters and the compiler toolchain behind (some llvm tools) don't have support for wide chars. I'm not sure if this is intentional, will submit an issue on the llvm project to figure out if we can have a fix on their side. An alternative fix would be to rename all files so they can be processed by the toolchain, but that seems like a hack and rather risky this late in the release. Either way, seems like this issue should be left for net-9.0.

@SamMonoRT
Copy link
Member

@BrzVlad - please can you add a link to the issue created on llvm project here for tracking.

Moving this to 9.0 and will validate once llvm project owners have a suggestion.

@SamMonoRT SamMonoRT modified the milestones: 8.0.0, 9.0.0 Aug 15, 2023
@BrzVlad
Copy link
Member

BrzVlad commented Aug 22, 2023

After further investigation it seems like llvm tools work as expected. We actually have a wrapper around llvm-mc in https://github.com/xamarin/xamarin-android-binutils which appears to be the culprit. Will fix it once I get in contact with the code owners and see if anything else is needed to make this scenario work.

@dellis1972
Copy link
Author

There is also a related issue upstream in the aapt2 tool https://issuetracker.google.com/issues/188679588

@SamMonoRT
Copy link
Member

cc @ilonatommy who is investigating somewhat related WASM tooling issue

@ilonatommy
Copy link
Member

cc @ilonatommy who is investigating somewhat related WASM tooling issue

Thanks, for us it's AOT/relink case on Windows caused by emscripten not respecting wide chars: #83497. The fix for it seems to be on its way.

@BrzVlad
Copy link
Member

BrzVlad commented Feb 13, 2024

I'm expecting this to be fixed starting in .net 9 Preview 2

@BrzVlad BrzVlad closed this as completed Feb 13, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants