"enableJsonMode": true
"seed": 1234
in unit testsThis made things worse! Just leaving this here for now.
Context: https://github.com/dwyl/english-words
I uploaded a text file of every English word, and asked ChatGPT 4 to classify it:
This is a document with every English word. You are an expert software
engineer that is particularly good at writing well written, thoughtful
code r...
This removes various linker sources that are no longer used in xamarin-android/main and .NET 9. These shouldn't actually affect any .dll
/ binaries we produce, but merely reorganizes and removes files.
Delete unused *.cs
files
Delete unused *.xml
files
Move appropriate *.cs
...
Context: https://github.com/xamarin/xamarin-android/issues/8421
Reviewing the build log from:
dotnet new maui
dotnet build -f net8.0-android -bl
I noticed:
LinkAssembliesNoShrink 3.410s
...
Failed to read 'C:\Program Files\dotnet\packs\Microsoft.Android.Runtime....
Fixes: https://github.com/xamarin/xamarin-android/issues/8331
Building a net8.0-android33
project, currently fails with:
error NETSDK1181: Error getting pack version: Pack 'Microsoft.Android.Ref.33' was not present in workload manifests.
C:\Program Files\dotnet\sdk\8.0.100-previe...
When running MSBuild tests locally, both of the paths used for:
/p:AndroidSdkDirectory="C:\Some Path\android-sdk\"
/p:JavaSdkDirectory="C:\Some Path\jdk\"
Because the two paths have a trailing \
, it appears that MSBuild is escaping the \"
giving an error message that we can't b...
Context: https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet9
We need to start pushing xamarin-android/main to the dotnet9
feed going forward.
Switch to using the dnceng-dotnet9
credentials, which we'll have to work with someone in release engineering to help setup.
dotnet publish
doesn't do anything extra for publishing on Android except copy files to the publish
directory. dotnet publish
does have a nice convenience of defaulting to Release
mode, though.
I think it would be useful to mention that you can just use dotnet build
if desired.
"enableJsonMode": true
"seed": 1234
in unit testsContext: https://github.com/dwyl/english-words
I uploaded a text file of every English word, and asked ChatGPT 4 to classify it:
This is a document with every English word. You are an expert software
engineer that is parti...
Previously, we were calling dotnet pack
serially for many projects, such as:
<Exec Command="&quot;$(DotNetPreviewTool)&quot; pack ... &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
This ends up taking a while:
Target CreateAllPacks 52.127s
Task E...
Reviewing dotnet-trace
output:
dotnet trace collect --format speedscope -- C:\src\xamarin-android\bin\Release\dotnet\dotnet.exe build -bl --no-restore bar.csproj
On a dotnet new maui
application, I noticed:
79.40ms java.interop.tools.javacallablewrappers!Java.Interop.Tools.Ty...
provisionator
is a source of random failures like:
[21:41:23 ERR] Error X...
In reviewing:
https://github.com/dotnet/maui/issues/10901#issuecomment-1354975448
I found Xamarin.AndroidX.Legacy.Support.V4
triggers the warning:
R8 : warning : Missing class androidx.window.extensions.WindowExtensions
AndroidX.Legacy.Support.V4
is a package for supporting *r...
Context: https://github.com/dotnet/linker/issues/3165#issuecomment-1358680001
In 2a10e969, I added a workaround for new linker behavior.
It turns out I should have used All
instead of Library
for now.
The original issue is still under discussion.
Fixes: https://github.com/dotnet/maui/issues/11885
Looking at the JITStats report in PerfView (for MSBuild.exe):
Name | JitTime (ms) |
---|---|
Microsoft.Maui.Controls.Build.Tasks.dll | 214.0 |
dotnet trace
of a dotnet new maui
project, I noticed this was happening on any build:
65.94ms xamarin.android.build.tasks!Xamarin.Android.Tasks.CheckClientHandlerType.RunTask()
This was added in 311b41e8, so it is only in main & .NET 8.
Looking at the stack trace, most of the t...
Reviewing dotnet trace
output for a dotnet new maui
app:
dotnet trace collect --format speedscope -- .\bin\Release\dotnet\dotnet.exe build -bl --no-restore foo.csproj
8.6% of the time in <GenerateJavaStubs/>
is spent in:
93.81ms xamarin.android.build.tasks!Xamarin.Android.T...
Fixes: https://github.com/jonathanpeppers/inclusive-code-reviews-ml/issues/126
I think we had lots of example of "I'm stupid", and so it wasn't catching things like "You're stupid".
Fixes: https://github.com/jonathanpeppers/inclusive-code-reviews-browser/issues/178
Common phrases are:
Fixes: https://github.com/dotnet/maui/issues/10154
If you have a solution setup with:
ApplicationA
project reference ->LibraryB
reference ->LibraryC
The app will crash at runtime, due to a missing LibraryC.dll
.
You can solve the problem by changing @(Reference)
to ...
Fixes: https://github.com/dotnet/maui/issues/10901
Building a .NET MAUI project such as:
dotnet new maui
dotnet build -c Release -f net6.0-android -p:AndroidLinkMode=r8
Results in build warnings from R8 such as:
R8 : warning : Missing class androidx.window.extensions.Wind...
dotnet-trace
of a dotnet new maui
app:
dotnet trace collect --format speedscope -- C:\src\xamarin-android\bin\Release\dotnet\dotnet.exe build -bl --no-restore bar.csproj
Shows some interesting time spent in:
179.53ms java.interop.tools.cecil!Java.Interop.Tools.Cecil.Directory...
Reviewing dotnet trace
output for a dotnet new maui
app:
dotnet trace collect --format speedscope -- .\bin\Release\dotnet\dotnet.exe build -bl --no-restore foo.csproj
21% of the time in <GenerateJavaStubs/>
is spent in:
249.60ms xamarin.android.build.tasks!Xamarin.Android.T...
Context: https://github.com/xamarin/yaml-templates/pull/204 Context: https://github.com/xamarin/xamarin-android/pull/7471
Updates the VSMAN files generated for our .NET workload to support Visual Studio on windows-arm64.
Context: https://github.com/dotnet/maui/issues/11090 Context: https://github.com/xamarin/yaml-templates/pull/204 Context: https://github.com/xamarin/xamarin-android/pull/7471 Context: https://github.com/xamarin/xamarin-macios/pull/16935
Updates the VSMAN files g...
Use latest version of the model.
Backport of: https://github.com/xamarin/xamarin-android/pull/7602 Changes: https://github.com/xamarin/xamarin-android/compare/9bf238f0f3eb5436cf9f9236327c3315bfc6689e...619ab7a92a09825ecb274bf87d8086d2dbe63aea
Other changes:
Running PerfView on Windows in a .NET MAUI app, I can see this taking up time inside the <GenerateJavaStubs/>
MSBuild task:
Name | Inc % | Inc |
---|---|---|
java.interop.tools.javacallablewrappers!Java.Interop.Tools.JavaCallableWrappers.JavaCallableWrapperGenerator..ctor() | ... |
dotnet-trace
output of a dotnet new maui
app:
dotnet trace collect --format speedscope -- C:\src\xamarin-android\bin\Release\dotnet\dotnet.exe build -bl --no-restore bar.csproj
Shows an interesting case of File.Exists()
:
49.88ms xamarin.android.build.tasks!Xamarin.Android.T...
Fixes: https://github.com/jonathanpeppers/inclusive-code-reviews-browser/issues/172
We can always bring this back if we change our mind.
We got this response from an internal Microsoft email:
> However, after further research and discussion, we are not currently > planning to publish gu...
Context: https://docs.github.com/en/actions/security-guides/encrypted-secrets
The secrets will be blank on PRs from forks.
Let's just set it up so the tests are runnable & they skip when values are blank.
Fixes: https://github.com/jonathanpeppers/inclusive-code-comments/issues/48
This was doing length: text.length - 1
, which didn't seem to be right.
Removing the -1
fixed the issue, and I updated a test for this.

