Open
Description
Android framework version
net9.0-android
Affected platform version
.NET 9.0.101
Description
If i write environment variables in a text file and then add it to project with AndroidEnvironment build action i see a couple of problems:
- Any variable containing in it's value the character '=' won't get added (Eg: 'MONO_GC_PARAMS=major=marksweep' if i write 'MONO_GC_PARAMS=foo' then no problem)
- Even if the variables MONO_GC_PARAMS, MONO_LOG_LEVEL or MONO_DEBUG are defined in environment variables file, the app still apply first the default values and then the override ones.
The result is that i cannot set the 'bridge-implementation=new' of the mono garbage collector.
The following are the versions of the tools used:
MacOS 14.6.1
MSBuild version 17.12.12+1cce77968 for .NET
.NET 9.0.101
Android api 35
Steps to Reproduce
- Create a new MAUI project, specifically for Android platform
- Create a 'Environment.txt' file with content 'MONO_GC_PARAMS=major=marksweep'
- Add it to the project with AndroidEnvironment as build action
- Set msbuild logs to Diagnostic
- Watch in the logs as the app starts that the environment variable is not added
Did you find any workaround?
No response
Relevant log output
Content of the file Environment.txt:
MONO_LOG_LEVEL=debug
MONO_GC_PARAMS=foo
MONO_GC_PARAMS=bridge-implementation=new
MONO_DEBUG=1
Excerpt of the output log of the app:
01-22 17:53:24.743 7877 7877 W monodroid: Creating public update directory: `/data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a`
01-22 17:53:24.743 7877 7877 D monodroid: Mono AOT mode: interp
01-22 17:53:24.743 7877 7877 I monodroid: Setting environment variable 'MONO_GC_PARAMS' to 'major=marksweep-conc'
01-22 17:53:24.743 7877 7877 I monodroid: Setting environment variable 'MONO_LOG_LEVEL' to 'info'
01-22 17:53:24.743 7877 7877 I monodroid: Setting environment variable 'XA_HTTP_CLIENT_HANDLER_TYPE' to 'Xamarin.Android.Net.AndroidMessageHandler'
01-22 17:53:24.743 7877 7877 D monodroid: Loading environment from override directories.
01-22 17:53:24.743 7877 7877 D monodroid: /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment
01-22 17:53:24.743 7877 7877 D monodroid: Loading /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment
01-22 17:53:24.743 7877 7877 D monodroid: Setting environment variable from the override file /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment: 'MONO_LOG_LEVEL' = 'debug'
01-22 17:53:24.743 7877 7877 D monodroid: Setting environment variable from the override file /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment: 'MONO_GC_PARAMS' = 'foo'
01-22 17:53:24.743 7877 7877 D monodroid: Setting environment variable from the override file /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment: 'MONO_DEBUG' = '1'
01-22 17:53:24.743 7877 7877 D monodroid: Setting environment variable from the override file /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment: '__XA_PACKAGE_NAMING_POLICY__' = 'LowercaseCrc64'
01-22 17:53:24.743 7877 7877 D monodroid: Setting environment variable from the override file /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment: 'mono.enable_assembly_preload' = '0'
01-22 17:53:24.743 7877 7877 D monodroid: Setting environment variable from the override file /data/user/0/com.companyname.mauiapp1/files/.__override__/arm64-v8a/environment: 'DOTNET_MODIFIABLE_ASSEMBLIES' = 'Debug'
01-22 17:53:24.743 7877 7877 D monodroid: Setting up for DSO lookup in app data directories
01-22 17:53:24.744 7877 7877 D monodroid: Using runtime path: /data/app/~~IbQRxpVI8Y592VNi46z1nA==/com.companyname.mauiapp1-jQ6lwiTQcItXE8NawSeJvQ==/lib/arm64
01-22 17:53:24.744 7877 7877 D monodroid: Probing for Mono AOT mode
01-22 17:53:24.744 7877 7877 D monodroid: Enabling Mono Interpreter
01-22 17:53:24.744 7877 7877 D monodroid: Probing if we should use LLVM
01-22 17:53:24.744 7877 7877 W monodroid: runtime args empty
01-22 17:53:24.744 7877 7877 I monodroid-gc: environment supports jni NewWeakGlobalRef
Activity