Developers will now get the helpful:
> error MM0051: Xamarin.Mac 7.99.0 requires Xcode 12.0 or later. The current Xcode version (found in /Applications/Xcode_11.7.app/Contents/Developer) is 11.7.
instead of:
> error MM5309: Failed to execute the tool 'clang', it failed with an error code '1'. Please check the build log for details.
(and no clue from the build log that they need to upgrade their Xcode).
Xamarin.iOS projects still build fine with at least Xcode 11.3.1, so I've only
updated the minimum Xcode version for Xamarin.Mac.
Fixes https://github.com/xamarin/xamarin-macios/issues/11937.
This was allowed to ease existing (3rd party) code migration into net6.
However the reverse can also happen: trying to use net6 code with the
legacy SDK. In such case it's possible other (newer) attributes are being
used to preserve members.
ref: https://github.com/dotnet/aspnetcore/issues/33269
* Avoid chaining constructors, so one can be eliminated (if the other is not used)
* Remove casts (`int` parameters does not need them for `nint` fields)
* Reduce metadata (when a `.ctor` can be eliminated, like MySingleView)
```diff
--- a.cs 2021-06-14 20:56:22.000000000 -0400
+++ b.cs 2021-06-14 20:56:25.000000000 -0400
@@ -5068,13 +5068,8 @@
public CFRange(int P_0, int P_1)
{
- this = new CFRange((long)P_0, (long)P_1);
- }
-
- public CFRange(long P_0, long P_1)
- {
- loc = (nint)P_0;
- len = (nint)P_1;
+ loc = P_0;
+ len = P_1;
}
public override string ToString()
```
`CFString` cache the native immutable string into it's `str` field and
use it to avoid p/invokes when possible.
`ToString` retrieved the string without setting `str` (if `null`) so it
missed opportunities to avoid the native calls.
Most of the API were removed in Xcode 13 beta 1.
The App Store also started to reject some of the (already deprecated)
selectors that were removed, making the API not usable anymore (even
on older versions of the OS).
New commits in xamarin/maccore:
* xamarin/maccore@c7809739bd [Xamarin.Hosting] Add each platform as an exposed capability to the plugin manager. Fixes #xamarin/xamarin-macios@11901. (#2455)
Diff: 9acbbed1f6..c7809739bd
The Build.SourceBranchName variable is documented to be the last segment of
the git ref. If the git ref is 'refs/heads/main', then Build.SourceBranchName
is 'main' (as expected). However, if the git ref is
'refs/heads/release/6.0.1xx-preview5', then Build.SourceName is
'6.0.1xx-preview5', and that's not what we want.
Instead use the Build.SourceBranch variable, which is the entire git ref, and
then we strip out the 'refs/heads/' part from the beginning. This way we get
the correct branch name.
The base ApiSelectorTest class already handles these selectors, and does it
almost right, so just remove this special case and fix the base class logic.
Fixes these failures on macOS 10.15:
Introspection.MacApiSelectorTest
[FAIL] InstanceMethods : 4 errors found in 27001 instance selector validated:
Selector not found for CoreML.MLDictionaryFeatureProvider : encodeWithCoder: in Void EncodeTo(Foundation.NSCoder) on CoreML.MLDictionaryFeatureProvider
Selector not found for CoreML.MLMultiArray : encodeWithCoder: in Void EncodeTo(Foundation.NSCoder) on CoreML.MLMultiArray
Selector not found for CoreML.MLFeatureValue : encodeWithCoder: in Void EncodeTo(Foundation.NSCoder) on CoreML.MLFeatureValue
Selector not found for CoreML.MLSequence : encodeWithCoder: in Void EncodeTo(Foundation.NSCoder) on CoreML.MLSequence
Fixes https://github.com/xamarin/xamarin-macios/issues/11885.
* Remove unused `const string`, left overs from another era
* Avoid chaining selectors [1]
* Avoid directly throwing (helps inlining, even if not needed anymore)
* Nicer to read (same generated IL) for `==` operator
[1] enable the most common use case to remove some metadata
```diff
--- a.cs 2021-06-09 22:05:15.000000000 -0400
+++ b.cs 2021-06-09 22:05:17.000000000 -0400
@@ -2919,15 +2919,10 @@
public IntPtr Handle => handle;
public Selector(IntPtr P_0)
- : this(P_0, true)
{
- }
-
- internal Selector(IntPtr P_0, bool P_1)
- {
- if (P_1 && !sel_isMapped(P_0))
+ if (!sel_isMapped(P_0))
{
- throw new ArgumentException("sel is not a selector handle.");
+ ThrowHelper.ThrowArgumentException("sel", "Not a selector handle.");
}
handle = P_0;
name = GetName(P_0);
```
* adding new github action and editing existing
* making one job and adding fork statement
* adding concurrency
* reordering and name change
* Adding exit 1
* changing the check for fork
* merge conflict did not get resolved
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
The iOS version of the cleaning tasks were much more comprehensive, so those
won out when there were any differences.
This also required moving the GetDirectoriesTask to shared code.
We randomly run into a NuGet restore failure, which breaks the build, and is
quite annoying.
This might be due to a problem with multiple simultaneous restores, so this is
an attempt to first restore the packages we need, in a single serialized
restore, and once that's done we can process everything else in parallel.
Ref: https://github.com/xamarin/maccore/issues/2427
Ref: https://github.com/NuGet/Home/issues/10935
If we hardcode a prelease identifier for a .NET release, we can easily end up
with multiple branches using the same version number, because the hardcoded
prerelease identifier ends up being the same for any other branches that are
created later from the release branch (one typical example would be backport
branches).
This is bad.
So try to prevent this, by hardcoding two values instead!
We'll hardcode the branch name where the hardcoded prerelease identifier
should be applied, and this way any other branches will not use the hardcoded
prerelease identifier.
Ref: https://github.com/xamarin/xamarin-macios/pull/11891.
The native 'stat' function is not identical between x64 and arm64:
* The x64 version is the 32-bit version of the function, and takes a 32-bit
version of the stat structure.
* The arm64 version is the 64-bit version of the function, and takes a 64-bit
version of the stat structure.
We used the 32-bit version of the stat structure everywhere, which went
horribly wrong on arm64, because the layout and size of the struct is quite
different (120 bytes vs 144 bytes). The actual result on arm64 was that the
call to stat would null out one of the parameters to the calling function, and
the C# code would throw an ArgumentNullException when the code tried to use
that argument, and you'd end up with this exception which didn't make any
sense at all when looking at the code:
error : System.ArgumentNullException: Parameter "itemSpec" cannot be null. [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
error : at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowArgumentNull(Object parameter, String parameterName, String resourceName) in Microsoft.Build.Utilities.Core.dll:token 0x6000121+0x20 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
error : at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowArgumentNull(Object parameter, String parameterName) in Microsoft.Build.Utilities.Core.dll:token 0x6000120+0x0 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
error : at Microsoft.Build.Utilities.TaskItem..ctor(String itemSpec) in Microsoft.Build.Utilities.Core.dll:token 0x60003ba+0x6 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
error : at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile(String source, String target, String targetItemSpec) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/SmartCopyTaskBase.cs:line 74 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
error : at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/SmartCopyTaskBase.cs:line 99 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
So fix the P/Invoke to stat:
* Use the 64-bit version of the stat struct.
* For x64, call the 64-bit version of stat (stat$INODE64), since we're now
using the 64-bit version of the stat struct.
* For arm64, call the standard version of stat (which is the 64-bit version).
And this means that we can now use the ARM64 version of .NET to build .NET
apps.
* Bump maccore.
New commits in xamarin/maccore:
* xamarin/maccore@9acbbed1f6 [mlaunch] Add support for Xcode 13 beta 1. (#2452)
* xamarin/maccore@e48f75c0b6 [Xamarin.Hosting] Fix the --stdout arg not being forwarded to DeviceLaunchConfig (#2435)
* xamarin/maccore@109c695b1b [Xamarin.Hosting] Fix help string for launchdev argument (#2429)
Diff: cddbd1915d..9acbbed1f6
* [xtro] Fix generation of .pch files
* [xtro] Fix deprecated check to handle (anonymous) declarations and enable latest C# syntax in project
* [xtro] Fix _sanity_ checks
* [xtro] Update todo for beta 1
* [Siminstaller] Force siminstaller to use the xcode 12.5 url
Related issue: https://github.com/xamarin/xamarin-macios/issues/11881
* Fix introspection failures (due to [breaking] changes)
* [tests][intro] Fix hang for tvOS
Creating an instance of `NSMetadataQuery` hangs the simulator.
Even after (xharness) timeout the simulator is not in a good state
to run further tests and every new (tvOS) test will also hang...
* [tests][intro] Same hang for watchOS
except that further test execution does not seem affected (like tvOS)
```
CoreSimulator 772.1 - Device: Apple Watch Series 3 - 38mm (watchOS 8.0) - created by XHarness (42262867-E060-40C0-803E-6DA676AF50CC) - Runtime: watchOS 8.0 (19R5266p) - DeviceType: Apple Watch Series 3 - 38mm
Thread 0 Crashed:: tid_103 Dispatch queue: com.apple.main-thread
0 com.apple.Foundation 0x00007fff21470bd0 -[NSMetadataQuery dealloc] + 432
1 libobjc.A.dylib 0x00007fff200d11f7 objc_object::sidetable_release(bool, bool) + 177
2 com.apple.Foundation 0x00007fff21470a03 -[NSMetadataQuery init] + 64
3 com.xamarin.introspection_watch.watchkitapp.watchkitextension 0x0000000107efc139 xamarin_dyn_objc_msgSend + 217 (trampolines-x86_64-objc_msgSend.s:15)
4 ??? 0x000000010c76d4f6 0 + 4504081654
5 com.xamarin.introspection_watch.watchkitapp.watchkitextension 0x0000000107cffc85 mono_jit_runtime_invoke + 1621 (mini-runtime.c:3197)
6 com.xamarin.introspection_watch.watchkitapp.watchkitextension 0x0000000107e177d8 do_runtime_invoke + 54 (object.c:3052) [inlined]
7 com.xamarin.introspection_watch.watchkitapp.watchkitextension 0x0000000107e177d8 mono_runtime_invoke_checked + 136 (object.c:3220)
8 com.xamarin.introspection_watch.watchkitapp.watchkitextension 0x0000000107e1e3c5 mono_runtime_try_invoke_array + 2101 (object.c:5601)
9 com.xamarin.introspection_watch.watchkitapp.watchkitextension 0x0000000107daf977 ves_icall_InternalInvoke + 871 (icall.c:3927)
10 com.xamarin.introspection_watch.watchkitapp.watchkitextension 0x0000000107dc0167 ves_icall_InternalInvoke_raw + 103 (icall-def.h:667)
11 ??? 0x000000010a232799 0 + 4465043353
12 ??? 0x000000010c76e08b 0 + 4504084619
```
* [tests][monotouch-test] Fix failures with xcode 13 beta 1
* [tests][mmptest] Use a FAT framework that's build with x86_64 and arm64
Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
* adding new github action and editing existing
* making one job and adding fork statement
* adding concurrency
* reordering and name change
* Adding exit 1
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
The entire `.framework` directory needs to be copied back to Windows
when a native reference is a [xc]framework. Otherwise important files
will be missing and the app bundle will be unusable.
Fix https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1339824
Revert a small part of #10409 so the path evaluation always happens on
the mac computer (even if the build is done from Windows)
Also dded a comment to avoid repeating that mistake again
Fixes https://github.com/xamarin/xamarin-macios/issues/11817
Move task so it also work for Xamarin.Mac (since this is now shared code)
Fix warning
> resource ILLink.LinkAttributes.xml in Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065(26,6): warning IL2008: Could not resolve type 'ObjCRuntime.NotImplementedAttribute' [/Users/poupou/git/xamarin/xamarin-macios/tests/dotnet/size-comparison/MySingleView/dotnet/MySingleView.csproj]
NuGet doesn't support preserving the executable bit for files in *.nupkgs
(which are just zip files), so .NET implemented a [temporary
workaround](https://github.com/dotnet/sdk/pull/17299) for workload installs,
where they hardcoded files that should be executable.
This isn't really sustainable, and they'll remove their workaround, so we need
to use their supported method of specifying the file permissions: a
data/UnixFilePermissions.xml file.
Fixes https://github.com/xamarin/xamarin-macios/issues/11860.