is no longer needed.
This is mainly checking the latest packages work with .NET 6.
This mainly addresses project names like foo Ümläüts
.
I committed a locally built MonoAOTCompiler.dll
with changes.
Building a .NET 6 Release
app with UseInterpreter=true
and
RunAOTCompilation=true
would fail with:
Microsoft.Android.Sdk.Aot.targets(71,5): Unknown Mode value: Interpreter. 'Mode' must be one of: Normal,JustInterp,Full,FullInterp,Hybrid,LLVMOnly,LLVMOnlyInterp
Reviewing the code:...
Context: https://docs.microsoft.com/dotnet/core/install/windows#download-and-manually-install
I have VS main installed, and my system has:
> dotnet --version
6.0.200-preview.21573.3
And so any built-in ~\android-toolchain\dotnet\dotnet.exe
commands
would actually run my syste...
To improve startup performance, if you have the android-aot
workload
installed, for Release
builds:
Default $(RunAOTCompilation)
to true
Default $(AndroidEnableProfiledAot)
to true
.
Going forward, you would have to explicitly turn these off if you want them to be off....
Context: https://github.com/dotnet/runtime/issues/57800
dotnet/runtime#57800 is fixed.
We are in a situation where:
.NET MAUI is still in preview.
We need dotnet/runtime fixes for MAUI, but we don't necessarily want all fixes going into .NET 6 service releases.
Since we are relying on optional workload packs from dotnet/runtime anyway, we can simply use "differe...
It is possible for us to not require the Android NDK to be installed, but we have checks in place that would emit errors.
To make it possible to build with AOT without the NDK:
Make a NullNdkTools
class to use when an NDK is not found.
Make the NDK only actually required when `$...
When doing a Visual Studio insertion, we hit a build errors complaining some packs don't have owners.
The rules matched patterns like:
Microsoft.Android.Ref*
Microsoft.Android.Runtime*
Microsoft.Android.Sdk*
We decided to rename the packs to match the above patterns, as we...
I was looking at a build log and noticed:
Mono: AOT: FOUND method System.Threading.Thread:GetCurrentCultureNoAppX () [0x1120b7eb0 - 0x1120b7f82 0x1124d0e98]
Mono: AOT: FOUND method System.Globalization.CultureInfo:get_UserDefaultCulture () [0x1123d0750 - 0x1123d0772 0x1124e2be7]
...
Fixes: https://github.com/xamarin/xamarin-android/issues/6545
If you do:
<PackageReference Include="SkiaSharp" Version="2.80.3" />
You end up with 13MB .dll
file with C# code inside! The class
library is redistributing the SkiaSha...
This avoids the missing .NET 6 install for the tests.
The macOS image has .NET 5 as the latest right now:
We have a beautiful .NET 6 API we can use instead, that doesn't call into Java (no JNI!):
https://docs.microsoft.com/dotnet/api/system.operatingsystem.isandroidversionatleast
Usage of Build.VERSION.SdkInt
came from both Xamarin.Forms and
Xamarin.Essentia...
This reverts 291a43e2a7fcf91bb73499e0b2b50c3b09d0cc29.
Initially, we were trying to make some workload packs optional in .NET
6. And so we put bundletool.jar
in its own pack.
Today, this is not really ideal, because:
Release
builds...Fixes: https://github.com/xamarin/XamarinComponents/issues/1312
If you do:
$ mkdir foo ; cd foo
$ dotnet new mauilib
$ dotnet pack
You end up redistributing com.google.common.util.concurrent.ListenableFuture
in your MAUI class library NuGet package:
We have a private mirror, for servicing security fixes, or testing builds of .NET with security fixes.
By default, the private mirror, xamarin-android-private
is checking
out into:
Finishing: Checkout xamarin/xamarin-android-private@main to s/xamarin-android-private
Which causes ...
I was looking at PopulateKeys()
and a couple things seemed odd:
It is protected
? It doesn't seem like this should be a "public"
API folks use.
It has a ref returnList
parameter? But doesn't actually use it?
It uses the _updateKeys
member variable, but doesn't return it?...
This is one idea from dotnet/maui#3249, that I abandoned (for now)
because making Microsoft.Maui.dll
fully trimmable is a larger task
that I realized.
These two APIs are problematic for dotnet/linker to be able to
statically analyze Microsoft.Maui.dll
:
...
This brings over more changes from xamarin-android-private
.
With these changes, the private fork should be able to build main
and push builds to an internal feed.
I also set $(TeamName)
, which isn't used here -- but will be needed when consuming internal .NET builds on the private fork.
Fixes: https://github.com/dotnet/runtime/issues/56163
PR #58523 fixed something on Windows, but it didn't actually address our issues on Android.
A directory name like foo Ümläüts
fails:
mkdir 'foo Ümläüts' ; cd 'foo Ümläüts'
dotnet new android
When profiling a dotnet new maui
app, with this package:
https://github.com/jonathanpeppers/Mono.Profiler.Android
The alloc
report shows:
Allocation summary
Bytes Count Average Type name
39984 147 2 72 Microsoft.Maui.Con...
Previously we were calculating:
public static bool HasRtlSupport(this Context self)
{
if (self == null)
return false;
return (self.ApplicationInfo?.Flags & AApplicationInfoFlags.SupportsRtl) == AApplicationInfoFlags.Sup...
Context: https://github.com/xamarin/xamarin-android/pull/2463
When running:
msbuild Java.Interop.sln /t:Prepare
We are hitting a similar error on the latest version of NuGet that we saw in Xamarin.Android:
src\java-interop\java-interop.csproj(29,3): error MSB4019:
Th...
Context:
First issue we are hitting is a missing version of Cake on MyGet:
Unable to find version '0.23.0' of package 'Cake'.
https://www.myget.org/F/cake/api/v3/index.json: Package 'Cake.0.23.0' is not found on source 'https://www.myget.org/F/cake/api/v3/index.json'.
To fix t...
Context: https://github.com/xamarin/xamarin-android/pull/2546 Changes: https://github.com/xamarin/xamarin-android-api-compatibility/compare/ec562e9...3fe4561
Bumps to xamarin/xamarin-android-api-compatibility/master@3fe4561
This partially reverts 0f91aea.
In #2546, we experienced a bit ...
Changes: https://github.com/xamarin/java.interop/compare/6c5b4ea...c987483
[jcwgen] add public method for GetDestinationPath
This is needed to cherry-pick c362fe5.
We are seeing this on non-Windows platforms:
make: *** No rule to make target 'external//r8/LICENSE', needed by 'ThirdPartyNotices.txt'. Stop.
It turns out that if you put a LICENSE
file in src
, things don't
quite work right.
This license should just be specified with `<License...
Context: https://github.com/xamarin/xamarin-android/pull/2505
This is based on #2505, but I incorporated the java.interop changes so
GenerateJavaStubs
uses no temp files at all.
In many places throughout the Xamarin.Android build, we have a pattern of:
The version used was from 6/12/2017!
Changes: https://github.com/xamarin/java.interop/compare/706e4cc...b57d770
[Java.Interop] Target .NET Standard 2.0
[jcwgen] add public method for GetDestinationPath
Context: http://build.devdiv.io/2271113 Context: http://www.tugberkugurlu.com/archive/efficiently-streaming-large-http-responses-with-httpclient
We are still getting random OOM errors on Windows/VSTS:
android-toolchain.targets(52,5): Error : Unable to download URL `https://dl.google.co...
Downstream in monodroid, we are getting a build failure such as:
Generator.cs(4,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
Generator.cs(222,10): error CS0246: The type or namespace name 'HashSe...
In 1fb7983, a new HelloLibrary.csproj
was added, but it had some
settings that cause pdb2mdb
to run:
<DebugType>full</DebugType>
...
<DebugType>pdbonly</DebugType>
I switched the "Hello World" projects to use $(DebugType)
portable
,
so that portable pdb files are alwa...
Context: http://build.devdiv.io/2255858
On VSTS, I've been occasionally seeing:
android-toolchain.targets(47,5): Error : Unable to download URL `https://dl.google.com/android/repository/android-ndk-r14b-windows-x86_64.zip` to `C:\Users\dlab14\android-archives\android-ndk-r14b-windows-x8...
Changes: https://github.com/grendello/LibZipSharp/compare/d695149...de1712c
ZipEntry.FullName
was normalizing paths to always use /
as a directory separator. This normalization now happens later, instead of at the time of reading a zip file.
A Rename
method was added, to make it possi...
Downstream in monodroid (commerical product), this test is failing:
Failed : Xamarin.Android.Build.Tests.IncrementalBuildTest.ProduceReferenceAssembly
`_BuildApkEmbed` should *not* be skipped!
When "Fast Deployment" is enabled, the _BuildApkFastDev
MSBuild
target runs instea...
In many places throughout the Xamarin.Android build, we have a pattern of:
MonoAndroidHelper.CopyIfChanged
to put the file in the
destination. This reads both files, doing a hash comparison before
deciding to write or not.Som...
We want the Mono upgrade to run before we run /t:Restore
.
In one case downstream in monodroid, we encountered:
error MSB4244: The SDK resolver assembly "/Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin/SdkResolvers/Microsoft.Build.NuGetSdkResolver/..\..\M...
Fixes https://github.com/mono/mono/issues/10602 .
From the issue:
We need to enable this to support the system assemblies conflict
resolution which we now rely on for any new packages to enhance
developers experience and get us out of dependency on specific package
versions.
T...
This reverts commit 2e682251c3942f2323ec39b21830b39fd74bbf67.
I neglected to test this change in Mono.Android.csproj
!
Let's revert this change, and I will look into another fix for the AndroidX problem. It will likely happen after we branch.
Since 0f91aea5 enabled aapt2 support by default, the following test has been failing on Windows:
Xamarin.Android.Build.Tests.BuildAssetsTest.CheckAssetsAreIncludedInA...
Context: https://github.com/Microsoft/perfview
When reviewing the .NET exception report in PerfView, I noticed a
FileNotFoundException
thrown for every assembly such as:
Throw(System.IO.FileNotFoundException) Could not find file 'samples\HelloWorld\bin\Debug\HelloWorld.dll.mdb'.
A...
Downstream in monodroid, we are seeing an issue with "Fast Deployment":
This started happening in 539954c, since I corrected the directory
that _LinkAssembliesNoShrink
was touchin...
Context: https://github.com/xamarin/xamarin-android/pull/2505#issuecomment-445374019
In a world order where we are creating less temp files in
Xamarin.Android, it would be nice to leverage an overload of
JavaCallableWrapperGenerator
that uses a TextWriter
in memory.
Currently we are d...
Context: https://github.com/xamarin/xamarin-android/pull/2481
The changes in #2481 showcase a problem with xabuild.
Take the following example:
<MicrosoftNETBuildExtensionsTargets Condition="'$(MicrosoftNETBuildExtensionsTargets)' == ''">$(MSBuildExtensionsPath)\Microsoft\Microsoft.N...
Fixes: https://github.com/jonathanpeppers/glidex/issues/19 Context: https://github.com/xamarin/Xamarin.Forms/blob/94e6621f72cf3b19585253427aae4b70ba66af55/Xamarin.Forms.Platform.Android/Material/MaterialFrameRenderer.cs#L41
The problem surfaces when:
If the _ValidateResourceCache
MSBuild target deems the cache file
invalid:
<Delete Files="$(_AndroidResourcePathsCache)" Condition=" '$(_IsResourceCacheValid)' == 'False' " />
The problem is that the _BuildAdditionalResourcesCache
will be
skipped!
<Target Name="_BuildAdditi...
When reviewing ResolveLibraryProjectImports
, I noticed a few things
we could improve:
GetResourceData
to get the entire contents of a file
as a byte[]
and then writing to disk.Context: http://build.devdiv.io/2279876&view=ms.vss-test-web.test-result-details
There are about 5 tests that seem to fail a lot on new build machines.
The errors are generally related to file sharing:
The last access/last write time on file "C:\Users\dlab14\.nuget\packages\xamarin.f...
During a NuGet restore:
msbuild foo.android.csproj /t:Restore
The _SetLatestTargetFrameworkVersionForPackageReference
MSBuild
target triggers _SetLatestTargetFrameworkVersion
and some tasks to
run:
<ResolveSdks/>
<ValidateJavaVersion/>
<ResolveAndroidTooling/>
...
Context: https://github.com/xamarin/xamarin-android/issues/2501
This reverts one line of 0f91aea.
We have a circular dependency problem with aapt2...
<Aapt2Compile/>
creates *.flata
files, but needs
<ConvertCustomView/>
to have run.<GenerateJavaStubs/>
creates `acw-map.t...Fixes: http://work.devdiv.io/707557
In 539954c, I was aiming to remove the
_RegisterAndroidFilesWithFileWrites
MSBuild target (runs only on
Windows). I was having trouble getting everything to work, so I undid
this change to make the PR smaller.
Reasons to remove `_RegisterAndroidFiles...
Since c93a8af changed some projects to netstandard 2.0, we also need this project to be 4.6.1:
Microsoft.Common.CurrentVersion.targets(2110,5): Warning MSB3274: The primary reference "E:\A\_work\34\s\external\Java.Interop\bin\Debug\Xamarin.Android.Tools.ApiXmlAdjuster.dll" could not be re...
Downstream in monodroid, we are getting a build error during a
Release
build:
xamarin-android/src/libzip/libzip.targets(16,5): error MSB4062: The "Xamarin.Android.BuildTools.PrepTasks.GitCommitTime" task could not be loaded from the assembly xamarin-android/build-tools/scripts/../../bin...
Context: http://build.devdiv.io/2288139
A build on VSTS hit the error:
Error MSB4018: The "ResolveAndroidTooling" task failed unexpectedly. [E:\A\_work\165\s\tests\TestRunner.Core\TestRunner.Core.csproj]
Error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of ...
Context: https://docs.microsoft.com/en-us/visualstudio/profiling/beginners-guide-to-performance-profiling
Using the CPU usage tool in Visual Studio (profiler), I could see the
percentage of time spent in various methods during the
<GenerateJavaStubs/>
task.
The first "hot spot" I found ...
Context: https://www.reddit.com/r/androiddev/comments/a4wpuk/for_anyone_wondering_about_todays_failed_builds/ Context: https://mvnrepository.com/artifact/com.android.tools/r8/1.2.52
We are currently building r8 from source, which has been failing on occasion:
04:31:34 _BuildR8:
0...
Fixes: http://feedback.devdiv.io/346386
It was reported that cancelling a build while AOT was running, would not cancel until AOT finished. Testing in VS Windows 15.9, I could reproduce this behavior.
Reviewing the <Aot/>
MSBuild task, it had use of a
CancellationTokenSource
that kil...