This matters because we use the library defined by the P/Invoke to determine
which frameworks to link with, and if we get it wrong, things like this may
happen:
Undefined symbols for architecture arm64:
"_AudioObjectGetPropertyData", referenced from:
wrapper_managed_to_native_AudioUnit_AudioUnit_AudioObjectGetPropertyData_uint_AudioUnit_AudioObjectPropertyAddress__uint__intptr__uint__uint_ in Xamarin.MacCatalyst.dll.o
because we though that the AudioObjectGetPropertyData function was in the
AudioUnit framework, and not in CoreAudio where it really is, and thus we
didn't link with the CoreAudio framework.
Also add an introspection test to verify that the library our P/Invokes point
to is correct.
This is to set the -dlsym:-nunit.framework.dll option, because nunit.framework.dll
contains a P/Invoke to a function that doesn't exist.
For some reason this is more of a problem in tvOS projects than iOS projects
(although it happens for iOS projects as well).
from Sebastien: "most filters are key-based natively (not-NSObject subclasses)) and we expose them as C# _user-type_ CIFilter-subclasses in recent years _most_ filters have also been exposed natively as protocols (not classes), we expose them as `*Protocol` interface types `CIRAWFilter` is a special case, it's a native `CIFilter` subclass so we're not using [CoreImageFilter] and [CoreImageFilterProperty] attributes to define it which also means we cannot use the "extra" tests to validate the filter properties. So we skip it here. Do not fear it's still tested, like any _normal_, NSObject subclass we have bound :-)"
* Add support for the SupportedOSPlatformVersion MSBuild property, and write
it to the Info.plist for the corresponding minimum OS version.
* If there are any minimum OS version in the Info.plist, we'll now show an
error if it doesn't match SupportedOSPlatformVersion.
This unfortunately means that if there's any minimum OS version in any
Info.plist, then that will most likely have to be moved to the
SupportedOSPlatformVersion property (or removed entirely if that's the right
choice), since it's unlikely to match the default value for
SupportedOSPlatformVersion. However, this was deemed to be the best option for
the future (it's a one-time pain during migration).
Also add new tests, update existing tests, and update the templates.
Fixes https://github.com/xamarin/xamarin-macios/issues/12336.
* Share the logic for .NET between all platforms.
* This means adding a macOS variation of introspection for .NET.
* A few fixes to make sure the macOS variation passes:
* Make NSTabViewController.SegmentedControl fully unavailable (it's never
been in any stable version of Xcode).
* Treat API with an Obsolete attribute as API with an Obsoleted attribute
with regards to availability.
* Ignore OSPlatform attributes we don't understand.
* Ignore the ApiAvailabilityTest.LegacyAttributes test on macOS as well.
It's a `Phase` vs `PHASE` lookup that make the tests checking for
fields fail.
```
FieldExists: 3 errors found in 6603 fields validated: PHASESpatialCategoryDirectPathTransmission, PHASESpatialCategoryEarlyReflections, PHASESpatialCategoryLateReverb
```
There's no need in having availability attributes for versions earlier
than the current minimum.
Re-enable the `Introduced` test for _legacy_ Catalyst as it's fine since
it use the older attributes. It's still not possible to enable it for
`NET` until all manual bindings are updated.
* [introspection] Ignore the ApiAvailabilityTest.LegacyAttribute test on Mac Catalyst as well.
* [introspection] #10883 only applies to Mac Catalyst for legacy Xamarin.
* [xharness] introspection is now green on .NET/Mac Catalyst
* A lot of availability attribute updates.
* Some conditional "#if !__MACCATALYST__" in manual binding files.
* xtro updates.
* Misc other minor tweaks.
* [tests] Add a .NET version of introspection for Mac Catalyst.
It shows a lot of failures (so it's disabled by default), but this way we can
at least start to fix the failures.
* [xharness] Always ignore the new test.
* [xharness] Ignored projects should be ignored.
* Make `CFArray` public so it can be used for bindings, including 3rd party bindings
* Subclass `NativeObject` to remove some boilerplate code
* Most members are `internal` until needed
* Add nullability annotations
The next step is to make the same kind of optimization done on `NSString`
vs `CFString` by preferring faster p/invokes over calling selectors while
keeping generated code identical.
Also
* Make more methods internal so we can potentially rename them (when the NSArray variants becomes obsolete)
* Add CFArray to the attachment tests
Update tests regarding the deprecated fields and classes.
Co-authored-by: Rachel Kang <rachelkang@microsoft.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
* Bump min watchOS simulator to 6.0.
Fixes https://github.com/xamarin/maccore/issues/2454.
* Try to keep using the iOS 12 simulator for watchOS 8.0
* [introspection] Fix running on watchOS 6.0.
* [AVFoundation] Adjust availability of AVPlayerWaitingDuringInterstitialEventReason.
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).
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.
* 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>
The code contains comments explaining the new behavior.
Some tests that poked into the private 'flags' field on NSObject had to be
updated, because the field is now named differently in .NET.
I also added two more tests for toggle ref scenarios.
* [AVFoundation] Set watchOS availability for a few classes that were forgotten about in Xcode 12.5.
Partially fixes https://github.com/xamarin/maccore/issues/2420.
* [introspection] Cope with MLSequence's lack of protocol compliance in earlier versions of watchOS.
Partially fixes https://github.com/xamarin/maccore/issues/2420.
* [introspection] Improve error message to include method and type data.
There are a number of tests that do not work on VMs yet our older
machines are using virtualization. Ignore those tests since we cannot
assert if they work or not.
fixes: https://github.com/xamarin/maccore/issues/2438
This moves our current/legacy attributes to the ones added in dotnet 5 [1].
Short Forms (only in bindings)
| Old | New |
|---------------------------------------|-------------------------------------|
| [iOS (7,0)] | [SupportedOSPlatform ("ios7.0")] |
| [NoIOS] | [UnsupportedOSPlatform ("ios")] |
Long Forms
| Old | New |
|---------------------------------------|-------------------------------------|
| [Introduced (PlatformName.iOS, 7,0)] | [SupportedOSPlatform ("ios7.0")] |
| [Obsoleted (PlatformName.iOS, 12,1)] | [Obsolete (...)] |
| [Deprecated (PlatformName.iOS, 14,3)] | [UnsupportedOSPlatform ("ios14.3")] |
| [Unavailable (PlatformName.iOS)] | [UnsupportedOSPlatform ("ios")] |
Other changes
* `[SupportedOSPlatform]` and `[UnsupportedOSPlatform]` are not allowed on `interface` [2] which means they cannot be used for protocols. This is currently handled by inlining the existing attributes on all members.
* `[ObsoletedInOSPlatform]` was removed in net5 RC. This PR is now mapping the existing attributes to `[Obsolote]`, however multiple ones cannot be added so they need to be platform specific.
Remaining work (manual bindings update) tracked in https://github.com/xamarin/xamarin-macios/issues/11055
References
* [1] https://github.com/xamarin/xamarin-macios/issues/10170
* [2] https://github.com/dotnet/runtime/issues/47599
* [3] https://github.com/dotnet/runtime/issues/47601
* [build] Use arcade dependency management tooling
* Apply feedback
* Apply second round of feedback
* Always make dotnet.config before trying to read it
* Debugging
* Update dependencies, trim tabs and spaces
* [dotnet] Remove the existing workload shipped with .NET and install our locally built ones.
The new version of .NET ships with our workloads, but those aren't
the workloads we want to use, so replace them with our own.
* Update .gitignores.
* Bump to 6.0.100-preview.3.21181.5
That required renaming simulator runtime packs...
* More rename for simulator packages
* moar (hopefully all)
* Bump to 6.0.100-preview.3.21201.11
This fix the issue with `Wait` that failed several tests in monotouch-tests
However it does not include the fix for AppConext.GetData on device (AOT)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
With P3 addition on ICU we must now link the native executable as C++.
Remove an old workaround, in many tests, referencing old (5.0/previews)
packages that caused native link time failures.
ref: https://github.com/mono/linker/issues/1139
and not just methods even if we are generating them on both [1]
That spotted a single error inside `src/Security/SslContext.cs`
which this PR also fix. IOW there's no point in saying the API
was (a long time ago) available since our code to call it was
removed.
[1] which is something we should not need to do on .net since
* the compiler-based tooling does not need it on the getter/setter
* other tools needs to be updated (so it won't break any existing
use case)
- this requires small (but tricky) generator changes
- duplicate availability attributes detection is tested by introspection
- it also requires removing dupes in manual bindings (which was the
current, if not the _named_, goal for this PR)
Long story:
It's always been hard to detect and enforce removal of extraneous
availability attributes since the generator inlined them _freely_
when processing ObjC protocols.
That meant introspection could not report dupes and led to many
extra attributes. This was **not** a problem in binding files since we
could ignore them. IOW their presence (in the input) does not mean they
are _all_ dupes in generated code (output).
However dupes in manual bindings were also (forced to be) _ignored_ and
those were part of the assemblies we ship. Again it was not a big deal,
nor a source of much extra metadata/size, so it was ignored.
Forward to today, manual bindings needs to be updated for net6 [1] so any
extra we have requires more (manual) work. Cleaning this problem up in
the generator code reduce the (manual) work we need to do.
It also means introspection can detect dupes (in generated and manual
code) so we don't end up adding more (which would also require more
manual work to support both set of attributes).
[1] https://github.com/xamarin/xamarin-macios/pull/10580
* Bump .NET to 6.0.100-preview.2.21114.3.
* [dotnet-linker] Several steps are now gone, so load our custom step before the new first step (MarkStep).
* [dotnet-linker] Dump the current steps if we fail to call InsertBefore/InsertAfter.
* [dotnet-linker] Load the CollectAssembliesStep as the first step, and make it load every assembly.
* [dotnet] Set InvariantGlobalization=true because that's the only thing .NET supports for now.
* [dotnet-linker] Use recommended workaround for linker's inability to do load assemblies in custom step.
* [tests] Bump version of MSBuild.StructuredLogger to get support for new log version.
Otherwise this happens in tests that read binary logs:
System.NotSupportedException : Unsupported log file format. Latest supported version is 9, the log file has version 10.
* [introspection] Ignore P/Invokes to QCall for LogThreadPool* P/Invokes.
* [dotnet-linker] Inject a dummy implementation of mono_config_parse_memory as a temporary solution for mono's removal of the same method.
Once you have BigSur installed, to work with xcode12.5, then you
need to bump the minimum simulator versions (to 11.4) and this picked up
a few mistakes in availability and when checking protocol conformance
The bots won't run into those issues, as long as `xcode12.5` is not
merged or while they run on macOS Catalina, but it's nice to have green
tests locally :)
Subset of 8513316015 already in `xcode12.5`
Moving to macOS 11.x (BigSur) requires us to bump the minimum/tested
version of simulators to the oldest supported by the required OS.
This means iOS 11.4, tvOS 11.4 and watchOS 5.0 (with iOS 12).
xharness needs to be updated in order for watchOS 5.0, which needs
series 3, to work properly.
Filed as https://github.com/xamarin/xamarin-macios/issues/10593
This version of Xcode requires macOS 11.0 or later.
New commits in xamarin/maccore:
* xamarin/maccore@de616ca53e [mlaunch] Fix dependencies for Xcode 12.5 beta 1 (#2387)
* xamarin/maccore@e93375583c [Actions] Fix rebase trigger.
* xamarin/maccore@0dfeb85ff6 [CI][VSTS] Add information when the external tool fails. (#2377)
* xamarin/maccore@87e165fdbb Remove Vincent as a code owner 😞 (#2368)
* xamarin/maccore@55a700bb5b [build] Add /restore to Xamarin.Analysis build (#2366)
* xamarin/maccore@2d9f8a9685 Bump to xamarin/xamarin-analysis@95245313 (#2362)
Diff: 428964bf32..de616ca53e
* Bump system mono to the latest available 2020-02 package. (#10402)
This makes xamarin-macios build on Apple Silicon, and also seems to get an
updated csc that fixes a problem with nullability warnings/errors.
* [tests] Fix mmp-regression build
```
10:59:46.5383210 Making all in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/mmp-regression
10:59:46.5392610 TargetFrameworkFallbackSearchPaths=/Users/builder/azdo/_work/1/s/xamarin-macios/_mac-build/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=/Users/builder/azdo/_work/1/s/xamarin-macios/_mac-build/Library/Frameworks/Mono.framework/External/xbuild make all
10:59:46.6208220 /Applications/Xcode_12.5.0-beta.app/Contents/Developer/usr/bin/make clean
10:59:46.6956100 /Applications/Xcode_12.5.0-beta.app/Contents/Developer/usr/bin/make build
10:59:46.7422460 GEN dylib/libTest.dylib
10:59:46.8094820 ld: library not found for -lSystem
10:59:46.8097590 clang: error: linker command failed with exit code 1 (use -v to see invocation)
10:59:46.8110310 make[2]: *** [dylib/libTest.dylib] Error 1
10:59:46.8112570 make[1]: *** [run] Error 2
10:59:47.0030120 Process make exited with 2
```
This happens on BigSur as it does not find the default location anymore...
* [tests] Do not test GKLeaderboardViewController on BigSur
The issue is the OS version, not the Xcode version. Update check
to skip that test on macOS 11+
* [tests] Fix MSBuild tests / integration
The test cannot work on BigSur since while you can `dlopen` the library
you can open `fopen` it as a file (and can't embed it for the test).
```
12:31:23.9407820 CSC : error CS1566: Error reading resource 'libz.dylib' -- 'Could not find file "/usr/lib/libz.dylib"' [/Users/builder/azdo/_work/1/s/xamarin-macios/tests/msbuild/Xamarin.MacDev.Tests/bin/Debug/net472/tmp-test-dir/msbuild-tests201/XM45Binding.csproj]
12:31:23.9407900 Done Building Project "/Users/builder/azdo/_work/1/s/xamarin-macios/tests/msbuild/Xamarin.MacDev.Tests/bin/Debug/net472/tmp-test-dir/msbuild-tests201/XM45Binding.csproj" (default targets) -- FAILED.
```
* [tests] Fix MTouch tests failures
* `nm` changed it's output and test was updated
* `clang` linking has a much higher limit for it's command-line length
At least it does not seem to be OS specific since both 10.15 and 11.0
returns the same maximum
```
$ getconf ARG_MAX
1048576
```
* Bump to .NET 6.0.100-alpha.1.21060.3.
* Fix dotnet command line arguments.
* dotnet build: the project file must be the first argument.
* dotnet build/publish: use the documented verbosity format.
* Update version number in tests.
* [tests/introspection] Adjust introspection to cope with different library names in the new .NET version.
* [tests/link sdk] Adjust the LinkSdkRegressionTest.SpecialFolder test according to the new version of .NET 6.
* [tests/link sdk] Preserve a required method in System.Private.CoreLib to work around a bug in .NET 6.
Ref: https://github.com/dotnet/runtime/issues/46908.
* Revert "[CI][VSTS] Add the donet 6 pkg as a dependency. (#10348)"
This reverts commit 6de4e717e7.
There's no need to provision .NET 6, it's done automatically.
This involves a few changes:
* Change everything to reference net6.0 instead of net5.0
* Update various variables to be NET6* instead of NET5*
* Reorder build logic to account for that our targets are imported earlier in
the build process:
In the latest .NET 6, our Workloads.targets is imported earlier in the
build. This requires a few changes, because we still need to run most of
our logic later in the process, which we do by adding targets files we
want imported later to the AfterMicrosoftNETSdkTargets property.
What we're loading as soon as possible:
* Our version information (Xamarin.Shared.Sdk.Versions.targets)
* The supported OS versions
(Microsoft.<platform>.Sdk.SupportedTargetPlatforms.targets)
* The default OS version
(Xamarin.Shared.Sdk.TargetFrameworkInference.targets).
This is all information that the .NET build require early on.
Changes:
* Rename all files that are loaded early to *.props.
* Updated documentations to reflect these changes.
* Remove Microsoft.<platform>.TargetFrameworkInference.targets, these
files aren't used and don't contain anything useful.
* Move the logic to calculate _ComputedTargetFrameworkMoniker has been
delayed to later, because it needs TargetFrameworkMoniker set.
* Add a StoreAttributesStep to store attributes that are removed by the
linker, but that the static registrar needs.
In particular, in .NET 6 the linker removes the
System.Runtime.CompilerServices.ExtensionAttribute, which the static
registrar needs to handle category methods properly.
This involved copying and slightly modifying the RemoveAttributesBase
code.
* [tests] Move the dotnet introspection test project to a new test directory.
A tvOS project will come soon too, this makes the separation nicer.
* [tests] Add a tvOS version of the dotnet introspection test project.
This reverts parts of https://github.com/xamarin/xamarin-macios/pull/9993
and add a special case to the test looking for duplicate attributes
between members and the type.
Why ? Introspection fails because `bgen` inline the `NSAccessibility`
protocol (added in 10.10) into types that existed earlier. That's
normally not a problem since the type-level attribute is there.
However because of the 10.9 (type) vs 10.10 (protocol) issue that was
moved into the manual bindings (so `bgen` does not know it)
Even if built inside `COREBUILD` the issue exists since the protocol
interface does not really exists at that point (by default), so it's
the type (10.9) availability that is looked up.
In retrospect we should have created a new type, like Swift did (a
few years later), named `NSAccessibilityProtocol` for 10.10.
Fix https://github.com/xamarin/xamarin-macios/issues/10009
For each platform the presence of `[Unavailable]` should mean there are
no other availability (introduced, deprecated or obsoleted) attributes
on the same member.
Also check if the type is unavailable. In that case no member should,
for that platform, have other availability attributes.
Also fix failures - all in WatchKit which was removed from iOS.