Skip to content

Bump to dotnet/java-interop/main@6bc87e8b #9761

New issue

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

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

Already on GitHub? # to your account

Merged
merged 5 commits into from
Feb 7, 2025
Merged

Conversation

jonpryor
Copy link
Member

@jonpryor jonpryor commented Feb 6, 2025

Context: #9747

Changes: dotnet/java-interop@dd3c1d0...6bc87e8

dotnet/java-interop@6bc87e8b is needed to unblock parts of #9747.

Additionally, two "quality of life" changes:

Firstly, update the src/Mono.Android build so that if there are
API breaks reported, the breakage is collated into
src/Mono.Android/ApiCompatLinesToAdd.txt in a format that can be
directly copied into
tests/api-compatibility/acceptable-breakages-vReference-*.txt if
deemed useful.

Previously, all changes were printed to the build log, which was
annoying to deal with because (1) there may be duplicates, and
(2) the lines would contain TaskId/etc. "noise" that would need to
be removed in order to be used.

Secondly, update build-tools/xaprepare to improve reliability when
running Step_InstallDotNetPreview. Step_InstallDotNetPreview
will cache e.g. dotnet-install.sh into $HOME/android-archives,
but there was no logic to verify that it was still valid.

We've been seeing some recurring build failures in macOS > Build
such as:

Downloading dotnet-install script...
Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
Downloading dotnet archive...
dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
Downloading dotnet archive...
dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
Downloading dotnet archive...
Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
Downloading dotnet archive...
Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
  Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.

Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
   at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
   at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
   at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155

Indeed, dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz
no longer exists on https://dotnetcli.azureedge.net.

The problem, though, is that .NET changed the CDN that is used in the
past month, and that's not the correct URL. A newer dotnet-install.sh
reports:

% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
…
dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz

Note the different domain, https://builds.dotnet.microsoft.com!

Update Step_InstallDotNetPreview to try to install .NET potentially
twice: the first time using the cached dotnet-install.sh, and
if that fails, it tries again after downloading a new
dotnet-install.sh.

Hopefully this will fix the build failure on this machine!

Does It Build™?
@jonpryor
Copy link
Member Author

jonpryor commented Feb 6, 2025

"The perfect is the enemy of the good [enough]." Do we really need to change [Register] to contain Reflection-compatible names, as is done in dotnet/java-interop#1301 and #9750?

Or will a much more targeted change to jcw-gen be sufficient?

If (when?) an API change is made to Mono.Android.dll,
`src/Mono.Android/ApiCompatLinesToAdd.txt` will be created containing
the lines that need to be added to e.g.
`tests/api-compatibility/acceptable-breakages-vReference-*.txt`
so that the changes are ignored.

These lines can then be easily copied into
`acceptable-breakages-vReference-*.txt` if deemed useful.

Previously, *all* changes were printed to the build log, which was
annoying to deal with because (1) there may be duplicates, and
(2) the lines would contain `TaskId`/etc. "noise" that would need to
be removed in order to be used.
Context: #9761
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=10967971&view=logs&j=54890acb-4627-5ef0-3b6b-f3b3aa2a1f64&t=c15bce3e-6894-5f6e-fad7-4116b0f4ba81

The **macOS > Build** stage is failing -- after 3 retries! --
because it can't install .NET:

	Downloading dotnet-install script...
	Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
	Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	  Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.

	Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	   at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
	   at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
	   at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155

Indeed, [`dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz`][0]
doesn't exist on <https://dotnetcli.azureedge.net>.

The problem, though, is that .NET changed the CDN that is used in the
past month, and that's not the correct URL.  A newer `dotnet-install.sh`
report:

	% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
	…
	dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
	dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz

Note the different domain, <https://builds.dotnet.microsoft.com>!

@jonpryor believes that the cached `dotnet-install.sh` script on
this particular build machine is too old.

Update `Step_InstallDotNetPreview` to try to install .NET potentially
*twice*: the first time using the cached `dotnet-install.sh`, and
*if that fails*, it tries again after downloading a *new*
`dotnet-install.sh`.

Hopefully this will fix the build failure on this machine!

[0]: https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz
@jonpryor jonpryor marked this pull request as ready for review February 7, 2025 01:41
@jonpryor jonpryor requested a review from grendello as a code owner February 7, 2025 01:41
@jonpryor
Copy link
Member Author

jonpryor commented Feb 7, 2025

Draft commit message:

