There are two reasons for this:
* It grants us more independence from the mono archive for .NET 6.
* We need a bugfix in ikvm, but we can't necessarily bump mono.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
and fixes the ones that have some.
From https://github.com/xamarin/xamarin-macios/issues/9724
We do not _normally_ add availability attributes on enums **members** that represent error codes. In part because it's a lot of metadata and, foremost, because it's not really helpful to write code. E.g.
```csharp
var err = Call.Api (1);
switch (err) {
case NSError.Bad:
case NSError.Wrong:
Console.WriteLine ($"API failed: {err});
break;
case NSError.Ok:
break;
default:
Console.WriteLine ($"Unknown error code {err}");
break;
}
```
Adding version checks inside this would be complicated (source wise) and not really helpful since
* API can return undefined error code (and the error logic should work);
* Availability information is not 100% accurate;
As such we default to not add them - but we some time forgot about it. An intro rule could easily ensure we don't add them needlessly.
We already had support for ObjC API but nothing reported missing
availability attributes for p/invokes, used in manual bindings
Backport of #9700 which adds fixes for missing [Deprecated] inside Xamarin.Mac.dll
It's way too easy to forget that attributes like `[NoiOS]` means the code
is not generated (for bindings) on that platform but that they will be
compiled for _manual_ bindings (not run thru the generator).
This can expose types (and API) that are not usable on some platforms.
This new test checks that the `[No*]` and `[Unavailable]` attributes
are not in their respective platform assemblies.
For compatibility (existing mistakes) we ignore the check on API that
are decorated with `[Obsolete]` attributes.
Changes in the bindings are fix such mistakes - mostly adding the
`[Obsolete]` attribute.
Fix https://github.com/xamarin/xamarin-macios/issues/4835
backport of https://github.com/xamarin/xamarin-macios/pull/9686
* [tests][intro] Split attributes typos from API typos tests (#9652)
The latter requires the spellchecker which varies by OS versions, so we
only run it on the latest OS version (and simulator, except macOS).
The former are some internal rules and can be run on every commit and
avoid finding issues late in a release cycle.
Also changed to
- process members even if a type is obsoleted
- process the properties and events on types
About the strings...
Some were fine, others were not. Copy/pasted strings are hard to
maintain. Moving them to constants will help, both maintainability and
will reduce the metadata size of the platform assemblies.
ref: https://github.com/xamarin/xamarin-macios/issues/9353
* [tests][intro] ConstantsCheck should only be executed on latest OS (#9751)
since the files, mapped by the constants, might not be present in earlier
versions of the OS. We can only be sure, of their presence, on the
current/supported SDK version
Fix intro running on iOS 10.3 (64 bits)
```
Introspection.iOSApiTypoTest
[PASS] AttributeTypoTest
[FAIL] ConstantsCheck : NetworkLibrary
Expected: True
But was: False
: at Introspection.ApiTypoTest.ConstantsCheck () [0x00168] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiTypoTest.cs:1088
```
* [mac][searchkit] Fix typo (missing '.')
since the files, mapped by the constants, might not be present in earlier
versions of the OS. We can only be sure, of their presence, on the
current/supported SDK version
Fix intro running on iOS 10.3 (64 bits)
```
Introspection.iOSApiTypoTest
[PASS] AttributeTypoTest
[FAIL] ConstantsCheck : NetworkLibrary
Expected: True
But was: False
: at Introspection.ApiTypoTest.ConstantsCheck () [0x00168] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiTypoTest.cs:1088
```
The latter requires the spellchecker which varies by OS versions, so we
only run it on the latest OS version (and simulator, except macOS).
The former are some internal rules and can be run on every commit and
avoid finding issues late in a release cycle.
Also changed to
- process members even if a type is obsoleted
- process the properties and events on types
About the strings...
Some were fine, others were not. Copy/pasted strings are hard to
maintain. Moving them to constants will help, both maintainability and
will reduce the metadata size of the platform assemblies.
ref: https://github.com/xamarin/xamarin-macios/issues/9353
* [CarPlay] Update bindings to Xcode 12.2 Beta 1
CPEntity docs got removed https://developer.apple.com/documentation/carplay/cpentity
so it is very likely that Apple will keep this out from the API.
* Better obsolete and hide it from autocompletion
* Fix
* Ups I broke it again...
* Apply feedback
LINQ was giving issues in a client application with the Link SDK
enabled. The root cause is that we had issues in the LINQ operations
that are used to create the headers for the native request.
We fix this by:
1. Do not modify the managed request headers. Do not modify an object we
do not own.
2. Remove the use of LINQ
This issue was probelmatic when the client application was setting the
headers that are used by the HttpContent. If headers were not added in
the content, the issues did not happen.
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
Bound part of the API and added tests to those method that could be correctly ran as part of the unit tests. Other methods should have to be tested via a sample app.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
* [jenkins] State all the time where we're working on. (#8447)
It's annoying to have to track it down all the time when something goes wrong.
* [jenkins] Make it possible to skip running packaged Xamarin.Mac tests by setting the 'skip-packaged-xamarin-mac-tests' label. (#9170)
Diff is best viewed by ignoring whitespace.
* [jenkins] Don't try to run the packaged Xamarin.Mac tests if none were built.
* [jenkins] Add support for specifying custom labels using a file.
This is a partial backport of #8549.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
* Bump to Xcode 12.2 beta 1.
* [tests] Fix xtro and intro
* Fix wrong availability
* Fix monotouch tests
* Disable watchOS tests and bump iOS version to the right one
watchOS tests have been disabled because Xcode 12.2 Beta is
broken, you cannot create a watch app and deploy, Xcode just
crashes when you try to list simulators, If you try to use
our tools at the moment of deploying we get:
> error HE0046: Failed to install the app 'app' on the device 'watchOS 7.1 (18R5552f) - Apple Watch Series 6 - 44mm': Unable To Install ???app???
* Fix macOS check and bump both versions to satisfy commit distance check, luckily we have infinite numbers!!
Co-authored-by: Alex Soto <alex@alexsoto.me>
* Use the existing information we have in the Frameworks class to determine
whether a particular framework works in the simulator or not.
* Show a warning (MX5223) when we run into such a framework, but only if
the linker is enabled (otherwise we'll often get warnings for API the developer
doesn't use).
* [xcode12] Initial bump for Xcode 12 GM
* [tests][intro] We cannot load CoreNFC framework on iOS simulator anymore
* [tests][xtro] New Metal API are not abstract (before XAMCORE_4_0)
* [tests][intro] Fix crash when CSLocalizedString 'description' selector is called
* [tests][xtro] Add support for excluding platforms
Based on `Make.config` variables `INCLUDE_[IOS|TVOS|WATCH|MAC]`
This required moving some entries (common -> macOS) to keep the
sanitizer happy.
* [xtro] Ignore Intents watchOS differences since they will likely match iOS in the future
* Update to use Xcode 12 GMb instead of the old GM
* [tests][xtro] Remove OSLog for iOS and tvOS (changed in GM)
* [tests][msbuild] Disable FrameworkListTest based on the active/disabled platforms
* [tests][msbuild] Track new directory/file inside CoreML projects
* [mlaunch] Bump maccore and disable mlaunch if mac build is disabled
New commits in xamarin/maccore:
* xamarin/maccore@ba332d4d07 Disable mlaunch if Mac is not built (#2314)
Diff: 87a96d21c9..ba332d4d07
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
Fix version logic with macOS 11.0 so that we don't compute all versions by
doing a range computation on the minor version only.
This makes it so that we run on older macOS bots again.
There are also a few other fixes for macOS 11.0.
Most fixes are inside Intents. Some types were not available on macOS
and marked as such, except it backfired.
* Adding `[NoMac]` on `XAMCORE_4_0` was fine
* Adding `[Obsolete]` outside `XAMCORE_4_0` was fine
* Removing the `[Mac (x,y)]` was not quite fine. It's true (since it was never on macOS) but removing it means it default to the oldest (10.9) macOS version we support. This is what the introspection tests were expecting.
Adding an `[Obsoleted (..., 10,0, ...)]` solve this.
* Fix links that point to master to point to main instead.
* Implement support in the sample tester for specifying the default branch for
each sample repo.
* Fix various text / documentation to say 'main' instead of 'master.'
* Push to 'main' instead of 'master' in xamarin-macios-data.
* Fix xharness to make 'main' the special branch with regards to documentation tests as opposed to 'master'.
* Fix various CI to use 'main' instead of 'master'.
This is a backport of PR #9561
Calling Uri.PathAndQuery is not allowed on a relative Uri, which made the
previous Uri -> NSUrl implicit operator always throw if given a relative
NSUrl.
So I fixed that, added several tests, and found another issue (it turns out
that 'url.RelativePath == url.Path' is not a reliable way to detect absolute
urls, because it's true for relative urls as well) and fixed that too.
Fixes https://github.com/xamarin/xamarin-macios/issues/9607.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Rolf nailed the issue in https://github.com/xamarin/xamarin-macios/issues/9578#issuecomment-688409802
> The problem is that iOS returns an instance of a private type (_MPMusicPlayerMediaItemProxy) which is an NSProxy subclass, and currently we don't support NSProxy.
https://github.com/rolfbjarne/xamarin-macios/commit/873a1e1 was on the
right track but it turns out `[ForcedType]` on properties don't need, nor
work (same generated code), with `return:`.
Inside `DynamicRegistrar.cs` the method
```csharp
public Type Lookup (IntPtr @class, bool throw_on_error)
```
did not respect (was unused) the `throw_on_error`. That made it
impossible to force the type to the pointer we got.
In `Runtime.cs` the method `LookupINativeObjectImplementation` must also
be able to work without an exception (from the `Lookup`) at least when we
want to force the type.
backport of https://github.com/xamarin/xamarin-macios/pull/9604
reference: https://github.com/xamarin/xamarin-macios/issues/9578
Remove the following warning:
```
uikit.cs(22829,21): warning CS0108: 'UIViewConfigurationState.TraitCollection' hides inherited member 'UIConfigurationState.TraitCollection'. Use the new keyword if hiding was intended.
```
Remove the following warning:
```
arkit.cs(2056,32): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
```
The following warnings are printed during the build:
```
carplay.cs(443,10): warning CS0108: 'CPListItem.Text' hides inherited member 'CPListTemplateItem.Text'. Use the new keyword if hiding was intended.
carplay.cs(456,12): warning CS0108: 'CPListItem.UserInfo' hides inherited member 'CPListTemplateItem.UserInfo'. Use the new keyword if hiding was intended.
carplay.cs(505,31): warning CS0108: 'CPListItem.Handler' hides inherited member 'CPSelectableListItem.Handler'. Use the new keyword if hiding was intended.
carplay.cs(1437,31): warning CS0108: 'CPListImageRowItem.Handler' hides inherited member 'CPSelectableListItem.Handler'. Use the new keyword if hiding was intended.
carplay.cs(1447,10): warning CS0108: 'CPListImageRowItem.Text' hides inherited member 'CPListTemplateItem.Text'. Use the new keyword if hiding was intended.
carplay.cs(1450,12): warning CS0108: 'CPListImageRowItem.UserInfo' hides inherited member 'CPListTemplateItem.UserInfo'. Use the new keyword if hiding was intended.
carplay.cs(1516,10): warning CS0108: 'CPMessageListItem.Text' hides inherited member 'CPListTemplateItem.Text'. Use the new keyword if hiding was intended.
carplay.cs(1519,12): warning CS0108: 'CPMessageListItem.UserInfo' hides inherited member 'CPListTemplateItem.UserInfo'. Use the new keyword if hiding was intended.
```
* [fileprovider] Update for Xcode 12 beta 6
This was quite noisy. Apple removed all API marked as
`FILEPROVIDER_API_AVAILABILITY_V3`.
```
```
Most were bound but they were (majority) decorated with `[NoiOS]` and
`[NoMac]` so they did not generated any bindings.
A few of them were modified or just became macOS-only.
Deprecation warnings also needed to be updated.