Teach our bgen to ignore those types that have been marked as a rgen
BindingType. The code adds a new smart enum in the sources that should
not be processed by bgen and therefore should not have the smart enum
extension method. You can verify that this is try by looking at the API
diff:
<img width="560" alt="Screenshot 2024-10-15 at 14 58 00"
src="https://github.com/user-attachments/assets/83790ae6-d94a-424f-8f70-e33bde7c4f22">
Context: b2d3a3a355
Context: https://github.com/xamarin/yaml-templates/pull/339
The VS insertion manifest generation has been updated to use new VS
component IDs required for .NET 9+.
Backport of #21423
---------
Co-authored-by: Peter Collins <pecolli@microsoft.com>
This has a few advantages:
* We simplify and unify more of our code.
* We have more control over the error reporting / logging behavior.
Additionally:
* Use 'xcrun' to invoke 'metal' and 'metallib' (partial fix for #3931).
* Allow for overriding the path to the command-line tool in question.
* Add support for cancellation.
* Fix nullability.
Fixes https://github.com/xamarin/xamarin-macios/issues/21437.
The existing Objective-C class to request an App Store review (SKStoreReviewController) is deprecated in Xcode 16+, and it doesn't even work on the corresponding OS versions.
The replacement API is Swift-only, but luckily it's a very simple API (just a static method), so it's possible to bind it manually.
This required a few other changes/improvements:
* Add support for Swift code in our runtime.
* Just to keep the changes to a minimum, bump the min OS version for legacy code to match the .NET min OS versions. This is because our build logic uses the legacy min versions when compiling native code (a more involved fix would be to update all the build logic to build native code to use the .NET min OS versions, but that's not the point of this PR, so I took the easy route). Fixes#10659.
I've tested the method locally, and it seems to work fine, but I've still marked
it as experimental for now. There are no unit tests because calling the method will
put up a dialog, which won't work correctly in unit tests.
Fixes https://github.com/xamarin/xamarin-macios/issues/21410.
Fixes https://github.com/xamarin/xamarin-macios/issues/10659.
Here's an example failure that didn't stop the build:
Target Name=_RunILLink Project=sampleproj.csproj
Building target "_RunILLink" completely.
Output file "obj\Release\net8.0-ios\ios-arm64\linked\Link.semaphore" does not exist.
[...]
Xamarin.MacDev.Tasks.ILLink
[...]
C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net8.0_17.5\17.5.8030\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(364,3): [xma][err]: An exception occurred in the task 'ILLink'
C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net8.0_17.5\17.5.8030\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(364,3): The post for client build1460814608Ilian on topic xvs/build/1.14.0.6/execute-task/ecacau/de6ed16002fILLink has been cancelled
at Xamarin.Messaging.Client.MessagingClient.PostAsync[TRequest,TResponse](TRequest message, String topic, MessagePriority priority, CancellationToken cancellationToken, Boolean retain, Int32 timeoutSecs) in D:\a\_work\1\s\src\Xamarin.Messaging.Client\MessagingClient.cs:line 231
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ExecuteWithRetryAsync[TResult](Func`1 executeDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 57
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ThrowIfConnected(ExceptionDispatchInfo exceptionInfo, IMessagingAnalyticsAction analytics) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 149
at Xamarin.Messaging.Ssh.MessagingRunnerPro.HandleExceptionAsync[TResult](ExceptionDispatchInfo exceptionInfo, Func`1 reentrancyDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 97
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ExecuteWithRetryAsync[TResult](Func`1 executeDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 64
at Xamarin.Messaging.Ssh.MessagingRunnerPro.HandleExceptionAsync[TResult](ExceptionDispatchInfo exceptionInfo, Func`1 reentrancyDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 103
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ExecuteWithRetryAsync[TResult](Func`1 executeDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 64
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ExecuteWithRetryAsync[TResult](Func`1 executeDelegate, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 39
at Xamarin.Messaging.Ssh.MessagingClientPro.PostAsync[TMessage,TResult](TMessage request, CancellationToken cancellationToken, Boolean retain, Int32 timeoutSecs) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingClientPro.cs:line 144
at Xamarin.Messaging.Build.Client.BuildClient.RunMessagingAsync[TMessage,TResult](TMessage message, Int32 timeoutSecs) in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildClient.cs:line 293
at Xamarin.Messaging.Build.Client.BuildClient.ExecuteTaskAsync(String task, String inputs) in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildClient.cs:line 65
at Xamarin.Messaging.Build.Client.TaskRunner.RunAsync(Task task) in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\TaskRunner.cs:line 56
Errors
C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net8.0_17.5\17.5.8030\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(364,3): MessagingException: The post for client build1460814608Ilian on topic xvs/build/1.14.0.6/execute-task/ecacau/de6ed16002fILLink has been cancelled
OperationCanceledException: The operation was canceled.
[sampleproj.csproj]
C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net8.0_17.5\17.5.8030\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(364,3): error MSB4018: The "Xamarin.MacDev.Tasks.ILLink" task failed unexpectedly.
System.AggregateException: One or more errors occurred. (One or more errors occurred. (An error occurred while executing the operation and the connection could not be reestablished))
---> System.AggregateException: One or more errors occurred. (An error occurred while executing the operation and the connection could not be reestablished)
---> Xamarin.Messaging.Exceptions.MessagingException: An error occurred while executing the operation and the connection could not be reestablished
---> Xamarin.Messaging.Exceptions.ClientDisconnectedException: The client build1460814608Ilian has been disconnected while waiting a post response to topic xma/agents
at Xamarin.Messaging.Client.MessagingClient.PostAsync[TRequest,TResponse](TRequest message, String topic, MessagePriority priority, CancellationToken cancellationToken, Boolean retain, Int32 timeoutSecs) in D:\a\_work\1\s\src\Xamarin.Messaging.Client\MessagingClient.cs:line 197
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ExecuteWithRetryAsync[TResult](Func`1 executeDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 57
--- End of inner exception stack trace ---
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ReconnectAsync(ExceptionDispatchInfo exceptionInfo, IMessagingAnalyticsAction analytics) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 182
at Xamarin.Messaging.Ssh.MessagingRunnerPro.HandleExceptionAsync[TResult](ExceptionDispatchInfo exceptionInfo, Func`1 reentrancyDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 99
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ExecuteWithRetryAsync[TResult](Func`1 executeDelegate, IMessagingAnalyticsAction analytics, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 64
at Xamarin.Messaging.Ssh.MessagingRunnerPro.ExecuteWithRetryAsync[TResult](Func`1 executeDelegate, Int32 attempts) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 39
at Xamarin.Messaging.Ssh.MessagingClientPro.PostAsync[TMessage,TResult](TMessage request, Boolean retain, Int32 timeoutSecs) in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingClientPro.cs:line 135
at Xamarin.Messaging.Ssh.MessagingService.RefreshAgentsStatusAsync() in D:\a\_work\1\s\src\Xamarin.Messaging.Ssh\MessagingService.cs:line 298
at Xamarin.Messaging.Build.Client.BuildConnection.GetBuildAgentStatusAsync() in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildConnection.Normal.cs:line 435
at Xamarin.Messaging.Build.Client.BuildConnection.IsBuildAgentRunningAsync() in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildConnection.Normal.cs:line 92
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Xamarin.Messaging.Build.Client.BuildConnection.get_IsConnected() in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildConnection.Normal.cs:line 45
at Xamarin.Messaging.Build.Client.BuildConnection.GetAsync(IBuildEngine4 engine) in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildConnection.Static.cs:line 50
at Xamarin.Messaging.Build.Client.TaskRunner.DisconnectAsync(Task task) in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\TaskRunner.cs:line 541
at Xamarin.Messaging.Build.Client.TaskRunner.RunAsync(Task task) in D:\a\_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\TaskRunner.cs:line 99
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Xamarin.MacDev.Tasks.ILLink.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ILLink.cs:line 30
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
Messages
[...]
Task "Touch" skipped, due to false condition; ( '$(_ILLinkExitCode)' == '0' ) was evaluated as ( '' == '0' ).
(and build kept going, eventually failing later on because ILLink didn't run correctly)
Ref: https://developercommunity.visualstudio.com/t/Maui-Blazor-Hybrid-App-wont-publish-to-/10750311#T-ND10763338
We are doing the following:
1. Adding the rgen directory with the following solutions:
* Analyzer: Analyzer that will catch errors in the bindings. At the
moment it provides a single error when the BindingTypeAttribute is used
in a nont partial type.
* Analyzer Tests: Allows tests for the analyzer.
* Analyzer Sample: Sample project to test the analyzer.
* Code Generator: A code generator that adds the BindingTypeAttribute to
the compilcation.
* Code Generator Tests: Allows tests for the generator.
* Code Sample: Sample project for the code generator.
2. Make rule to build the roslyn code generator.
3. Makefile changes to add the code generator as part as the second
compilation of the bindings.
This changes add the starting gounds to move to roslyn.
---------
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Alex Soto <alex@soto.dev>
This logic was intented to zip up the .NET unit tests to run them on Windows,
but in the end we went with a different approach that doesn't require zipping.
* Unify the code to collect diagnostic information about a bot.
* Unify some of the cleanup code to prepare a bot as well.
* Implement code to terminate processes on a bot that's used more than a day
of CPU (presumably these processes are stuck for some reason).
We need to set "UseCurrentRuntimeIdentifier=false", we must only set it for
the outer build for universal builds - when `RuntimeIdentifiers` is set - but
that means we can only do it *after* we set any default value for
`RuntimeIdentifiers`.
Fixes https://github.com/xamarin/xamarin-macios/issues/19391#issuecomment-2405499973.
This isn't very user friendly:
ILLink : unknown error IL7000: An error occurred while executing the custom linker steps. Please review the build log for more information.
ILLINK : error MT0073: Microsoft.iOS 18.0.8337 does not support a deployment target of 10.0 for iOS (the minimum is 11.0). Please select a newer deployment target in your project's Info.plist or change the SupportedOSPlatformVersion property in your project file.
ILLINK : error MT2301: The linker step 'Setup' failed during processing: Microsoft.iOS 18.0.8337 does not support a deployment target of 10.0 for iOS (the minimum is 11.0). Please select a newer deployment target in your project's Info.plist or change the SupportedOSPlatformVersion property in your project file.
[...]/packages/microsoft.net.illink.tasks/8.0.8/build/Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
So improve this to only show a single error message:
The SupportedOSPlatformVersion value '10.0' in the project file is lower than the minimum value '11.0'.
Fixes https://github.com/xamarin/xamarin-macios/issues/21368.
We still need some of the source files from the legacy Mono library, but it's
only a few files, so just add them to the git repo.
Also implement caching of the .NET download, which speeds up clean rebuilds
significantly.
Note: all the files in the `builds/mono-ios-sdk-destdir` are a straight import
from the Mono archive, so those shouldn't need much reviewing (nor will I
change them unless absolutely necessary).
The methods 'GetTraitCollectionWithTraits' and 'GetTraitCollectionByModifyingTraits' takes a callback, but the callback
had the wrong signature.
So introduce a new overload for each of these methods, using a delegate with the correct signature.
Also deprecate 'FromTraitsFromCollections' according to both headers and documentation.
Fixes https://github.com/xamarin/xamarin-macios/issues/21377.
On the bots we're executing with Rosetta, and 'arch' returns 'i386' under
Rosetta, so detect when we're executing under Rosetta, and install the arm64
version of .NET in that case as well.
Also fix a bug in the same area in our tests.
This new pipeline will only be executed when the CI build is completed
by any of the branches that have been listed to be included in the
trigger.
This pipeline because it does a release has to extend the 1ES template.
---------
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>