Bump to dotnet/java-interop/main@6bc87e8b (#9761)

Context: https://github.com/dotnet/android/pull/9747

Changes: https://github.com/dotnet/java-interop/compare/dd3c1d0514addfe379f050627b3e97493e985da6...6bc87e8b55bc00ae1423a5ae92cf5db573fc76ed

  * dotnet/java-interop@6bc87e8b: [jcw-gen] Use `+` for nested types, not `/` (dotnet/java-interop#1304)

dotnet/java-interop@6bc87e8b is needed to unblock parts of #9747.

Additionally, two "quality of life" changes:

Firstly, update the `src/Mono.Android` build so that if there are
API breaks reported, the breakage is collated into 
`src/Mono.Android/ApiCompatLinesToAdd.txt` in a format that can be
directly copied into 
`tests/api-compatibility/acceptable-breakages-vReference-*.txt` if
deemed useful.

Previously, *all* changes were printed to the build log, which was
annoying to deal with because (1) there may be duplicates, and
(2) the lines would contain `TaskId`/etc. "noise" that would need to
be removed in order to be used.

Secondly, update `build-tools/xaprepare` to improve reliability when
running `Step_InstallDotNetPreview`.  `Step_InstallDotNetPreview`
will cache e.g. `dotnet-install.sh` into `$HOME/android-archives`,
but there was no logic to verify that it was still *valid*.

We've been seeing some recurring build failures in **macOS > Build**
such as:

	Downloading dotnet-install script...
	Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
	Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	  Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.

	Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	   at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
	   at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
	   at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155

Indeed, [`dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz`][0]
no longer exists on <https://dotnetcli.azureedge.net>.

The problem, though, is that .NET changed the CDN that is used in the
past month, and that's not the correct URL.  A newer `dotnet-install.sh`
reports:

	% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
	
	dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
	dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz

Note the different domain, <https://builds.dotnet.microsoft.com>!

Update `Step_InstallDotNetPreview` to try to install .NET potentially
*twice*: the first time using the cached `dotnet-install.sh`, and
*if that fails*, it tries again after downloading a *new*
`dotnet-install.sh`.

Hopefully this will fix the build failure on this machine!

[0]: https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz

@jonpryor jonpryor requested a review from jpobst February 7, 2025 01:49
@jonpryor jonpryor changed the title Try dotnet/java-interop#1304 Bump to dotnet/java-interop/main@6bc87e8b Feb 7, 2025
@@ -21,7 +21,8 @@ protected override async Task<bool> Execute (Context context)
var dotnetPath = Configurables.Paths.DotNetPreviewPath;
dotnetPath = dotnetPath.TrimEnd (new char [] { Path.DirectorySeparatorChar });

if (!await InstallDotNetAsync (context, dotnetPath, BuildToolVersion)) {
if (!await InstallDotNetAsync (context, dotnetPath, BuildToolVersion, useCachedInstallScript: true) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way of doing this? Can we not get the hash or crc32 of the file we want to download and compare it to the cached version?

using curl -I https://raw.githubusercontent.com/dotnet/install-scripts/refs/heads/main/src/dotnet-install.sh

We get an etag field we might be able to use to compare.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eg etag: "b2ba8c3f17e539ba16047ec26d7eb3cb58841bdc40aa0a27aab055feab567d1b"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could store the etag locally and compare it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Unfortunately the curl -I https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh does't return an etag :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh it does etag: 0x8DD34C45DC46329 but its different

@jonpryor jonpryor merged commit a941e34 into main Feb 7, 2025
58 checks passed
@jonpryor jonpryor deleted the dev/jonp/jonp-try-ji-1304 branch February 7, 2025 14:40
grendello added a commit that referenced this pull request Feb 10, 2025
* main:
  [Mono.Android] `JNIEnv.FindClass()` uses `JniEnvironment.Types.FindClass()` (#9769)
  [Mono.Android] `JavaList.Add` should allow duplicates. (#9751)
  Bump to dotnet/java-interop@6bc87e8b (#9761)
jonathanpeppers pushed a commit that referenced this pull request Feb 11, 2025
Partial backport of #9761

Update `build-tools/xaprepare` to improve reliability when
running `Step_InstallDotNetPreview`.  `Step_InstallDotNetPreview`
will cache e.g. `dotnet-install.sh` into `$HOME/android-archives`,
but there was no logic to verify that it was still *valid*.

We've been seeing some recurring build failures in **macOS > Build**
such as:

	Downloading dotnet-install script...
	Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
	Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	  Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.

	Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	   at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
	   at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
	   at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155

Indeed, [`dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz`][0]
no longer exists on <https://dotnetcli.azureedge.net>.

The problem, though, is that .NET changed the CDN that is used in the
past month, and that's not the correct URL.  A newer `dotnet-install.sh`
reports:

	% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
	…
	dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
	dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz

Note the different domain, <https://builds.dotnet.microsoft.com>!

Update `Step_InstallDotNetPreview` to try to install .NET potentially
*twice*: the first time using the cached `dotnet-install.sh`, and
*if that fails*, it tries again after downloading a *new*
`dotnet-install.sh`.

Hopefully this will fix the build failure on this machine!

[0]: https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz
jonathanpeppers pushed a commit that referenced this pull request Feb 11, 2025
Partial backport of #9761

Update `build-tools/xaprepare` to improve reliability when
running `Step_InstallDotNetPreview`.  `Step_InstallDotNetPreview`
will cache e.g. `dotnet-install.sh` into `$HOME/android-archives`,
but there was no logic to verify that it was still *valid*.

We've been seeing some recurring build failures in **macOS > Build**
such as:

	Downloading dotnet-install script...
	Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
	Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	  Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.

	Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	   at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
	   at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
	   at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155

Indeed, [`dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz`][0]
no longer exists on <https://dotnetcli.azureedge.net>.

The problem, though, is that .NET changed the CDN that is used in the
past month, and that's not the correct URL.  A newer `dotnet-install.sh`
reports:

	% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
	…
	dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
	dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz

Note the different domain, <https://builds.dotnet.microsoft.com>!

Update `Step_InstallDotNetPreview` to try to install .NET potentially
*twice*: the first time using the cached `dotnet-install.sh`, and
*if that fails*, it tries again after downloading a *new*
`dotnet-install.sh`.

Hopefully this will fix the build failure on this machine!

[0]: https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz
jonathanpeppers added a commit that referenced this pull request Feb 12, 2025
Context: #9761

Partial backport of a941e34

Update `build-tools/xaprepare` to improve reliability when
running `Step_InstallDotNetPreview`.  `Step_InstallDotNetPreview`
will cache e.g. `dotnet-install.sh` into `$HOME/android-archives`,
but there was no logic to verify that it was still *valid*.

We've been seeing some recurring build failures in **macOS > Build**
such as:

	Downloading dotnet-install script...
	Warning: Using cached installation script found in '/Users/builder/android-archives/dotnet-install.sh'
	Discovering download URLs for dotnet SDK '10.0.100-preview.2.25102.3'...
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz not found
	Downloading dotnet archive...
	dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-arm64.10.0.100-preview.2.25102.3.tar.gz not found
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	Downloading dotnet archive...
	Warning: Failed to obtain dotnet archive size. HTTP status code: InternalServerError (500)
	  Error: Installation of dotnet SDK '10.0.100-preview.2.25102.3' failed.

	Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed
	   at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Scenario.cs:line 50
	   at Xamarin.Android.Prepare.Context.Execute() in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:line 488
	   at Xamarin.Android.Prepare.App.Run(String[] args) in /Users/builder/azdo/_work/8/s/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:line 155

Indeed, [`dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz`][0]
no longer exists on <https://dotnetcli.azureedge.net>.

The problem, though, is that .NET changed the CDN that is used in the
past month, and that's not the correct URL.  A newer `dotnet-install.sh`
reports:

	% bash "…/dotnet-install.sh" "--version" "10.0.100-preview.2.25102.3" "--install-dir" "/Volumes/Xamarin-Work/src/dotnet/android/bin/Release/dotnet" "--verbose" "--dry-run
	…
	dotnet-install: Link 0: primary, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 1: legacy, 10.0.100-preview.2.25102.3, https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz
	dotnet-install: Link 2: primary, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-x64.tar.gz
	dotnet-install: Link 3: legacy, 10.0.100-preview.2.25102.3, https://ci.dot.net/public/Sdk/10.0.100-preview.2.25102.3/dotnet-dev-osx-x64.10.0.100-preview.2.25102.3.tar.gz

Note the different domain, <https://builds.dotnet.microsoft.com>!

Update `Step_InstallDotNetPreview` to try to install .NET potentially
*twice*: the first time using the cached `dotnet-install.sh`, and
*if that fails*, it tries again after downloading a *new*
`dotnet-install.sh`.

Hopefully this will fix the build failure on this machine!

[0]: https://dotnetcli.azureedge.net/dotnet/Sdk/10.0.100-preview.2.25102.3/dotnet-sdk-10.0.100-preview.2.25102.3-osx-arm64.tar.gz

Co-authored-by: Jonathan Pryor <jonpryor@vt.edu>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants