Граф коммитов

1265 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge bcbb6c8438
[src] Define XAMCORE_3_0 for .NET for all platforms. (#13566)
Also update xtro and tests accordingly.
2021-12-17 07:44:02 +01:00
Rolf Bjarne Kvinge bc2a5e2251
[xharness] Inline the dotnet-shared.csproj file as well when inlining shared imports. (#13514)
This fixes a problem where we'd build the same project reference from
dotnet-shared.csproj in parallel, and each build would stomp on eachother
(because we'll now clone the project references in dotnet-shared.csproj).

This als required updating project files to use MSBuildThisFileDirectory
instead of MSBuildProjectDirectory, which makes it easier for xharness to
inline/process these files, because MSBuildThisFileDirectory is easy to know
when processing a file, while MSBuildProjectDirectory depends on the calling
project, which complicates matters significantly.

A fix in MonoTouch.Dialog was also required.

New commits in migueldeicaza/MonoTouch.Dialog:

* migueldeicaza/MonoTouch.Dialog@59fbf5b [dotnet] Shared project files don't need the DefaultTargets/ToolsVersion/xmlns attributes.

Diff: 4d0e0a9a5f..59fbf5bb1b

Fixes https://github.com/xamarin/maccore/issues/2527.
2021-12-16 19:01:39 +01:00
Rolf Bjarne Kvinge b169c806fc
[dotnet] Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst. Fixes #10312. (#13562)
Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst, because they don't
apply for a Mac Catalyst app (which is neither a simulator environment, nor a
device environment).

This means that code using these APIs will have to be re-evaluated to
determine what's the correct behavior for Mac Catalyst.

Also update our tests accordingly.

Fixes https://github.com/xamarin/xamarin-macios/issues/10312.
2021-12-15 22:32:14 +01:00
Rolf Bjarne Kvinge bb2572fba5
[tests] Remove workaround for an objc_msgSend bug that's been fixed for a while. (#13556)
We're not executing anywhere where this bug is present anymore.
2021-12-14 17:07:14 +01:00
Rolf Bjarne Kvinge 0bd6cf095c
[tests] Remove a few Assert.Inconclusive calls that won't be executed anymore. (#13557)
Don't conditionally ignore tests that fail on Snow Leopard (or earlier),
because we're always executing on a later OS now.
2021-12-14 17:06:09 +01:00
Rolf Bjarne Kvinge 6fe346e004
[tests] Remove some dead code. (#13558) 2021-12-14 17:05:53 +01:00
Rolf Bjarne Kvinge ed1c769017
[tests] Remove dead code from test that's already ignored (#13555) 2021-12-14 17:04:17 +01:00
Rolf Bjarne Kvinge a93d76304e
[src] Modify some logic for Mac Catalyst that tests the current runtime architecture (Runtime.Arch) to behave like macOS instead (which doesn't check Runtime.Arch). (#13536) 2021-12-14 08:26:14 +01:00
Rolf Bjarne Kvinge c93cd3a99c
[Metal] Usher the Metal API into the golden age of .NET. (#13533)
* Change all XAMCORE_4_0 conditions to NET conditions.
* Add numerous Release attributes that xtro started complaining about.
* Misc other minor API changes/updates.
2021-12-13 20:40:29 +01:00
Rolf Bjarne Kvinge 15a7216aa8
[ObjCRuntime] Remove deprecated availability attribute API from .NET. (#13433)
* [ObjCRuntime] Remove deprecated availability attribute API from .NET.

They're quite useful for binding code though, so instead of removing them completely,
make them binding-only attributes (like numerous other binding attributes we have)
for .NET.

* [src] Remove removed attributes from the list of attributes that should be removed by the linker.

* [tests] Update tests to not use the old attributes for .NET.
2021-12-09 07:41:07 +01:00
Rolf Bjarne Kvinge 39bdae2b7f
[monotouch-test] Ignore a few tests in non-ARM64 simulators. (#13487)
* [monotouch-test] Ignore a few tests in non-ARM64 simulators.

Some tests fail when running on an M1, but in a x64_86 mode, so just ignore
those unless we're running on ARM64 (this will currently exclude them on
x86_64 hardware too, but that'll eventually not be a problem anymore when
there's no more x86_64 hardware, and just checking for ARM64 is easier than
checking for x86_64 mode on an ARM64 CPU).

* Make more legacy projects unsafe.
2021-12-07 21:10:39 +01:00
Rolf Bjarne Kvinge 39ab97113c
[src] Adjust numerous APIs to take/return NativeHandle instead of IntPtr for .NET. (#13488)
* [Foundation] Make numerous CFArray and NSArray APIs take/return NativeHandle instead of IntPtr.

* [src] Fix a lot of other cases of IntPtr -> NativeHandle.

This is just fallout from the CFArray/NSArray in the previous commit.
2021-12-03 07:58:29 +01:00
Rolf Bjarne Kvinge f8b6699ab2 Merge remote-tracking branch 'origin/main' into arm64-sim 2021-12-02 09:38:36 +01:00
Rolf Bjarne Kvinge 5cc92ac564
[src] Add a new ObjCRuntime.NativeHandle type to represent native handles for .NET. Fixes #13126. (#13356)
Add a new struct, ObjCRuntime.NativeHandle, which will be used to represent
native handles for .NET (instead of using IntPtr). The main purpose is to be
able to use 'nint' as a number in API while not being prevented from using
native handles as well.

One example is NSMutableString, which has a constructor that takes a single
'nint capacity' parameter. With this change, we'll also be able to have a
constructor that takes a native handle in .NET - otherwise we'd have two
constructors with the same signature, because a C# 'nint' is just an 'IntPtr'.

This change required numerous changes pretty much everywhere. The work is
split up in commits as well as I was able to, and each commit explains what it
does.

Fixes https://github.com/xamarin/xamarin-macios/issues/13126.
2021-12-02 08:38:39 +01:00
Rolf Bjarne Kvinge 941507525e
[tests] Unify .NET test projects (#13474)
* Make the .NET project files for BundleResources and EmbeddedResources follow
  the pattern of all the other test projects.
* Move the LangVersion and AllowUnsafeBlocks propertieso to the shared project
  file.
2021-12-01 20:00:14 +01:00
Rolf Bjarne Kvinge f26dedd046 [monotouch-test] Set the AOT define if we're building for ARM64 in the simulator.
Also set DYNAMIC_REGISTRAR if we're targeting the simulator.
2021-11-30 18:20:43 +01:00
Rolf Bjarne Kvinge fb11284785
[src] Remove the Xamarin.iOS.dll reference assembly for Mac Catalyst. (#13455)
* [src] Remove the Xamarin.iOS.dll reference assembly for Mac Catalyst.

Xamarin.iOS.dll won't be compatible with Mac Catalyst in .NET 6 (because there
won't be any backwards compatibility), so we don't need the assembly that has
type forwarders to Xamarin.MacCatalyst.dll.

* Bump MonoTouch.Dialog

New commits in migueldeicaza/MonoTouch.Dialog:

* migueldeicaza/MonoTouch.Dialog@4d0e0a9 Remove usages of UIWebView when compiling for Mac Catalyst.

Diff: 5a05c6912e..4d0e0a9a5f

* [tests] There's no NSFileProviderPage in Mac Catalyst.

* [tests] Fix CBUUID link sdk test to work correctly on Mac Catalyst.
2021-11-29 23:14:25 +01:00
Rolf Bjarne Kvinge 19c2765156 [tests][monotouch-test] Adjust code to cope with NativeHandle. 2021-11-26 14:25:21 +01:00
Rolf Bjarne Kvinge 2bb5fc88c5
[src] Adjust visibility of numerous (IntPtr) and (IntPtr, bool) constructors (#13444)
* There should be no public (IntPtr) constructor, at most there should be a
  protected one for NSObject subclasses. There should be no such constructors
  for classes that just implement INativeObject.
* There should be no public (IntPtr, bool) constructor at all, they should all
  be internal.
* If changing the visibility or removing the ctor is a breaking change, then
  make it happen for .NET only.
2021-11-26 14:24:05 +01:00
Rolf Bjarne Kvinge 0c50905fc5
[tests] Fix boolean logic when checking for macOS version between 11.0 and 12.0 (#13446) 2021-11-25 22:35:24 +01:00
Rolf Bjarne Kvinge df4399bbde
[CGImageSource] Change CreateThumbnail to return null if the thumbnail creation fails. (#13443)
Otherwise we'll create a CGImage with a zero Handle, which is usually not the
right thing to do. Still, keep the old behavior for legacy Xamarin for the
sake of backwards compat.
2021-11-25 07:36:24 +01:00
Rolf Bjarne Kvinge 98d7c95020
[MediaPlayer] Remove deprecated/removed API in .NET (#13427)
* [MediaPlayer] Remove deprecated/removed API in .NET

* [tests] Fix monotouch-test according to API changes.
2021-11-24 15:37:23 +01:00
Rolf Bjarne Kvinge 2901f7aba6
[tests] Adjust FontTest to cope with broken GameKit/UIKit/fontWithSize on certain macOS versions. (#13428)
Fixes:

    MonoTouchFixtures.UIKit.FontTest
        CoreText note: Client requested name ".SFNS-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
        CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
            [FAIL] NullFonts :   WithSize
            Expected: not null
            But was:  null
                at MonoTouchFixtures.UIKit.FontTest.NullFonts() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/UIKit/FontTest.cs:line 165
2021-11-24 08:07:30 +01:00
Rolf Bjarne Kvinge 5329b19f62
[introspection] Migrate .NET code to use the new .NET-style availability attributes. (#13363)
* [tools] Extract the logic to parse OSPlatformAttribute platform names to a separate file/class.

* [introspection] Migrate .NET code to use the new .NET-style availability attributes.

This also means using the 'ApplePlatform' enum instead of the 'PlatformName'
enum, because the latter will be removed in .NET.

* [FileProvider] Exclude some deprecated API from .NET.

* [AVFoundation] Adjust availability attribute for AVCaptureStillImageOutput.HighResolutionStillImageOutputEnabled.

* Update tests.
2021-11-22 20:54:07 +01:00
Rolf Bjarne Kvinge 6302878ad5
[runtime] Implement storing the original working directory for later retrieval for .NET. Fixes #13392. (#13403)
This also adds the Runtime.OriginalWorkingDirectory to all platforms.

Fixes https://github.com/xamarin/xamarin-macios/issues/13392.
2021-11-22 18:50:28 +01:00
Rolf Bjarne Kvinge ec045766ca
[AVFoundation] Remove the AVMediaType enum and the AVMediaTypes.TimedMetadata field from .NET. (#13368) 2021-11-19 08:53:51 +01:00
Rolf Bjarne Kvinge 7d7bc8d25d
[tests] Don't run SCNViewTests on a VM. (#13388)
Hopefully fixes this crash:

    0x7fff6fbad5fd - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x354861360 - Unknown
    0x7fff71fb9707 - /System/iOSSupport/System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit : C3DEngineContextSetRenderContext
    0x7fff720802c0 - /System/iOSSupport/System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit : -[SCNRenderer _initWithOptions:isPrivateRenderer:privateRendererOwner:clearsOnDraw:context:renderingAPI:]
    0x7fff72126352 - /System/iOSSupport/System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit : -[SCNView _commonInit:]
    0x7fff72126551 - /System/iOSSupport/System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit : -[SCNView initWithFrame:options:]
2021-11-18 15:38:46 +01:00
Rolf Bjarne Kvinge e08cbbb8a9
[tests] Add the compiler response files from src/ to the .NET test builds. (#13351)
This means that the HAS_<FRAMEWORK> defines will now work in .NET test code
(as it already does in legacy test code).
2021-11-17 08:01:31 +01:00
Rolf Bjarne Kvinge 6d321c9f77
[tests] Don't import nunit.frameworks.target more than once. (#13362)
The nunit.framework.targets file is already imported in the
tests/common/shared-dotnet.targets file, which all these files imports as
well.
2021-11-16 16:46:08 +01:00
Rolf Bjarne Kvinge 66e596e9d9
[tests] Change TestRuntime.CheckSystemVersion to take a ApplePlatform value instead of a PlatformName enum. (#13350)
The PlatformName enum will be removed from .NET soon.
2021-11-15 08:06:36 +01:00
Rolf Bjarne Kvinge a8bf64b053
[CoreServices] Fix FSEventStream to properly pass the managed context to the FSEventStreamCreate method. Fixes #13325. (#13329)
The FSEventStreamCreate method takes a pointer to a structure with context information,
which contains a user-defined pointer value in addition to a few callbacks. Previously
we were passing the GCHandle as a pointer to this structure, which is obviously quite
wrong (as evidenced by a native crash when calling FSEventStreamCreate).

Changes:

* Modify the code to provide the expected context structure instead with the GCHandle
  as a field in that structure.
* Add a release callback to the context structure to release the GCHandle.
    * This avoids the need for storing the GCHandle as a field in the FSEventStream instance.
    * It also avoids also the need for overriding Dispose to release said GCHandle.
* Modify the callback code to use the [UnmanagedCallersOnly] attribute for .NET
  (ref: #10470).

This was a regression introduced in 8c99bdc9ad.

Fixes https://github.com/xamarin/xamarin-macios/issues/13325.
2021-11-10 11:13:28 -05:00
Rolf Bjarne Kvinge f4a5bf2720
[SystemSound] Don't implement the INativeObject interface for .NET. (#13324)
The supposed handle for system sounds is an uint, which does not match the
IntPtr handle INativeObject uses, so remove the INativeObject interface from
the SystemSound class.
2021-11-10 11:41:50 +01:00
Rolf Bjarne Kvinge bbb7690e1a
[Security] Remove the SslCipherSuite enum from .NET. Fixes #11498. (#13307)
* Remove the SslCipherSuite enum from .NET, it's complicated to implement
  correctly on macOS for both x64 and arm64, and it's also obsolete, so just
  remove it.
* Change the type for NSUrlSessionTaskTransactionMetrics.NegotiatedTlsCipherSuite
  to be TlsCipherSuite instead of SslCipherSuite for .NET (this is in fact the
  correct value according to the headers).

Fixes https://github.com/xamarin/xamarin-macios/issues/11498.
2021-11-08 22:09:47 +01:00
Rolf Bjarne Kvinge e088ceecff
[CoreBluetooth] Use new availability attributes and remove API that isn't in Apple's headers from .NET. (#13293)
* Change all XAMCORE_4_0 defines to NET defines to get the new API version in
  .NET.
* Remove some dead code.
* Change all the old-style [Availability] attributes to new-style [Obsoleted]
  or [Deprecated].
* Adjust tests.
2021-11-08 21:32:18 +01:00
Manuel de la Pena ff6209c844
[Network] Implement all bindings up to Xcode 13.1 (#13135)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-11-08 11:37:47 -05:00
Rolf Bjarne Kvinge 02f10a6583
[AppKit] Remove NSMenuView from .NET (it's a 32-bit only type). (#13291) 2021-11-08 16:15:41 +01:00
Rolf Bjarne Kvinge 08c1dca26a
[AppKit/Foundation/UIKit] Use Foundation.NSWritingDirection instead of UIKit.UITextWritingDirection and AppKit.NSWritingDirection for .NET. Fixes #6573. (#13243)
Fixes when building with XAMCORE_4_0:

> uikit.cs(6775,3): error CS0246: The type or namespace name 'UITextWritingDirection' could not be found (are you missing a using directive or an assembly reference?)
> uikit.cs(6597,3): error CS0246: The type or namespace name 'UITextWritingDirection' could not be found (are you missing a using directive or an assembly reference?)
> uikit.cs(6601,41): error CS0246: The type or namespace name 'UITextWritingDirection' could not be found (are you missing a using directive or an assembly reference?)

Fixes https://github.com/xamarin/xamarin-macios/issues/6573.
2021-11-05 08:12:44 +01:00
Rolf Bjarne Kvinge e965cf761e
[CGPDFObject] Make CGPDFObject a subclass of CGPDF[Array|Dictionary|Stream] + a few other fixes. (#13253)
* Make CGPDFObject a common subclass for the CGPDF[Array|Dictionary|Stream]
  classes, and keep the object lifetime code there.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Make any (IntPtr) constructors internal for .NET
* Simplify block creation code a bit.
2021-11-04 16:33:30 +01:00
Rolf Bjarne Kvinge 2da529c328
[CGImageMetadataTag] Subclass NativeObject + numerous other code updates (#13240)
* [CGImageMetadataTag] Subclass NativeObject + numerous other code updates

* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Runtime.GetNSObject<T> (IntPtr, bool)' overload to specify handle
  ownership, to avoid having to call NSObject.DangerousReleaes manually later.
* Remove the (IntPtr) constructor for .NET
* Fix nullability attribute.

* [tests] Don't dispose a property value.

It ends up being the object instance we've stored elsewhere, which we don't
expect to be disposed.
2021-11-04 14:54:06 +01:00
Rolf Bjarne Kvinge 696e7a5679
[ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere. (#13231)
* [ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere.

The PlatformHelper class is deprecated, so implement a new version that isn't
deprecated, and which shares a similar API between all platforms - the Check*
methods includes the name of the platform, because that makes it clearer which
version we're talking about from the call site. There's a quirk though:
there's no separate ChecktvOS or CheckMacCatalyst, because the system version
is the same as for iOS, so we can just use 'iOS'.

For macOS we can now use NSProcessInfo.ProcessInfo.OperatingSystemVersion to
determine the OS version, because it's supported in all versions of macOS we
support for .NET.

Fixes issues such as this when building with XAMCORE_4_0:

> CoreMedia/CMSync.cs(590,11): error CS0103: The name 'PlatformHelper' does not exist in the current context

* Bring back PlatformHelper.CheckSystemVersion, but only for !NET.

* [tests] Remove 32-bit macOS logic, it's long dead.

* [introspection] Implement OS version check using 'NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion' for macOS.

* [monotouch-test] Use TestRuntime.[Check|Assert]XcodeVersion instead of PlatformHelper.CheckSystemVersion.
2021-11-04 11:13:23 +01:00
Manuel de la Pena ea0ee04f30
[CoreAnimation] Add support for Xcode 13.1 rc. (#13227)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-11-03 18:52:48 -04:00
Manuel de la Pena b328512073
[Tests] Remove not needed usings in the CoreImage & CoreLocation tests. (#13256) 2021-11-03 17:24:44 -04:00
Manuel de la Pena ee3cfa63bb
[Tests] Remove not needed usings in the CoreGraphics tests. (#13255) 2021-11-03 17:13:47 -04:00
Manuel de la Pena 992afaf971
[Tests] Remove not needed usings in the CoreBluetooth and CoreAudioKit tests. (#13252) 2021-11-03 16:50:09 -04:00
Manuel de la Pena 86ac68fc31
[Tests] Remove not needed usings in the CoreData and CoreFoundation tests. (#13254) 2021-11-03 16:48:48 -04:00
Manuel de la Pena 88cf4b0c17
[Tests] Remove not needed usings in the Contacts tests. (#13250) 2021-11-03 16:42:06 -04:00
Manuel de la Pena 44a1b37abf
[Tests] Remove not needed usings in the Compression tests. (#13249) 2021-11-03 16:38:08 -04:00
Manuel de la Pena 8e62275615
[Tests] Remove not needed usings in the CoreAnimation tests. (#13251) 2021-11-03 16:37:28 -04:00
Manuel de la Pena 26a90c9ab3
[Tests] Remove not needed usings in the BGTasks tests. (#13248) 2021-11-03 16:37:14 -04:00
Manuel de la Pena 0a4a6736e9
[Tests] Remove not needed usings in the AVFoundation tests. (#13247) 2021-11-03 16:35:51 -04:00
Manuel de la Pena 42fcb4f1c5
[Tests] Remove not needed usings in the Network tests. (#13232) 2021-11-03 10:34:34 -04:00
Manuel de la Pena 69be49194e
[Tests] Remove not needed usings in the AudioToolboc tests. (#13234) 2021-11-03 10:34:02 -04:00
Manuel de la Pena 70936c3fcd
[Tests] Remove not needed usings in the AudioUnit tests. (#13235) 2021-11-03 10:33:42 -04:00
Manuel de la Pena 3b47f94f94
[Tests] Remove not needed usings in the Foundation tests. (#13233) 2021-11-03 10:33:17 -04:00
Rolf Bjarne Kvinge 545a4874f8
[SecIdentity] Subclass NativeObject + numerous other code updates (#13149)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle == IntPtr.Zero) instead of manually checking for IntPtr.Zero and
  throwing ObjectDisposedException.
* Use the 'Runtime.GetNSObject<T> (IntPtr, bool)' overload to specify handle
  ownership, to avoid having to call CFObject.CFRelease manually later.
* Use Array.Empty<T> instead of creating an empty array manually.
* Remove the (IntPtr) constructor for .NET.
2021-11-02 07:48:55 +01:00
Rolf Bjarne Kvinge f0c8738966
[tests] Add an Xcode 13.1 version check in WKPreferencesTest. (#13170)
Fixes this test failure on macOS 10.14:

    MonoTouchFixtures.WebKit.WKPreferencesTest
        [FAIL] TextInteractionEnabledTest :   Getter
            Expected: No Exception to be thrown
            But was:  <Foundation.ObjCException: NSInvalidArgumentException: -[WKPreferences setTextInteractionEnabled:]: unrecognized selector sent to instance 0x7fa228f12640
                at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_bool(intptr,intptr,bool)
                at WebKit.WKPreferences.set__OldTextInteractionEnabled (System.Boolean value) [0x0002c] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/mac/mobile/WebKit/WKPreferences.g.cs:482
                at WebKit.WKPreferences.set_TextInteractionEnabled (System.Boolean value) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/WKWebKit/WKPreferences.cs:32
                at MonoTouchFixtures.WebKit.WKPreferencesTest+<>c__DisplayClass0_0.<TextInteractionEnabledTest>b__0 () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/WebKit/WKPreferencesTest.cs:19
                at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
                at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
                --- End of stack trace from previous location where exception was thrown ---
                at NUnit.Framework.Internal.ExceptionHelper.Rethrow (System.Exception exception) [0x00006] in <d392db2fb3d64f4fa564a7b744fc7801>:0
                at NUnit.Framework.Internal.Reflect.DynamicInvokeWithTransparentExceptions (System.Delegate delegate) [0x00013] in <d392db2fb3d64f4fa564a7b744fc7801>:0
                at NUnit.Framework.Internal.ExceptionHelper.RecordException (System.Delegate parameterlessDelegate, System.String parameterName) [0x00067] in <d392db2fb3d64f4fa564a7b744fc7801>:0 >
2021-10-29 16:07:53 +02:00
Rolf Bjarne Kvinge f9ae3bd9a0
[monotouch-test] Fix a comparison to work with both C# nint and System.nint. (#13155) 2021-10-29 16:03:57 +02:00
Rolf Bjarne Kvinge 02431b9fc8
[.NET] Move the nfloat type to the ObjCRuntime namespace for .NET. (#13092)
Also move the NMath type from the System namespace to the ObjCRuntime namespace.

Ref: https://github.com/xamarin/xamarin-macios/issues/13087
2021-10-28 11:06:31 +02:00
Rolf Bjarne Kvinge b70e6f4674
Submodule MonoTouch.Dialog. (#13058)
* Submodule MonoTouch.Dialog.

Submodule MonoTouch.Dialog, so that we can easily build it using .NET. This
submodule will become redundant when/if we publish a .NET version of
MonoTouch.Dialog, but until that happens we need it at least for our own test
suites.

This also means we have to copy our NuGet.config and global.json files to the
MonoTouch.Dialog project directory so that we point msbuild to use our local
build.

New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@cbda703 [Touch.Client] Use MonoTouch.Dialog from a submodule. (#109)

Diff: 3345db2f4e..cbda703583

* Use relative path for submodule.

And fix indentation and set the branch name.

* Don't use 'RootTestsDirectory' when it might not be defined yet.

* [tests] Our test projects don't need to reference MonoTouch.Dialog directly.

The projects get the MonoTouch.Dialog reference indirectly through the
Touch.Client project reference.

* [tests] Only validate unique errors in the .NET unit tests.

* [tests] No need to reference System.Json anymore, that's handled directly in the MonoTouch.Dialog project.

* [tests] Reference nunit.framework.targets so we get a workaround for an NUnit issue everywhere.

* [msbuild] Only try to create a package if we're able to create an app bundle.

This fixes an issue where a library project would try (and fail) to create a
package when 'CreatePackage=true' (which could be set for the executable
project, but inherited by the library project since the executable project
depends on it).

* [tests] Adjust PackTest.BindingXcFrameworksProject to not set the AssemblyName property.

MSBuild ends up being very confused when the project we're trying to build
depends on other projects, because AssemblyName is set for all the projects
being build, and MSBuild complains about ambiguous projects:

> error: Ambiguous project name 'bindings-xcframework-test'
2021-10-26 08:18:34 +02:00
Manuel de la Pena aca9bb0046
[WebKit] Add support for Xcode 13.1 rc. (#13052)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-10-25 20:13:00 -04:00
Rolf Bjarne Kvinge af23d61926
[runtime] Fix a toggle ref deadlock when retaining objects. Fixes #13066. (#13071)
The deadlock goes like this:

1. Thread A holds the framework_peer_release_lock lock, and tries to lock the
   refcount_mutex lock.
2. Thread B holds the refcount_mutex, and is waiting for the GC to complete
3. Thread C is trying to lock the framework_peer_release_lock while running
   the GC.

The fix is in thread A, by not doing anything at all with the
framework_peer_release_lock lock locked.

The code contains extensive comments explaining the situation and the solution.

Fixes https://github.com/xamarin/xamarin-macios/issues/13066.

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2021-10-22 09:05:07 +02:00
Rolf Bjarne Kvinge a862d505de
[CFBundle] Subclass NativeObject + numerous other code updates (#13041)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create native
  strings (the fastest and least memory hungry option).
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle  == IntPtr.Zero) instead of manually checking for IntPtr.Zero and throwing
  ObjectDisposedException.
* Use CFArray helper methods to create arrays (and implement some helper methods
  that didn't exist).
* Add a few tests for the new CFArray helper methods.
2021-10-21 18:04:08 +02:00
Rolf Bjarne Kvinge 808419f3c3
[tests] Fix the name of monotouchtest. (#13042)
Fix the name of monotouchtest, so that the app/executable is found by the
makefile when trying to execute the test.
2021-10-20 21:17:55 +02:00
Rolf Bjarne Kvinge 56892d996d
[src] Rename MAC_* variables to MACOS_* variables. (#12998)
This makes it easier to iterate over the platforms we're building for, because
we can use "macOS" to compute the variable names we're interested in (like we
already can for iOS, tvOS, watchOS and MacCatalyst).
2021-10-18 07:24:37 +02:00
Rolf Bjarne Kvinge 6d8ef62705
[AVFoundation] Fix a few issues with AudioUnit. (#12954)
* Add an (IntPtr, bool) constructor so that AudioUnit works with Runtime.GetINativeObject.
* Keep track of ownership, so that AudioUnit doesn't free the native resources
  when it doesn't own them.
* Update a test to verify that calling 'AVAudioIONode.AudioUnit' multiple
  times and disposing the result between them works (this fails if AudioUnit
  doesn't keep track of ownership).
2021-10-08 07:52:40 +02:00
Rolf Bjarne Kvinge 63de01c21c
[tests] Fix packaging of Xamarin.Mac tests. (#12776)
I recently deleted the generated makefile support for building and running our
test suites. It turned out that it was used for building the packaged
Xamarin.Mac tests, so it wasn't as unused as I thought.

So fix the building and packaging of Xamarin.Mac tests to not use the
(non-existent) makefile targets, but instead replicate it with manual make
code.

Also take the opportunity to add packaging and execution of the .NET versions
of these test suites we execute on other macOS versions (both for macOS and
the Mac Catalyst).

* [devops] Use stricter matching when finding the Xamarin.Mac pkg link.

Otherwise the branch name in any package could end up matching the pattern we
were looking for:

	XM_PACKAGE=https://bosstoragemirror.blob.core.windows.net/wrench/tests-package-xamarin-mac-tests/15759261d425ae08494b0a26862a0b1356c5f8ec/5268864/package/Microsoft.iOS.Bundle.15.0.101-ci.tests-package-xamarin-mac-tests.68.pkg

is just clearly wrong.
2021-10-06 08:10:07 +02:00
Manuel de la Pena 67e1ca5459
[Metal] Add support for xcode 13 beta5 . (#12875)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-10-05 13:32:48 -04:00
Rolf Bjarne Kvinge 4c9e2668b5
[tests] Add more special cases for random network errors on CI. (#12879)
Ref: https://github.com/xamarin/maccore/issues/2304
2021-10-01 08:36:40 +02:00
Rolf Bjarne Kvinge 403bc2e774
[tests] Add a test to verify that AppDomain.CurrentDomain.BaseDirectory is always something. Fixes #12687. (#12885)
Fixes https://github.com/xamarin/xamarin-macios/issues/12687.
2021-10-01 08:29:56 +02:00
Rolf Bjarne Kvinge 3d182c5c54
[Metal] Fix a few issues in MTLDevice. (#12861)
* MTLCopyAllDevices returns a retained object, so we need to release it.
* MTLCopyAllDevicesWithObserver returns an observer (no need to provide one). This
  means we can obsolete the 'ref NSObject' overload (the API doesn't make sense),
  and instead add an 'out NSObject' overload.
* The returned observer from MTLCopyAllDevicesWithObserver is retained, so we must
  release it.
* The returned array from MTLCopyAllDevicesWithObserver is a retained object, so
  we need to release it.
* Simpify the supporting block code for the calls to MTLCopyAllDevicesWithObserver.
* Clean up the block we passed to MTLCopyAllDevicesWithObserver.
2021-09-29 07:54:42 +02:00
Manuel de la Pena b20ca55943
[Foundation] Remove warning due to the Equals accepting a null value. (#12839)
Removes the following warning during the builds:

```
warning CS8767: Nullability of reference types in type of parameter 'host' of 'bool NSHost.Equals(NSHost host)' doesn't match implicitly implemented member 'bool IEquatable<NSHost>.Equals(NSHost? other)' (possibly because of nullability attributes)
```

Test was added to ensure that we did not throw an exception.
2021-09-28 08:11:07 -04:00
Manuel de la Pena 339936f457
[Tests] Fix cecil tests. (#12853)
-  Added the marshaling attr and a test to ensure it is ok.
- Fix the cecil MarshalAs test to not skip over types when checking.
    This revealed multiple tests failures that needed fixing.

fixes: https://github.com/xamarin/maccore/issues/2519

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-09-28 08:09:23 -04:00
Manuel de la Pena ad673ae731
[CoreMedia] Add support for xcode13 (#12770)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-09-24 18:19:49 -04:00
Rolf Bjarne Kvinge a78700bb40
[tests] Add additional test to try to narrow down #xamarin/maccore@2443. (#12384) 2021-09-16 15:00:06 +02:00
Manuel de la Pena 124dc24bea
[AVFoundation] Add support for xcode 13 beta 5. (#12550)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-09-15 11:37:21 -04:00
Rolf Bjarne Kvinge 1192cd6975
[tests] Fix creation of IntPtr to work on a 32-bit system. (#12713) 2021-09-15 09:29:10 +02:00
Alex Soto 8bc4fc645c
[UIKit] Update bindings to Xcode 13 Beta 5 (#12706)
* [UIKit] Update bindings to Xcode 13 Beta 5

* Fix tvOS availability

* Apply feedback

* Add UIPointerAccessory and feedback

* Fix typo

* Fix availability

* Apply feedback and fix library field lookup
2021-09-14 16:31:45 -04:00
Rolf Bjarne Kvinge 71d2edbc80
[tests] Add debug spew to try to track down random test failure in NSMutableDictionary2Test.AddEntries. (#12711)
Ref: https://github.com/xamarin/maccore/issues/1605
2021-09-13 17:13:40 +02:00
Manuel de la Pena f1611df154
[CoreVideo] Add support for Xcode 13 beta3. (#12257)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2021-09-13 11:09:26 -04:00
Rolf Bjarne Kvinge 24ea02759f
[dotnet] Support SupportedOSPlatformVersion. Fixes #12336. (#12638)
* 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.
2021-09-08 09:20:05 +02:00
Rolf Bjarne Kvinge e707c7cda8
[tests] Remove assert that fails on M1 on Rosetta. (#12641)
Fixes this error when running on M1 (and Rosetta):

    MonoTouchFixtures.CoreFoundation.BundleTest.TestGetBundleIdNull : 0.9134 ms
        [FAIL] TestIsArchitectureLoadable :   arm64 Expected => false
            Expected: False
            But was:  True
                at MonoTouchFixtures.CoreFoundation.BundleTest.TestIsArchitectureLoadable() in xamarin-macios/tests/monotouch-test/CoreFoundation/BundleTest.cs:line 375
2021-09-07 18:52:53 +02:00
Manuel de la Pena a004b4781b
[CoreGraphics] Add support for xcode13 beta 5. (#12589) 2021-09-01 11:24:10 -04:00
Manuel de la Pena cda8808fa2
[Tests] Ignore a number of tests that fail on a VM. Update README. (#12597) 2021-08-31 17:45:14 -04:00
Rachel Kang 5bab0dad01
Merge pull request #12460 from rachelkang/xcode13.0-vision-b1
[Vision] Update bindings for Xcode 13.0 beta 1
2021-08-26 16:05:56 -04:00
Rolf Bjarne Kvinge 197b564c21 Merge remote-tracking branch 'origin/main' into darc-main-971a17ce-2b67-4dbe-bb13-8308d33e5f58 2021-08-24 07:26:26 +02:00
Rolf Bjarne Kvinge 3e728faa77 [tests] Update tests that use HttpClientHandler to get matching behavior with legacy Xamarin. 2021-08-24 07:26:19 +02:00
Rachel Kang a7ed18a19a
Fix VNUtilsTests 2021-08-23 14:48:32 -04:00
Rolf Bjarne Kvinge e2eed27a1f
[monotouch-test] Ignore several HttpMessageTest test cases in CI in case of network failures. (#12509)
Fixes https://github.com/xamarin/maccore/issues/2160.
Fixes https://github.com/xamarin/maccore/issues/2491.
Fixes https://github.com/xamarin/maccore/issues/2493.
Fixes https://github.com/xamarin/maccore/issues/2304.
2021-08-23 15:37:02 +02:00
Rolf Bjarne Kvinge e3cac56a70
[tools] Pass the right arguments to the AOT compiler for Mac Catalyst. Fixes #12484. (#12498)
* [xharness] Add LLVM test case for Mac Catalyst.

* [tests] Add make target to build monotouch-test using LLVM on Mac Catalyst.

* [tools] Pass the right arguments to the AOT compiler for Mac Catalyst. Fixes #12484.

Mac Catalyst is just special.

Fixes https://github.com/xamarin/xamarin-macios/issues/12484.
2021-08-23 09:47:27 +02:00
Rachel Kang cd3178c112
Update based on feedback 2021-08-19 12:13:25 -04:00
Rachel Kang cb1bfd64f3
[Vision] Update bindings for Xcode 13.0 beta 1 2021-08-17 10:04:29 -04:00
Manuel de la Pena bd7e5c20c1
[Xcode13] Bump to beta 5. (#12413) 2021-08-13 13:07:19 -04:00
Sebastien Pouliot 1c937ac39b
[tests][monotouch-test] Re-enable registrar test for conformsToProtocol for dotnet (#12411)
This works fine now. I'm fairly sure this was fixed when the the last
custom steps of the linker were ported for dotnet illink

Fix https://github.com/xamarin/xamarin-macios/issues/11540
2021-08-11 20:16:01 -04:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Rolf Bjarne Kvinge 5b23ea83b1
[monotouch-test] Use unique file names to avoid issues when multiple proceseses of monotouch-test are running simultaneously. Fixes #xamarin/maccore@2461. (#12395)
Fixes https://github.com/xamarin/maccore/issues/2461.
2021-08-11 09:52:02 +02:00
Rolf Bjarne Kvinge 6232edc9ed
[monotouch-test] Ignore ReadingListTest.DefaultReadingList. (#12383)
This test adds entries to the global reading list in Safari, and there's no
API for the test to clean up after itself, so the reading list becomes an
endless list of entries after a whlie.

Beside the fact that this is somewhat annoying for people who actually use
their reading lists, it can also can end up consuming a significant amount of
space on the hard drive, because Safari will download each site to be
available offline.
2021-08-09 14:51:44 +02:00
Rolf Bjarne Kvinge 6d078c2ac8
[tests] Add debug spew to track down #xamarin/maccore@2414. (#12354) 2021-08-06 09:45:55 +02:00
Rolf Bjarne Kvinge b06baea3c8
[tests] Merge the Main function into the AppDelegate class in numerous tests. (#12356)
Also use a non-obsolete overload of UIApplication.Main.

This shrinks our code and file count a bit.
2021-08-06 09:44:58 +02:00
Manuel de la Pena 9aef167b19
[PHASE] Add suppport for Xcode13 beta 2. (#12098) 2021-08-04 22:38:03 -04:00
Rolf Bjarne Kvinge a91e34f01b
[xharness] Automatically inline Imports to a "shared.csproj" when cloning projects. Fixes #12316 and #12277. (#12322)
This way we process the shared.csproj that we use in our .NET test projects.
The main effect is that we'll clone any project references included in the
shared.csproj, which will fix #12316. On another hand, it means that we'll
add/remove defines in referenced projects, which fixes #12277.

It also allows us to put more code in the "shared.csproj" files.

Fixes https://github.com/xamarin/xamarin-macios/issues/12316.
Fixes https://github.com/xamarin/xamarin-macios/issues/12277.
2021-08-04 18:13:02 +02:00
TJ Lambert 68a5091cfa
[AuthenticationServices] Updates for Xcode13 Beta3 (#12203)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-08-04 10:11:26 -04:00
Rolf Bjarne Kvinge 12cf14662f
[monotouch-test] Resolve symlinks in paths before comparing them. (#12321)
Fixes this test failure on device:

    [FAIL] CurrentDirectory :   Current directory at launch
      Expected string length 97 but was 89. Strings differ at index 1.
      Expected: "/private/var/containers/Bundle/Application/4824129A-8668-4CD9..."
      But was:  "/var/containers/Bundle/Application/4824129A-8668-4CD9-9280-7F..."
2021-08-03 07:36:26 +02:00
Rolf Bjarne Kvinge d506a13466
[monotouch-test] Teach HealthKit tests about new HKQuantityTypeIdentifiers/HKCategoryTypeIdentifiers. (#12317)
Fixes these test failures:

    MonoTouchFixtures.HealthKit.CategoryTypeIdentifier
    	[FAIL] EnumValues_22351 : AppleWalkingSteadinessEvent could not be created: System.ArgumentNullException: Value cannot be null.
    Parameter name: hkCategoryTypeIdentifier
      at ObjCRuntime.NativeObjectExtensions.GetNonNullHandle (ObjCRuntime.INativeObject self, System.String argumentName) [0x00003] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/INativeObject.cs:27
      at HealthKit.HKObjectType.GetCategoryType (Foundation.NSString hkCategoryTypeIdentifier) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/HealthKit/HKObjectType.g.cs:111
      at HealthKit.HKCategoryType.Create (HealthKit.HKCategoryTypeIdentifier kind) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/HealthKit/HKObjectType.cs:26
      at MonoTouchFixtures.HealthKit.CategoryTypeIdentifier.EnumValues_22351 () [0x001fd] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs:115
      at MonoTouchFixtures.HealthKit.CategoryTypeIdentifier.EnumValues_22351 () [0x0024f] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs:120

    MonoTouchFixtures.HealthKit.QuantityTypeIdentifier
    	[FAIL] EnumValues_22351 : AppleWalkingSteadiness could not be created: System.ArgumentNullException: Value cannot be null.
    Parameter name: hkTypeIdentifier
      at ObjCRuntime.NativeObjectExtensions.GetNonNullHandle (ObjCRuntime.INativeObject self, System.String argumentName) [0x00003] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/INativeObject.cs:27
      at HealthKit.HKObjectType.GetQuantityType (Foundation.NSString hkTypeIdentifier) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/HealthKit/HKObjectType.g.cs:162
      at HealthKit.HKQuantityType.Create (HealthKit.HKQuantityTypeIdentifier kind) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/HealthKit/HKObjectType.cs:19
      at MonoTouchFixtures.HealthKit.QuantityTypeIdentifier.EnumValues_22351 () [0x0017a] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs:87
      at MonoTouchFixtures.HealthKit.QuantityTypeIdentifier.EnumValues_22351 () [0x001cc] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs:92

Also make these tests show all failing enum values at once, instead of having
to run the test after adding each new case.
2021-08-02 17:41:51 +02:00
Rolf Bjarne Kvinge 3766cf8fa2
[monotouch-test] Use the same timezone for the calendar as we do for the time (UTC) in CalendarTest.DateComponentsTest. Fixes #xamarin/maccore@2481. (#12304)
Fixes https://github.com/xamarin/maccore/issues/2481.
2021-07-30 16:02:36 +02:00
Rolf Bjarne Kvinge 6253a88198
[monotouch-test] Give up in CaptiveNetworkTest.TryCopyCurrentNetworkInfo. Fixes #12278. (#12291)
Don't presume to be able to figure out whether we should get back network info
or not, so just remove the corresponding assert.

Fixes https://github.com/xamarin/xamarin-macios/issues/12278.
2021-07-30 09:52:32 +02:00
Manuel de la Pena dab0f2ed9a
[HealthKit] Add support for xcode13 beta4. (#12184) 2021-07-29 11:11:39 -04:00
Rolf Bjarne Kvinge d24b2203af
[monotouch-test] No need to ignore NSTimeZoneTest.All_28300 anymore. (#12241) 2021-07-28 15:01:28 +02:00
Rolf Bjarne Kvinge 7986b2f2af
[dotnet] Globalization works for Mac Catalyst now. Fixes #11392. (#12247)
Fixes https://github.com/xamarin/xamarin-macios/issues/11392.
2021-07-28 09:12:22 +02:00
Rolf Bjarne Kvinge 600ce3290b
[monotouch-test] Adjust CalendarTest.DateComponentsTest to use a specific time zone. (#12249)
Hopefully avoids random test failures like https://github.com/xamarin/maccore/issues/2471#issuecomment-887517838.
2021-07-28 09:08:52 +02:00
Rolf Bjarne Kvinge 0549af9736
[dotnet] Add support for the interpreter + AOT when needed. Fixes #11421 and #11724. (#12211)
* Add support for the interpreter everywhere.
* Add support for the AOT compiler everywhere we didn't support it before,
  because the interpreter needs it (at least System.Private.CoreLib.dll must
  be AOT-compiled when using the interpreter).
* Do FullAOT compilation on Mac Catalyst/ARM64 if we're not using the
  interpreter, since we can't use the JIT.
* Fix monotouch-test to be green on Mac Catalyst/ARM64.

Fixes https://github.com/xamarin/xamarin-macios/issues/11724.
Fixes https://github.com/xamarin/xamarin-macios/issues/11421.
2021-07-27 07:39:43 +02:00
Rolf Bjarne Kvinge 52ad560f3b
[monotouch-test] Make CalendarTest.TestOrdinality location-agnostic. Fixes #xamarin/maccore@2471. (#12192)
Modifying the test to use UTC datetimes instead of local datetimes + specify
the timezone for the NSCalendar to make the results predictable everywhere and
at all times.

Fixes https://github.com/xamarin/maccore/issues/2471.
2021-07-27 07:37:15 +02:00
Rolf Bjarne Kvinge a010778b30
[dotnet] Add support for implicit namespace imports. Fixes #12084. (#12173)
* [dotnet] Add support for implicit namespace imports. Fixes #12084.

Also update our templates to remove any using statements for implicitly imported
namespaces.

Fixes https://github.com/xamarin/xamarin-macios/issues/12084.

* [monotouch-test] Fix compilation error due to implicit namespace causing type conflict.

Fixes these errors:

    xamarin-macios/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs(54,54): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
    xamarin-macios/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs(54,88): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
    xamarin-macios/tests/monotouch-test/ImageIO/ImageMetadataTest.cs(40,54): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
    xamarin-macios/tests/monotouch-test/ImageIO/ImageMetadataTest.cs(40,88): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
2021-07-23 15:07:03 +02:00
Rolf Bjarne Kvinge 60fa8c90fe
[monotouch-test] Check a few more permissions that sometimes make the app crash due to a TCC violation on Mac Catalyst. (#12134)
* [monotouch-test] Check a few more permissions that sometimes make the app crash due to a TCC violation on Mac Catalyst.

* [monotouch-test] Adjust CaptureDeviceTest to only verify camera permission for Audio+Video, any other value is not supported by the OS.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-07-23 09:08:25 +02:00
Rolf Bjarne Kvinge 1b357204ee
[dotnet/msbuild] Add support for using LLVM to build .NET apps. Fixes #11379. (#12136)
Fixes https://github.com/xamarin/xamarin-macios/issues/11379.
2021-07-22 15:49:22 +02:00
Rolf Bjarne Kvinge c898f19f18 [monotouch-test] Improve the MTLDeviceTest to work on Mac Catalyst. 2021-07-22 10:37:28 +02:00
Rolf Bjarne Kvinge 676a8bb90d [monotouch-test] Fix some formatting and add assert messages 2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge f90a2f5c75 [monotouch-test] Adjust HttpClientHandler tests to cope with https://github.com/dotnet/runtime/issues/55986. 2021-07-20 14:54:02 +02:00
Rolf Bjarne Kvinge 793b7bb706 [monotouch-test] Make HttpClientTest.EnsureModifiabilityPostSend accept a InvalidOperationException inside a TargetInvocationException for .NET. 2021-07-20 14:54:02 +02:00
Rolf Bjarne Kvinge ab10456117 [monotouch-test] Ignore NSTimeZoneTest.All_28300 on Mac Catalyst.
Due to https://github.com/dotnet/runtime/issues/55941.
2021-07-20 14:54:02 +02:00
Rolf Bjarne Kvinge a3f9519ed1 Merge remote-tracking branch 'origin/main' into HEAD 2021-07-20 14:53:57 +02:00
Rolf Bjarne Kvinge 3c38f8ccd6
[dotnet] Enable autorelease pools for threadpools. Fixes #11750. (#12060)
Fixes https://github.com/xamarin/xamarin-macios/issues/11750.
2021-07-20 14:34:37 +02:00
Rolf Bjarne Kvinge c0a7bf5a0d Merge remote-tracking branch 'origin/main' into dotnet-llvm 2021-07-19 17:07:57 +02:00
Rolf Bjarne Kvinge e968a93282
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)
* [monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files.

Also complete the logic to build metal files, so that it works on Mac Catalyst as well.

* [monotouch-test] Add helper makefiles.

* [monotouch-test] Fix the RootTestsDirectory in the csproj.

* [monotouch-test] Add empty ItemGroup for xharness to put stuff in.

* [monotouch-test] Set DYNAMIC_REGISTRAR in each csproj, because xharness needs to be able to unset it.

* [monotouch-test] Exclude tests that don't work with AOT from Mac Catalyst/ARM64.

* [monotouch-test] Use 'ComputedPlatform' instead of 'Platform' to determine whether we're building for a device or not.

'Platform' can be anything, while we know the value of 'ComputedPlatform'. And
since 'ComputedPlatform' is computed after the csproj is read, we need to
delay the computation until later (thus in a separate target).
2021-07-19 16:43:22 +02:00
Manuel de la Pena 7ea2524ce6
[Xcode13] Bump xcode 13 to beta 3. (#12137) 2021-07-19 09:03:20 -04:00
Manuel de la Pena a96421fde0
[CoreWLan] Add XCode13 beta 1 support. (#12103)
Added support for MacCatalyst and cleaned the backlog.


Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-07-19 09:02:47 -04:00
Rolf Bjarne Kvinge f292635e48 [tests] Add helper makefiles for building monotouch-test and MySimpleApp in .NET from the command line. 2021-07-16 17:11:14 +02:00
Rolf Bjarne Kvinge fc8fb4818c
[runtime] Set the current directory to the root directory of the app bundle for all platforms in .NET. (#12104)
To have consistent behavior in .NET, set the current directory to the root of
the app bundle for all platforms.

This is a breaking change for legacy Xamarin.Mac, which used to set the
current directory to the Contents/Resources subdirectory, but there's a simple
workaround for customers that depend on the old behavior (change it in Main
themselves), and I believe the consistent experience across platforms warrants
this change.

Note that we already had a breaking change here for macOS/.NET: we were
(unintentionally) setting the current directory to the Contents/MonoBundle
directory, which neither matched mobile platforms, nor the legacy Xamarin.Mac
behavior.

This solves the problem of what to do for Mac Catalyst apps, because there's
no need to choose between the macOS or the mobile behavior, since they're the
same.

This required changing the launch of macOS apps using CoreCLR to pass the full
path to the entry assembly, since the entry assembly isn't in the current
directory anymore.
2021-07-14 17:42:49 +02:00
Rolf Bjarne Kvinge 236626f3a5 Merge remote-tracking branch 'origin/main' into darc-main-2c3dc6cd-c245-4d20-9461-75a98d067b3b 2021-07-13 00:36:45 +02:00
Rolf Bjarne Kvinge cfcedfbe53 [monotouch-test] Use CultureInfo.InvariantCulture instead of 'en-US' to parse invariant numbers.
Fixes this test failure:

	[FAIL] FloatingPointStretTrampolineTest : System.Globalization.CultureNotFoundException : Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
        en-US is an invalid culture identifier.
           at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride) in System.Private.CoreLib.dll:token 0x60027b4+0x2f
           at System.Globalization.CultureInfo..ctor(String name) in System.Private.CoreLib.dll:token 0x60027b3+0x0
           at MonoTouchFixtures.ObjCRuntime.FloatingPointStretTrampolines.ParseString(String str) in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs:line 640
           at MonoTouchFixtures.ObjCRuntime.FloatingPointStretTrampolines.Test_CGRect_IntPtr(NSString str) in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs:line 664
        --- End of stack trace from previous location ---
           at MonoTouchFixtures.ObjCRuntime.TrampolineTest.FloatingPointStretTrampolineTest() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs:line 242
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in System.Private.CoreLib.dll:token 0x6004f05+0x6a
2021-07-12 23:59:50 +02:00
Rachel Kang 9ca0942116
[Accessibility] Update bindings for Xcode 13.0 beta 1 (#11998)
Co-authored-by: Rachel Kang <rachelkang@microsoft.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-07-07 17:25:31 -04:00
Rolf Bjarne Kvinge 62865cb9b1 Merge remote-tracking branch 'origin/main' into HEAD 2021-06-21 11:36:34 +02:00
Sebastien Pouliot 3590070f6b
Revert "[tests] Preserve a required method in System.Private.CoreLib to work around a bug in .NET 6. (#10426)" (#11974)
This reverts commit 29727d6a8d.

https://github.com/dotnet/runtime/issues/46908 was fixed and the other part of the workaround was removed in PR#11958
2021-06-18 13:10:48 -04:00
Rolf Bjarne Kvinge 724d0fe1b3 [dotnet] Set a default RuntimeIdentifier and validate that we get a valid RuntimeIdentifier. Fixes #10861.
Also add tests:

* Remove RuntimeIdentifier from a few sample projects. These projects should
  continue to build just fine.
* Add tests for invalid RuntimeIdentifiers.

Fixes https://github.com/xamarin/xamarin-macios/issues/10861.
2021-06-18 10:34:35 +02:00
Sebastien Pouliot b4dcee199b
Revert "[tests][monotouch-test] Ignore NSTimeZoneTest / All_28300 on dotnet as it hangs" (#11975)
This reverts commit 5fdd4e2dec.
2021-06-17 20:53:26 -04:00
Rolf Bjarne Kvinge 9278ee1610
[monotouch-tests] Use a LinkDescription item to specify extra linker description files (#11948)
* It's easier to fix up the path to the linker description in xharness when
  cloning project files. This way maybe we'll be able to remove the [hardcoded
  logic in xharness][1] to handle ${ProjectDir}.
* .NET doesn't understand the ${ProjectDir} syntax, so this makes it possible
  to build these projects from the command line.

[1]: b2297d610d/src/Microsoft.DotNet.XHarness.iOS.Shared/Utilities/ProjectFileExtensions.cs (L1268)
2021-06-17 09:02:21 +02:00
Sebastien Pouliot f5896c1414
[dotnet] Change default http handler to NSUrlSessionHandler (#11956)
Also allow `SocketsHttpHandler` on dotnet
2021-06-16 19:50:09 -04:00
Sebastien Pouliot 2ecbb07068
[tests] Re-enable tests ignored due to dotnet/runtime #36897 (#11939)
They should now work (even if some tests required more changes) and
will be able to validate other changes.

ref: https://github.com/dotnet/runtime/issues/36897
2021-06-16 09:41:27 -04:00
Sebastien Pouliot 447c59db60
[iad] Remove most of the framework (#11906)
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).
2021-06-14 20:13:47 -04:00
Rolf Bjarne Kvinge 0921ae4e26
Bump to Xcode 13 beta 1. (#11861)
* 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>
2021-06-10 20:07:20 -04:00
Rolf Bjarne Kvinge 4dd95f5e10
[monotouch-test] Use TestRuntime.RunAsync instead of AppDelegate.RunAsync so that the system sound tests work on macOS as well. (#11770)
* [monotouch-test] Use TestRuntime.RunAsync instead of AppDelegate.RunAsync so that the system sound tests work on macOS as well.

* [AudioToolbox] Don't use a generic Action type in a P/Invoke, CoreCLR doesn't support it.

Fixes these test failures:

    [FAIL] FromFile : System.Runtime.InteropServices.MarshalDirectiveException : Cannot marshal 'parameter #4': Non-blittable generic types cannot be marshaled.
    	   at AudioToolbox.SystemSound.AudioServicesAddSystemSoundCompletion(UInt32 soundId, IntPtr runLoop, IntPtr runLoopMode, Action`2 completionRoutine, IntPtr clientData)
    	   at AudioToolbox.SystemSound.AddSystemSoundCompletion(Action routine, CFRunLoop runLoop) in Xamarin.Mac.dll:token 0x600bfd4+0x2b
    	   at MonoTouchFixtures.AudioToolbox.SystemSoundTest.FromFile() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 40

    [FAIL] TestCallbackPlayAlert : System.ArgumentException : The specified Type must not be a generic type. (Parameter 'delegate')
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal(Delegate d)
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(Delegate d) in System.Private.CoreLib.dll:token 0x6004586+0xe
           at ObjCRuntime.BlockLiteral.SetupBlockImpl(Delegate trampoline, Delegate userDelegate, Boolean safe, String signature) in Xamarin.Mac.dll:token 0x6001306+0xb
           at ObjCRuntime.BlockLiteral.SetupBlock(Delegate trampoline, Delegate userDelegate, Boolean safe) in Xamarin.Mac.dll:token 0x6001305+0x5e
           at ObjCRuntime.BlockLiteral.SetupBlockUnsafe(Delegate trampoline, Delegate userDelegate) in Xamarin.Mac.dll:token 0x6001307+0x0
           at AudioToolbox.SystemSound.PlayAlertSound(Action onCompletion) in Xamarin.Mac.dll:token 0x600bfc8+0x20
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.<>c__DisplayClass3_1.<<TestCallbackPlayAlert>b__0>d.MoveNext() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 93
        --- End of stack trace from previous location ---
           at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) in System.Private.CoreLib.dll:token 0x6002d4d+0x0
           at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in Xamarin.Mac.dll:token 0x6016560+0x0
        --- End of stack trace from previous location ---
           at ObjCRuntime.Runtime.InvokeMethod(MethodBase method, Object instance, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d1+0x274
           at ObjCRuntime.Runtime.InvokeMethod(MonoObject* methodobj, MonoObject* instanceobj, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d0+0x0
           at ObjCRuntime.Runtime.bridge_runtime_invoke_method(MonoObject* method, MonoObject* instance, IntPtr parameters, IntPtr& exception_gchandle) in Xamarin.Mac.dll:token 0x6001124+0x26
           at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1)
           at TestRuntime.RunAsync(DateTime timeout, Action action, Func`1 check_completed, NSImage imageToShow) in xamarin-macios/tests/common/mac/TestRuntime.macos.cs:line 18
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.TestCallbackPlayAlert() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 92

    [FAIL] TestCallbackPlaySystem : System.ArgumentException : The specified Type must not be a generic type. (Parameter 'delegate')
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal(Delegate d)
           at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(Delegate d) in System.Private.CoreLib.dll:token 0x6004586+0xe
           at ObjCRuntime.BlockLiteral.SetupBlockImpl(Delegate trampoline, Delegate userDelegate, Boolean safe, String signature) in Xamarin.Mac.dll:token 0x6001306+0xb
           at ObjCRuntime.BlockLiteral.SetupBlock(Delegate trampoline, Delegate userDelegate, Boolean safe) in Xamarin.Mac.dll:token 0x6001305+0x5e
           at ObjCRuntime.BlockLiteral.SetupBlockUnsafe(Delegate trampoline, Delegate userDelegate) in Xamarin.Mac.dll:token 0x6001307+0x0
           at AudioToolbox.SystemSound.PlaySystemSound(Action onCompletion) in Xamarin.Mac.dll:token 0x600bfca+0x20
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.<>c__DisplayClass2_1.<<TestCallbackPlaySystem>b__0>d.MoveNext() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 74
        --- End of stack trace from previous location ---
           at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) in System.Private.CoreLib.dll:token 0x6002d4d+0x0
           at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in Xamarin.Mac.dll:token 0x6016560+0x0
        --- End of stack trace from previous location ---
           at ObjCRuntime.Runtime.InvokeMethod(MethodBase method, Object instance, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d1+0x274
           at ObjCRuntime.Runtime.InvokeMethod(MonoObject* methodobj, MonoObject* instanceobj, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d0+0x0
           at ObjCRuntime.Runtime.bridge_runtime_invoke_method(MonoObject* method, MonoObject* instance, IntPtr parameters, IntPtr& exception_gchandle) in Xamarin.Mac.dll:token 0x6001124+0x26
           at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1)
           at TestRuntime.RunAsync(DateTime timeout, Action action, Func`1 check_completed, NSImage imageToShow) in xamarin-macios/tests/common/mac/TestRuntime.macos.cs:line 18
           at MonoTouchFixtures.AudioToolbox.SystemSoundTest.TestCallbackPlaySystem() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 73
2021-06-02 18:19:25 +02:00
Rolf Bjarne Kvinge 3eb01e728e
[monotouch-test] It doesn't look like the TryCopyCurrentNetworkInfo test works in the iOS 11 simulator either. (#11764)
* [monotouch-test] It doesn't look like the TryCopyCurrentNetworkInfo test works in the iOS 11 simulator either.

Partial fix for #11504.

* Always assert null.
2021-06-02 16:01:28 +02:00
Rolf Bjarne Kvinge bfe3a1bce0
[monotouch-test] Try to fix a few runtime warnings about unbalanced calls to begin/end appearance transitions. (#11783)
Try to fix these warnings that show up at runtime by checking if the root view
controller is a UINavigationController, and doing the right thing:

> Unbalanced calls to begin/end appearance transitions for <...>
2021-06-02 16:00:40 +02:00
Rolf Bjarne Kvinge 414d1eb140
[monotouch-test] Exclude any *.cs file in any obj subdirectory, not only the immediate subdirectory. (#11766)
This means that we won't pick up generated *.cs files from the
monotouch-test/dotnet/macOS/monotouch-test.csproj project when building the
monotouch-test/monotouch-test.csproj project, which results in the C# compiler
complaining about duplicate types, or unknown types (because the generated
code is for .NET 6, while we might be compiling for legacy Xamarin).
2021-06-02 08:09:33 +02:00
Rolf Bjarne Kvinge 7adbdb0437
[monotouch-test] Don't run SystemSound tests in the simulator. (#11763)
Sometimes they work, sometimes they don't.

Just ignore them to avoid unreliable test results.

Partial fix for #11504.
2021-06-02 07:49:11 +02:00
Rolf Bjarne Kvinge 071ac6463e
[coreclr] Support for NSAutoreleasePools has now been implemented for background threads for both MonoVM and CoreCLR. Fixes #11256. (#11749)
Fixes https://github.com/xamarin/xamarin-macios/issues/11256.
2021-06-02 07:41:44 +02:00
Rolf Bjarne Kvinge abb7d1f6b6
[monotouch-test] Ignore HKQuantityTypeIdentifier.AppleMoveTime on iOS versions where it didn't exist. (#11765)
It was introduced with Xcode 12.5, so ignore it on earlier OS versions.

Partial fix for #11504.
2021-06-02 07:39:34 +02:00
Rolf Bjarne Kvinge f3b46b955f
[runtime] Add support for toggle refs to CoreCLR. (#11757)
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.
2021-06-02 00:13:49 +02:00
Rolf Bjarne Kvinge 0864407f78
[tests] Adjust MX8029_b and MX8033 tests to cope with slightly different exception message output for CoreCLR. (#11732)
* [tests] Adjust MX8029_b and MX8033 tests to cope with slightly different exception message output for CoreCLR.

Fixes these unit tests:

    [FAIL] MX8029_b :   Message
      Expected string length 217 but was 238. Strings differ at index 149.
      Expected: "...lector: setIntArray:\n\tMethod: MonoTouchFixtures.ObjCRuntim..."
      But was:  "...lector: setIntArray:\n\tMethod: System.Void MonoTouchFixture..."
      ----------------------------------------------^
      at MonoTouchFixtures.ObjCRuntime.RuntimeTest.MX8029_b() in /Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/monotouch-test/ObjCRuntime/RuntimeTest.cs:line 625

    [FAIL] MX8033 :   Message
      Expected string length 192 but was 207. Strings differ at index 129.
      Expected: "...\n\tSelector: intArray\n\tMethod: MonoTouchFixtures.ObjCRuntim..."
      But was:  "...\n\tSelector: intArray\n\tMethod: System.Int32[] MonoTouchFixt..."
      ------------------------------------------------^
      at MonoTouchFixtures.ObjCRuntime.RuntimeTest.MX8033() in /Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/monotouch-test/ObjCRuntime/RuntimeTest.cs:line 644

* There's no need to restrict the TestRuntime.IsCoreCLR method to .NET code only.

The logic works just as well on legacy Xamarin as well.

* Make code C# 7.3 compatible.

Fixes this error:

> xamarin-macios/tests/common/TestRuntime.cs(1183,46): error CS8370: Feature 'not pattern' is not available in C# 7.3. Please use language version 9.0 or greater.
2021-06-01 15:56:54 +02:00
Rolf Bjarne Kvinge b4a7a9ffe8
[tests] Re-enable Mac Catalyst tests related to the GC not working. (#11752)
This seems to be working again now.
2021-06-01 07:21:18 +02:00
Rolf Bjarne Kvinge fdae69f5d6
[tests] Only run the RegistrarTest.CustomUserTypeWithDynamicallyLoadedAssembly test from a source checkout. (#11743)
It needs another assembly built from the source tree, so it won't work unless
executed from a source checkout. This way we don't try to run it on older
macOS versions, where the required assembly won't exist.
2021-05-31 15:43:25 +02:00
Rolf Bjarne Kvinge b7f87340a5
[tests] Don't run the MTLDeviceTest.ReturnReleaseTest unless Metal is available. (#11742) 2021-05-31 15:25:26 +02:00
Rolf Bjarne Kvinge 7aa0a10284
[monotouch-test] Ignore a few audio-related tests when we're running on a VM. (#11744)
Fixes these failures when on a VM:

    Xamarin.Mac.Tests.AudioUnitTests
    	[FAIL] GetCurrentDevice_Test :   Expected: True
      But was:  False

    		  at Xamarin.Mac.Tests.AudioUnitTests.GetCurrentDevice_Test () [0x00011] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/AudioUnit/AudioUnit.cs:37
    Xamarin.Mac.Tests.AudioUnitTests : 13 ms

    Xamarin.Mac.Tests.AUGraphTests
    	[FAIL] DoTest : Did not see events after 1 second
    		  at Xamarin.Mac.Tests.AUGraphTests.WaitOnGraphAndMixerCallbacks () [0x00050] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/AudioUnit/AUGraphTestMac.cs:93
    		  at Xamarin.Mac.Tests.AUGraphTests.DoTest () [0x0004c] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/AudioUnit/AUGraphTestMac.cs:66
    Xamarin.Mac.Tests.AUGraphTests : 3113 ms

    Xamarin.Mac.Tests.AVAudioIONodeTests
    	[FAIL] AVAudioIONodeTests_AudioUnitTest : Foundation.ObjCException : com.apple.coreaudio.avfaudio: error -10879
    		  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSend(intptr,intptr)
    		  at AVFoundation.AVAudioEngine.get_OutputNode () [0x00030] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/mac/mobile/AVFoundation/AVAudioEngine.g.cs:1099
    		  at Xamarin.Mac.Tests.AVAudioIONodeTests.AVAudioIONodeTests_AudioUnitTest () [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/AVFoundation/AVAudioIONode.cs:23
    		  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
    		  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
    Xamarin.Mac.Tests.AVAudioIONodeTests : 7 ms
2021-05-31 15:25:08 +02:00
Rolf Bjarne Kvinge 2bee92225c
[runtime] Complete support for exception marshalling on CoreCLR. (#11734)
* [runtime] Add support for exception marshalling to CoreCLR.

* [runtime] Add an empty implementation of the toggle ref machinery.

We need this to use the unhandled exception handler support in CoreCLR,
because the ObjectiveCMarshal.Initialize call to initialize unhandled
exception support requires passing toggle ref callbacks as well.

* [tests] The TestConstrainedGenericType test can now be re-enabled, after a few updates.
2021-05-31 08:10:34 +02:00
Rolf Bjarne Kvinge 165941ec14
[Runtime] Complete the CoreCLR implementation of setting the pending managed exeption. (#11709)
This made it possible to unignore some tests.

Co-authored-by: Alex Soto <alex@alexsoto.me>
2021-05-28 13:20:49 +02:00
Rolf Bjarne Kvinge c88c0b5283
[dotnet] Remove the .NET workload resolver workaround, it's not needed anymore. (#11695) 2021-05-27 07:30:46 +02:00
Rolf Bjarne Kvinge ba4fa19267
[runtime] Intercept the objc_msgSend family of functions using CoreCLR's supported mechanisms. (#11692)
This allows us to re-introduce a few tests.
2021-05-27 07:29:39 +02:00
Rolf Bjarne Kvinge 295533c26f
[tests] Add helper makefile for running monotouch-test on .NET/macOS from the command line with either MonoVM or CoreCLR. (#11656) 2021-05-25 08:19:01 +02:00
Rolf Bjarne Kvinge 1762888e1d
[tests] Build the custom-type-assembly separately for .NET (#11629)
It's a bit weird to build it twice, but it's the most straight forward way of
making the test work if either the .NET build or the legacy build is disabled.
2021-05-20 16:12:21 +02:00
Rolf Bjarne Kvinge ee5e2f0b09
[monotouch-test] Ignore tests that require exception marshalling on CoreCLR for now, they fail. (#11615)
This makes monotouch-test green when using CoreCLR, both when using the
dynamic and the static registrar.

Ref: https://github.com/xamarin/xamarin-macios/issues/10940
2021-05-20 07:34:30 +02:00
Rolf Bjarne Kvinge 551be877bd
[monotouch-test] Ignore the SslSupportedCiphers test on .NET due to #11498. (#11613)
The underlying size of the SslCipherSuite is wrong, so the test fails.

Ref: https://github.com/xamarin/xamarin-macios/issues/11498
2021-05-20 07:33:55 +02:00
Rolf Bjarne Kvinge 69e6e83cc7
[tests] Add a .NET/MacCatalyst variation of monotouch-test. (#11539)
Also:

* Use the right arm64 runtime identifier depending on the target platform.
* Don't add CoreCLR variations of Mac Catalyst tests.
* Exclude UISearchDisplayController from tests, since it isn't available in
  Mac Catalyst anymore.
2021-05-18 18:39:12 +02:00
Rolf Bjarne Kvinge 34772d23bc
[Runtime] Don't skip dynamic user type checking as long as dynamic registration is supported. (#11588)
When checking whether a type is a user type or not, we might have to do a
dynamic check if the dynamic registrar is available. Otherwise we may run into
a situation where the static registrar ran during the app build, but then the
app loaded additional assemblies at runtime, and those assemblies contained
user types that were registered using the dynamic registrar, so the static
registrar doesn't know about those custom types (in other words: we need to
check at runtime).
2021-05-18 16:28:09 +02:00
Rolf Bjarne Kvinge 3f507b3ede [monotouch-test] Ignore tests that require globalization to work for Mac Catalyst.
Globalization doesn't work yet for Mac Catalyst: https://github.com/xamarin/xamarin-macios/issues/11392
2021-05-18 11:42:37 +02:00
Rolf Bjarne Kvinge bbfa3feee9 Merge remote-tracking branch 'origin/main' into tests-mac-catalyst-dotnet 2021-05-18 09:03:29 +02:00
Rolf Bjarne Kvinge e8f26723ef
[CoreGraphics] Adjust CGPDFOperatorTable to not use a generic Action delegate. (#11560)
* CoreCLR doesn't support generic Action delegates in reverse (P/Invokes), so
  we need to find a different solution.
* The native CGPDFOperatorTable callback API is not very friendly to us,
  because we can't pass it callback-specific data, which means that the
  managed caller must conform to the FullAOT requirement of the managed
  callback (must be a static function; must have a MonoPInvokeCallback
  attribute).
* We can leverage the new function pointer syntax in C# 9 to make these
  requirements enforced by the C# compiler (unmanaged function pointer +
  UnmanagedCallersOnly attribute). The resulting API is still clunky to use,
  but I don't see any way around that.

Fixes this monotouch-test failure with CoreCLR:

    [FAIL] Tamarin : System.Runtime.InteropServices.MarshalDirectiveException : Cannot marshal 'parameter #3': Non-blittable generic types cannot be marshaled.
               at CoreGraphics.CGPDFOperatorTable.CGPDFOperatorTableSetCallback(IntPtr table, String name, Action`2 callback)
               at CoreGraphics.CGPDFOperatorTable.SetCallback(String name, Action`2 callback)
               at MonoTouchFixtures.CoreGraphics.PDFScannerTest.Tamarin() in xamarin-macios/tests/monotouch-test/CoreGraphics/PDFScannerTest.cs:line 102

Ref: https://github.com/dotnet/runtime/issues/32963
2021-05-17 07:45:04 +02:00
Rolf Bjarne Kvinge 9e6704ea4e Merge remote-tracking branch 'origin/main' into tests-mac-catalyst-dotnet 2021-05-14 08:04:07 +02:00
Sebastien Pouliot b46cea29c7
[dotnet][tests] Fix monotouch-test RegistrarRemoval (#11527)
The registrar removal was fixed recently but the test was still failing.
Turns out xharness modify the linker setting for this test (as the
linker is required for this optimization) but the newer dotnet csproj
did not have an entry (to modify).

Fixes https://github.com/xamarin/xamarin-macios/issues/10512

[xharness] Fix monotouch-test build when LinkSdk is used for dotnet projects

Skip failing assertion, issue filled
2021-05-13 17:01:20 -04:00
Rolf Bjarne Kvinge 12afa170bf [tests] Add a .NET/MacCatalyst variation of monotouch-test.
Also:

* Use the right arm64 runtime identifier depending on the target platform.
* Don't add CoreCLR variations of Mac Catalyst tests.
* Exclude UISearchDisplayController from tests, since it isn't available in
  Mac Catalyst anymore.
2021-05-13 16:03:34 +02:00
Manuel de la Pena 01d11263b9
[Tests] Ignore tests that fail on VMs (#11524)
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
2021-05-13 08:41:07 -04:00
Rolf Bjarne Kvinge 82f8ca80a1
[tests] Make ImageCaptioningTest.SetCaption restore the original value at the end. (#11499)
This makes it so that ImageCaptioningTest.GetCaption doesn't fail because it
gets values it doesn't expect.
2021-05-12 07:56:11 +02:00
Rolf Bjarne Kvinge 6c3bf9a4c8 [tests] Add a comment about Rosetta. 2021-05-12 07:34:11 +02:00
Rolf Bjarne Kvinge 12ba642b19 [monotouch-test] Adjust TestTypeEncodings for ARM64 on macOS. 2021-05-11 15:54:39 +02:00
Rolf Bjarne Kvinge 6457c5a5a4 [tests] Update tests to cope with macOS and simulator running on ARM64. 2021-05-11 15:54:39 +02:00
Rolf Bjarne Kvinge ccbdb33b93 [monotouch-test] Adjust BundleTest.TestIsArchitectureLoadable for ARM64.
We can still load an X64 executable when running on an ARM64 CPU.
2021-05-11 15:54:39 +02:00
Manuel de la Pena 47f273b4f6
[Tests] Update xamarin domain to make tests not fail. (#11408)
A wrong implementation of a redirect was added and returns a 403 and not
a 302 resulting in an error. Update to the final destination of the
redirect and be happy.

fixes https://github.com/xamarin/maccore/issues/2432
2021-05-02 20:11:16 -04:00
Rolf Bjarne Kvinge ec7dc80b59
[tests] Add a bluetooth usage description to monotouch-test/macOS. (#11355)
This seems to be required when running monotouch-test with lldb (!) - no idea
why it doesn't fail otherwise.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-04-29 08:37:36 +02:00
Sebastien Pouliot 5accd102cf
[dotnet][tvos] Enable ICU (instead of using Invariant) and additional tests (#11247) 2021-04-21 20:19:05 -04:00
dotnet-maestro[bot] e8f437319a
[main] Update dependencies from dotnet/installer (#11175)
* Update dependencies from https://github.com/dotnet/installer build 20210408.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21208.1

* Update dependencies from https://github.com/dotnet/installer build 20210409.4

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21209.4

* Update dependencies from https://github.com/dotnet/installer build 20210410.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21210.1

* same P4 specific fix as ccb43cba56
but the ICU support was added based on P3 but merged after ^

* Update dependencies from https://github.com/dotnet/installer build 20210412.5

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21212.5

* Update dependencies from https://github.com/dotnet/installer build 20210413.70

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21213.70

* Update dependencies from https://github.com/dotnet/installer build 20210414.14

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21214.14

* Update to new package names

Thanks @pjcollins for the heads up https://github.com/xamarin/xamarin-macios/pull/11175#issuecomment-819936692

* Update dependencies from https://github.com/dotnet/installer build 20210415.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21215.1

* Fix build (path changed to include '.mono')

* remove more '.mono' special case that are not needed anymore

* Update dependencies from https://github.com/dotnet/installer build 20210415.12

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21215.12

* Fix building apps (it now finds the native libs)

Credits to @filipnavara

8325f8dadc

* Add back IsTrimmable (or nothing gets linked)

* Update dependencies from https://github.com/dotnet/installer build 20210418.6

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21218.6

* Keep downloading the CoreCLR runtime packs.

* [runtime] Adjust the build to link with the correct runtime library for CoreCLR.

* [tests][monotouch-test] Ignore NSTimeZoneTest / All_28300 on dotnet as it hangs

Introduced with https://github.com/dotnet/runtime/pull/48931

Issue https://unicode-org.atlassian.net/browse/ICU-21591
PR https://github.com/unicode-org/icu/pull/1699

* [dotnet][msbuild] Add more (missing) '\'

Fix satellite/location assemblies and some unit tests

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-04-20 09:09:56 -04:00
Sebastien Pouliot f85af095da
[dotnet] Add ICU support for iOS builds (#11163)
and re-enable some tests for dotnet

Part of the fix for https://github.com/xamarin/xamarin-macios/issues/8906

Known Issues
* [some Calendar are not the expected ones](https://github.com/dotnet/runtime/issues/50859)
* [No support for tvOS (bitcode)](https://github.com/dotnet/runtime/issues/48508)
2021-04-09 17:06:26 -04:00
Alex Soto e5818d815b [monotouch-tests] disable some more MacCat crashers 2021-04-07 00:04:48 -04:00
Alex Soto 06185ea8fc [monotouch-tests] Import some fixes from xamarin/xamarin-macios#10587 2021-04-06 22:59:51 -04:00
Alex Soto bf682fd2aa Fix submodules and disable AddressBookTests in MacCat 2021-04-06 20:47:17 -04:00
Alex Soto 58403035f5 [monotouch-tests] Fix crasher in MacCat 2021-04-04 19:22:19 -04:00
Alex Soto bc1d8513a6 Merge remote-tracking branch 'xamarin/xcode12.5' into alex-xcode12.5-main 2021-04-02 21:46:31 -04:00
Peter Collins 5c12fdfac9
[build] Use arcade dependency management tooling (#10890)
* [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>
2021-04-02 00:02:27 -04:00
Sebastien Pouliot 747cc9a2b8
[dotnet] Fix device builds (#11036)
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
2021-03-31 12:59:07 -04:00
Rolf Bjarne Kvinge 9153edebda
[runtime] Redirect to our objc_msgSend wrapper functions when needed for .NET code. (#10932)
This makes the mono_dllmap_insert function unnecessary for .NET, so remove it.

Ref: https://github.com/dotnet/runtime/issues/48110
Ref: https://github.com/dotnet/runtime/issues/43204
Ref: #10504
2021-03-24 09:17:35 +01:00
Sebastien Pouliot 584b45a25e
[catalyst] Remove extraneous API detected by xtro (#10872)
This fixes almost [1] all `extra` API detected from the extrospection
(header-based) tests for MacCatalyst. This is needed to complete the
introspection fixes (without having _too large PR).

[1] except `!extra-null-allowed!` since those are still in progress for
all platforms
2021-03-16 16:04:01 -04:00
Rolf Bjarne Kvinge 7ac3c658e0
[tests] Preserve all test fixtures. (#10870)
* [tests] Preserve all test fixtures.

This fixes the wildly diffetent number of tests when running xammac tests with and without linking.

Without linking:

> Tests run: 2446 Passed: 2321 Inconclusive: 9 Failed: 0 Ignored: 125

vs with linking:

> Tests run: 1885 Passed: 1802 Inconclusive: 4 Failed: 0 Ignored: 83

Now we run the same tests either with or without linking.

One test was updated to not fail when linking is enabled.

Also add a test to ensure all future test fixtures are preserved.

* Remove whitespace noise.
2021-03-16 15:15:30 +01:00
Sebastien Pouliot 00a69e1654
[dotnet] Update `Min*` constants and fix builds for tests (#10835)
We're bumping the minimum OS versions for all supported platforms
https://github.com/dotnet/core/blob/master/release-notes/6.0/6.0-supported-os.md

Intro's `Introduced` test is ignored as it require (a lot of) changes. This
will be fixed in separate PRs and gradually re-enabled.

iOS
```
[FAIL] Introduced : 7573 API with unneeded or incorrect version information
```

tvOS
```
[FAIL] Introduced : 299 API with unneeded or incorrect version information
```

Tracking progress in https://github.com/xamarin/xamarin-macios/issues/10834
2021-03-13 10:38:46 -05:00
Sebastien Pouliot c830da3c23
[coremedia] Update for Xcode 12.5 beta 3 (#10860) 2021-03-13 10:23:04 -05:00
Alex Soto ba58ddd217
[UIKit] Update bindings for Xcode 12.5 Beta 1 to Beta 3 (#10851)
* [UIKit] Update bindings for Xcode 12.5 Beta 1 to Beta 3

* Fix condition

* Apply feedback!

* Update tests/monotouch-test/UIKit/UIListSeparatorConfigurationTest.cs
2021-03-12 12:26:24 -05:00
Rolf Bjarne Kvinge d1718c63b3
[tests] Adjust Assembly.GetType calls to find nested types due to different behavior in CoreCLR. (#10796)
Assembly.GetType works differently between CoreCLR and Mono for nested types:
Mono accepts both '/' and '+' as the character separating the declaring type
from the nested type, while CoreCLR only accepts '+'.

So just switch to '+', since that works everywhere.
2021-03-06 01:06:59 +01:00
Rolf Bjarne Kvinge 2ddef0b306
[monotouch-test] Our P/Invokes here too needs MarshalAs attributes for boolean return types and parameters. (#10791) 2021-03-06 01:05:45 +01:00
Rolf Bjarne Kvinge 2d6a3c42a7
Bump to .NET 6.0.100-preview.2.21153.28. (#10788)
* Bump to .NET 6.0.100-preview.2.21153.28.

* [tests] Ignore failing tests due to dotnet/runtime#49201.
2021-03-05 16:28:31 +01:00
Rolf Bjarne Kvinge 871e7b1cd0
[runtime] Build our runtime for Mac Catalyst/ARM64 for .NET. (#10739)
* [runtime] Build our runtime for Mac Catalyst/ARM64 for .NET.

* [ObjCRuntime] There's no need for the StartWWAN implementation on Mac Catalyst.

This also fixes a build error:

    error MT5214: Native linking failed, undefined symbol: _xamarin_start_wwan. This symbol was referenced by the managed member ObjCRuntime.Runtime.xamarin_start_wwan.

* Only exclude xamarin_start_wwan in the .NET version of Mac Catalyst.

* [tests] Update to not run the StartWWAN test on Mac Catalyst.

* Update conditional logic.

* Fix build with newer make versions.
2021-03-03 07:48:07 +01:00
Sebastien Pouliot 755b60e64c
[catalyst] Remove "unknown" API inside existing frameworks (#10731)
xtro tests are based on Apple's header files and report as _unknown_
bindings to API that are not found in headers - Catalyst in this case.

Removing them is required so the applications can be submitted to the
AppStore.
2021-02-26 11:49:24 -05:00
Sebastien Pouliot 0f69381be8
[catalyst][addressbookui] Remove AddressBookUI framework that is not available on Catalyst (#10711)
This required working around internal ctor that uses internal (non
re-generated) types. E.g.

```
build/dotnet/maccatalyst/ref/Xamarin.iOS.cs(9201,64): error CS0234: The type or namespace name 'ABFunc<>' does not exist in the namespace 'AddressBookUI' (are you missing an assembly reference?)
```

We cannot just skip such constructor since the C# compiler will add a
**public** default one when none is present (and that's the case for
the error above),

This also required fixing the ctor chaining code (which can't be shared
with the, previously fixed, override code) so base classes could be
called for some `*EventArg` types.

Follow up to https://github.com/xamarin/xamarin-macios/pull/10658 , https://github.com/xamarin/xamarin-macios/pull/10678 and https://github.com/xamarin/xamarin-macios/pull/10706

This is the last framework that needs removal - but there's still a few
`unknown-*` entries in Catalyst-supported frameworks (more PR coming).
2021-02-25 11:22:02 -05:00
Rolf Bjarne Kvinge 538fd86172
[tests] Add a .NET/macOS version of monotouch-test. (#10672)
* [tests] Add a .NET/macOS version of monotouch-test.

I made a macOS version of monotouch-test instead of a .NET version of xammac tests,
so that one day we might have only one test suite for all our API tests.

* Add a project file for .NET/macOS
* Fix some code to handle the fact that we're called 'monotouchtest' on macOS (but
  only on .NET).
* Ignore exception marshalling tests, those aren't working yet.

* [xharness] Add support for .NET/macOS and add a macOS version of monotouch-test to our tests

* [dotnet-linker] Skip libSystem.Net.Security.Native and libSystem.Native when collecting native methods to preserve for .NET/macOS.
2021-02-24 16:07:04 +01:00
Sebastien Pouliot 89f1c668b4
[catalyst][arkit] Remove ARKit framework that are is available on catalyst (#10706)
This required fixing the override code so that all (not just one) the
parameter types would match. Fixes

```
build/maccatalyst/reference/Xamarin.iOS.cs(11036,50): error CS0115: 'ARSCNView.HitTest(CGPoint, ARHitTestResultType)': no suitable method found to override
build/maccatalyst/reference/Xamarin.iOS.cs(11703,50): error CS0115: 'ARSKView.HitTest(CGPoint, ARHitTestResultType)': no suitable method found to override
```

Follow up to https://github.com/xamarin/xamarin-macios/pull/10658 and
https://github.com/xamarin/xamarin-macios/pull/10678
2021-02-23 16:48:45 -05:00
Sebastien Pouliot a0634460ce
[catalyst] Remove more framework that are not available on catalyst (#10678)
Follow up to https://github.com/xamarin/xamarin-macios/pull/10658

This includes a `.ctor` chaining fix for the forwarder tool which
resulted in several errors like:

```
build/dotnet/maccatalyst/ref/Xamarin.iOS.cs(12640,17): error CS1729: 'UIScene' does not contain a constructor that takes 0 arguments
```

There's two different issues blocking ARKit and AddressBookUI that
will be solved in different PR.

When used with Xamarin.MacCatalyst we must still consider Xamarin.iOS.dll
as a platform assembly (and not user code) so the linker will remove more
code (that usual).

This is even more important as the stubs are unusable - so we do not want
to keep any extra pieces there since they would not work anyway.
2021-02-23 09:11:14 -05:00
Rolf Bjarne Kvinge 86bfa92466
[monotouch-test] Clean up keychain items after test completions. (#10680)
This fixes at least some variations of this failure:

    * Protocol_17579: Add
        Expected: Success
        But was: DuplicateItem

In this test we try to delete any existing keychain items, but it seems that
may fail if the keychain item in question was created by a different app, in
which case we wouldn't have permission to delete it (but adding a new one
would still fail with a duplicate item error). Cleaning up any added keychain
items by the same test (and process) that added them avoids the permissions
problem.

Also clean up in other tests as well, to avoid filling up our keychain with
test stuff.
2021-02-22 17:15:04 +01:00
Sebastien Pouliot a56960b023
[catalyst] Remove some framework that are not available on catalyst (#10658)
Those show up with only `!unknown-*` inside extrospection tests.

There's a few more frameworks to disable but they require some changes
inside `src/generate-type-forwarders/Program.cs` and are better done in
separate pull-requests.
2021-02-21 10:04:09 -05:00
Sebastien Pouliot 36ab765d54 Merge branch 'd16-9' into xcode12.5 2021-02-10 16:48:40 -05:00
VS MobileTools Engineering Service 2 982821c162
[d16-9] [monotouch-test] Rework big parts of KeyChainTest. Fixes #xamarin/maccore@2365. (#10603)
* [monotouch-test] Rework big parts of KeyChainTest. Fixes #xamarin/maccore@2365.

'GenericPassword' keychain items are unique by their Service+Account
properties [1]. This means that changing the Label property will not create a
different 'GenericPassword', which has a few consequences:

* It's possible to filter (and try to delete) using the Label property.
* It's possible to try to delete a 'GenericPassword' item, and have that
  deletion attempt fail with 'no item found', and then subsequently trying to
  add the same item will fail with a DuplicateItem, because the deletion
  was filtered using the Label property.

The change I've made is to:

* Make the Label property much more descriptive, and unique per process. This
  makes it easier to figure out where things come from in the Keychain Access
  app.
* Make the Service property unique per process. This way these tests are
  parallel safe and they won't stomp on eachother.
* Keep the Account property the same (a constant value), so that it's easy to
  filter to just these items in the Keychain Access app.
* Remove the Label property from all queries, it doesn't matter anyway. The
  Label property is still set when adding items to the keychain.

Finally try to clean up after ourselves as good as possible. This way we don't
fill the keychain with test stuff. This involves removing certificates and
passwords we add to the keychain at the end of tests.

Fixes https://github.com/xamarin/maccore/issues/2365.

[1]: https://stackoverflow.com/a/11672200/183422

* Adjust query for RecordTest.AuthenticationType as well to not include fields that don't determine uniqueness.

Also make the InternetPassword items we add to the keychain more descriptive and labelled helpfully.

* Add debug code.

* Revert "Add debug code."

This reverts commit a3edac8160.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-02-09 23:05:39 -05:00
Sebastien Pouliot 32bce7fc1f
[xcode12.5] Initial bump for beta 1 (#10573)
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
```
2021-02-05 20:30:24 -05:00
Rolf Bjarne Kvinge 21e2462e9c Adjust code according to code review. 2021-01-29 11:06:55 +01:00
Rolf Bjarne Kvinge d1735ae779 [monotouch-test] Adjust ExceptionsTest.ManagedExceptionPassthrough according to behavior on Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge cfc32f237e [monotouch-test] Ignore tests that require the GC to actually work in Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge ea56e75816 [monotouch-test] Ignore a few Font tests due to bugs in Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge 1a2d352087 [monotouch-test] Ignore a few tests that require a custom provisioning profile on Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge df4d85ab84 [monotouch-test] Adjust PassLibraryTest.Defaults for Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge 4ec519b7cb [monotouch-test] Fix AVCapturePhotoBracketSettingsTest.TestConstructor to take into account the max bracketed capture photo count. 2021-01-28 08:07:58 +01:00
Rolf Bjarne Kvinge 52e29c4130 [monotouch-test] Adjust version checks according to how they're done now for Mac Catalyst. 2021-01-28 08:07:58 +01:00
Rolf Bjarne Kvinge 72b50c4693 Merge remote-tracking branch 'origin/main' into HEAD 2021-01-28 08:07:48 +01:00
Rolf Bjarne Kvinge 179114b870
[monotouch-test] Rework big parts of KeyChainTest. Fixes #xamarin/maccore@2365. (#10492)
* [monotouch-test] Rework big parts of KeyChainTest. Fixes #xamarin/maccore@2365.

'GenericPassword' keychain items are unique by their Service+Account
properties [1]. This means that changing the Label property will not create a
different 'GenericPassword', which has a few consequences:

* It's possible to filter (and try to delete) using the Label property.
* It's possible to try to delete a 'GenericPassword' item, and have that
  deletion attempt fail with 'no item found', and then subsequently trying to
  add the same item will fail with a DuplicateItem, because the deletion
  was filtered using the Label property.

The change I've made is to:

* Make the Label property much more descriptive, and unique per process. This
  makes it easier to figure out where things come from in the Keychain Access
  app.
* Make the Service property unique per process. This way these tests are
  parallel safe and they won't stomp on eachother.
* Keep the Account property the same (a constant value), so that it's easy to
  filter to just these items in the Keychain Access app.
* Remove the Label property from all queries, it doesn't matter anyway. The
  Label property is still set when adding items to the keychain.

Finally try to clean up after ourselves as good as possible. This way we don't
fill the keychain with test stuff. This involves removing certificates and
passwords we add to the keychain at the end of tests.

Fixes https://github.com/xamarin/maccore/issues/2365.

[1]: https://stackoverflow.com/a/11672200/183422

* Adjust query for RecordTest.AuthenticationType as well to not include fields that don't determine uniqueness.

Also make the InternetPassword items we add to the keychain more descriptive and labelled helpfully.
2021-01-28 07:50:34 +01:00
Rolf Bjarne Kvinge 2a61296464
[tests] Ignore the MonoTouchFixtures.ObjCRuntime.RegistrarTest.RegistrarRemoval test, it's failing on .NET. Fixes #xamarin/maccore@2380. (#10513)
Fixes https://github.com/xamarin/maccore/issues/2380.
2021-01-27 17:44:52 +01:00
Rolf Bjarne Kvinge a06ae76c36
[monotouch-test] Be more descriptive and clean up stuff added to the keychain. (#10493)
* [monotouch-test] Use a more descriptive label for items added to the keychain in KeyTest.

* [monotouch-test] Use a more descriptive label for some items in CertificateTest.

Also make generated keys non-permanent so that they're not added to the keychain.

* [monotouch-test] Clean up a few items added to the keychain by CertificateTest.
2021-01-22 16:15:11 +01:00
Rolf Bjarne Kvinge aa1bf71cd6 [monotouch-test] Make it work with Mac Catalyst.
* Fix system version checks to work properly on Mac Catalyst (which uses the macOS
  version as its system version).

* Add the framework-specific defines to the build for monotouch-test.csproj (using
  the generated response files), this way we can use them in the tests.

* Sprinkle conditionals in numerous places - I tried using either framework-specific
  or XAMCORE_3_0 whenever that made since (instead of using Mac Catalyst as a condition).

* Updated a few tests to use non-deprecated API (because the deprecated API often
  doesn't exist in Mac Catalyst).

* Also a few minor API fixes to make any corresponding tests compile.
2021-01-15 17:52:28 +01:00
Rolf Bjarne Kvinge 29727d6a8d
[tests] Preserve a required method in System.Private.CoreLib to work around a bug in .NET 6. (#10426)
Ref: https://github.com/dotnet/runtime/issues/46908.
2021-01-15 16:39:44 +01:00
Rolf Bjarne Kvinge 24331f35dd
[monotouch-test] Adjust CaptiveNetworkTest.TryCopyCurrentNetworkInfo to work on iOS 10.3.3 (#10435)
According to Apple's documentation, an app linked with iOS 12 or later must
enable a specific entitlement, otherwise calls to CNCopyCurrentNetworkInfo
will always return NULL.
2021-01-15 16:14:27 +01:00
Rolf Bjarne Kvinge ef53600f7a
[monotouch-test] Change the url for the TestPACParsingScriptNoProxy test to be the Microsoft uri. (#10423)
All the other *NoProxy tests use the Microsoft uri, which seems to be the uri
that's not supposed to need a proxy (according to what I understand from the
code) - in other words, it looks like this was a c&p error.

Fixes this test failure when running on device:

    [FAIL] TestPACParsingAsyncNoProxy :   Expected: None
        But was:  HTTPS
	        at MonoTouchFixtures.CoreFoundation.ProxyTest.TestPACParsingAsyncNoProxy () [0x000fa] in /Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/monotouch-test/CoreFoundation/ProxyTest.cs:238
2021-01-15 08:25:19 +01:00
Rolf Bjarne Kvinge 48080d2d03
[monotouch-test] Add version checks for new HKCategoryTypeIdentifier fields. (#10424) 2021-01-15 08:24:29 +01:00
Rolf Bjarne Kvinge ca7d562493
[monotouch-test] Add a few Xcode version checks to ColorTest and AvoidOccluderConstraintTest. (#10425)
* [monotouch-test] Adjust ColorTest.CreateByMatchingToColorSpace to be Xcode 11+ only.

This test uses CGColor.CreateSrgb, which is Xcode 11+ only.

* [monotouch-test] Restrict AvoidOccluderConstraintTest to iOS 11+.
2021-01-15 08:24:12 +01:00
Rolf Bjarne Kvinge db79cd6b4c
[monotouch-test] Fix a few issues when running the .NET version of monotouch-test on device. (#10419)
* [monotouch-test] Fix conditional compilation constants when building for device.

* [tests/monotouch-test] Don't use entitlements when building monotouch-test for device.
2021-01-14 14:37:31 +01:00
Rolf Bjarne Kvinge 93bbfe7a86
[tests] Merge apitest into xammac_tests. (#10276)
* [apitest] Sanitize files by adding missing eols.

* [apitest] Add #if __MACOS__ to all test files.

In preparation for the move into monotouchtest.

* [apitest] Move test files into monotouchtest.

* [tests] Remove the apitest project.

* [monotouch-test] Remove MessagingMac.cs, it's not needed.

* [xammac-tests] Add file PlatformInfo.cs to the build.

* [xammac-tests] Move files into monotouch-test.

* [monotouch-test] Rename test class to not clash with another test class of the same (Objective-C) name.

* [tests] How did this ever work?

Answer: it never did.

* [monotouch-test] Remove duplicated test code.

* [xammac-tests] Define DYNAMIC_REGISTRAR when we're using the dynamic registrar.

* [monotouch-test] Adjust the BundleTest.TestGetBundleId test to cope with having multiple apps for the same bundle id.

* [monotouch-test] Ignore a test that doesn't work with the static registrar (due to a bug in the static registrar).
2020-12-18 11:45:06 +01:00
Alex Soto bd16f26f88 Merge remote-tracking branch 'xamarin/xcode12.3' into main 2020-12-15 23:50:18 -05:00
Sebastien Pouliot 50e91deda7
[spritekit] Add nullability to (generated and manual) bindings (#10262)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2020-12-14 08:32:17 -05:00
Sebastien Pouliot 959aef9856
[network] Update for Xcode 12.2 beta 2 (#10238) 2020-12-08 17:15:26 -05:00
Sebastien Pouliot bcc953bf50
[coregraphics] Expose CGColor.CreateByMatchingToColorSpace (#10223)
and add unit test

Fix https://github.com/xamarin/xamarin-macios/issues/10212
2020-12-07 16:40:29 -05:00
Sebastien Pouliot 1d6cf0c46e
[scenekit] Add nullability to (generated and manual) bindings (#10195)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2020-12-03 09:14:54 -05:00
Sebastien Pouliot edf1847405
[tests] Re-enable MediaAccessibility/ImageCaptioningTest.cs` `SetCaption` test (#10172)
This works fine with Xcode 12.3 beta 1 on 10.15.7 (Intel) and 11.0

ref: https://github.com/xamarin/xamarin-macios/issues/10165
2020-11-30 08:16:36 -05:00
Sebastien Pouliot 0723e3cd20
[corevideo] Update for Xcode 12.2 RC (#10155) 2020-11-25 09:30:44 -05:00
Sebastien Pouliot 267495d0c9
[tests][monotouch] Fix recent CGColorSpace tests not to fail on macOS 10.15.x (#10142)
```
CreateExtendedTest: System.EntryPointNotFoundException : CGColorSpaceCreateExtended assembly:<unknown assembly> type:<unknown type> member:(null)
```

The API was added in iOS 14.0 (Xcode 12.0) but macOS 11.0 (Xcode 12.2)
and it does not exists on my Mac (10.15.7) even if I don't recall seeing
fail on the bots.
2020-11-24 16:30:14 -05:00
Rolf Bjarne Kvinge f4c9327fac
[dotnet] Bump to .NET 6.0.100-alpha.1.20556.2 and net6.0 (#10079)
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.
2020-11-19 15:01:55 +01:00
Manuel de la Pena a810f6954a [Security] Fix some tests after the bump to NUnitlite. 2020-11-17 11:14:04 -05:00
Manuel de la Pena 0f7bc75e50 Merge branch 'xcode12.2' into main-xcode12.2 2020-11-17 11:09:15 -05:00
Manuel de la Pena e5ea789738 [Tests][Network] Do not really check the value, just make sure that we are called. (#9901) 2020-11-12 19:38:26 -05:00
Alex Soto 1b243acbf9 Merge remote-tracking branch 'xamarin/xcode12.2' into d16-8-xcode12.2-merge 2020-11-12 18:52:53 -05:00
Rolf Bjarne Kvinge c640775699 [dotnet] Bump to .NET 6.0.100-alpha.1.20556.2. and net6.0
New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@f8768d9 Advance into the world of net6.0

Diff: 9abe69e6f5..f8768d99ef
2020-11-10 11:41:06 +01:00
Sebastien Pouliot a18679b036
[metrickit] Add missing `MXMetricManager.MakeLogHandle` API (#10017)
and add unit test since it's _partially_ a manual binding as it
returns an non-ObjC type.

Fixes https://github.com/xamarin/xamarin-macios/issues/10004
2020-10-30 18:28:58 -04:00
Sebastien Pouliot c3d66bcdca
[tests][monotouch-tests] ModelIO tests can't be executed on old Mac (#9988)
even if broken/ignored on 12.2 beta 3 the original condition, to check
for Xcode 9, remains required.
2020-10-28 13:54:42 -04:00
Manuel de la Pena e64aeb4ada
[Xharness] Bring xharness changes to d16-8 (#9951)
* [xharness] Add support for skipping more test variations.

* [xharness] Add the dotnet introspection project file to our list of projects, and mark it as a .NET project.

* [xharness] Clearly label .NET projects as such.

* [xharness] Disable project generation for .NET projects for now.

* [xharness] Create DotNetBuildTasks when we need to build .NET projects.

* [xharness] Improve project cloning to take into account default inclusion behavior for .NET projects.

.NET projects will include files from the current directory by default, which
means that if we clone the project file and write the cloned project file in a
different directory, we'll have to add an automatically included files into
the cloned file manually.

* [xharness] Add a GetDotNetExecutable callback and an MSBuildPath property to [I]ProcessManager.

* [xharness] Retrieve a .NET project's OutputPath by running MSBuild.

.NET projects are vastly simplified, which means that the OutputPath can't be
determined by reading the project file itself, it has to be calculated by
MSBuild.

So that's exactly what we do: we run MSBuild on the project file and get it to
print the property we're interested in.

* [xharness] Skip the old simulator variation for introspection/dotnet for now.

* [xharness] Try to not have log directories with spaces in them. (#8976)

The simulators won't write stdout/stderr to a path with a space.

* [xharness] Don't generate makefile targets for .NET projects.

They end up with the same make targets as non-.NET targets, which prints
warnings in the terminal when running make.

We're not using the makefile targets much anymore, so postpone implementing
them for .NET until we need them for some reason.

* [xharness] Add support for generating a tvOS version of .NET iOS projects. (#9032)

* [xharness] Add support for generating a tvOS version of .NET iOS projects.

And use it to run the tvOS version of introspection for .NET.

* [xharness] Change according to reviews.

* [xharness] Use Cecil to inspect assemblies, instead of Reflection. (#9082)

This is slightly faster - ~0.95s vs ~1.4s - (probably because reflection tries
to load a lot of other referenced assemblies, which may or may not exist,
causing exceptions (if they don't exist) or spend time loading them (which
Cecil won't)).

It also avoids a lot of exception details showing up when tracing xharness
execution.

* [xharness] Don't group simulators when running in server mode. (#9098)

Grouping simulators means we have to wait until we know which simulators are
available, because we group by the simulator's UDID.

When running in server mode, we don't need to group simulator test runs,
because we run the as the user chooses, not in any particular order.

This way the test list loads faster at startup, since we don't have to wait
until we've loaded the simulators before we can show the list.

* [xharness] Fix finding testable types in test assemblies. Fixes #xamarin/maccore@2267. (#9103)

Apparently a null namespace when using Reflection can be an empty namespace in Cecil.

Fixes https://github.com/xamarin/maccore/issues/2267.

* [xharness] Parse NUnit v2 xml reports correctly. (#9110)

* [xharness] De-asyncify template expansion. (#9104)

This avoids:

* Getting the resource stream for every template expansion
* Reading the resource stream
* A lot of async code.

Instead just read the resource stream once, into a string, and return that.

This speeds up the startup by ~10% (from ~0.96s to ~0.83s on my machine).

* [xharness] Improve code to not throw exceptions in the first place instead of catching and ignoring. (#9118)

* [xharness] Try harder to make lldb quit after trying to get a backtrace. (#9119)

When a process times out, we try to print a stack trace for all threads. This
involves executing "lldb --source <script>", where the script contains:

	process attach --pid 1234
	thread list
	thread backtrace all
	detach
	quit

Basically we attach to the project, and ask lldb to print stack traces.

The problem:

    16:09:02.9522580 Printing backtrace for pid=25276
    16:09:02.9528060 /usr/bin/lldb --source /var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp
    16:09:04.6127570 (lldb) command source -s 0 '/var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp'
    16:09:04.6130020 Executing commands in '/var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp'.
    16:09:04.6130200 (lldb) process attach --pid 25276
    16:09:05.6458750 error: attach failed: Error 1
    16:09:05.7529100 25276 Execution timed out after 1200 seconds and the process was killed.
    16:09:05.7588770 Execution timed out after 1200 seconds.

If any of those commands fail, the subsequent commands aren't executed. This
includes the final "quit" command, which means we end up waiting forever for
lldb to do its thing, when lldb doesn't think it needs to do anything at all.

The fix: pass two different scripts. It turns out subsequent scripts are
executed even if previous scripts fail, so we do the equivalent of:

     lldb --source <attach script> --source <quit script>

And now lldb will quit no matter what the attach script does (it still works
even if the attach script succeeds, in which case we'll ask lldb to quit
twice).

* [xharness] Improve process killing a bit. (#9120)

* Log what we're doing.
* Wait a bit after sending SIGABRT, to allow for the OS to create any crash
  reports.

* [xharness] Don't try to write cleaned xml into the same file as the dirty xml was. (#9122)

* [xharness] Don't replace existing files, instead add new files, when providing human-readable logs. (#9123)

This makes understanding what's going on much easier.

* [xharness] Fix BCL project generation for watchOS projects. (#9131)

Reading from a file named as the actual content of the watchOS template doesn't
_quite_ work. Instead just use the content directly.

* [xharness] Only try to parse the build log if we have a build log. (#9130)

* [xharness] Don't generate into the same directory/files for macOS Modern and macOS Full. (#9121)

* [xharness] Don't generate into the same directory/files for macOS Modern and macOS Full.

This meant that we were overwriting some generated files, which meant that we
were executing the Modern set of tests instead of the Full set of tests for at
least some configurations.

* Add a few ignored tests to the System.Configuration test now that we actually run it.

* [xharness] Disable default inclusion behavior for the introspection .NET tests. (#9137)

It gets too annoying to keep track of which files are where with the project
cloning we're doing, if files are implicitly included.

* [xharness] Generate BCL projects asynchronously. (#9083)

Split the BCL project generation in two: one part that figures out which
projects to generate, and which is done synchronously (because we need it to
compute the list of tests), then split out the actual generation and run it on
a background thread (since that doesn't have to happen until we want to
execute those tests).

This speeds up launching xharness in server mode significantly (from ~2s to
~0.2s).

* [xharness] Document the test loading process a little bit.

* [xharness] Generate projects into a subdirectory for each project.

Because it's cumbersome to keep the build working when the same directory has
multiple project files.

* [xharness] Remove a lot of special-casing for the mono-native tests.

It's not needed anymore.

* [xharness] Store attribute in local variable instead of fetching it twice.

* [xharness] Make ProjectFileExtensions.GetInfoPListInclude a bit clearer.

Add a comment to document what's supposed to happen, and simplify the code a little bit.

* [xharness] Add support for specifying whether variations should be generated for Xamarin.iOS projects.

* [xharness] Don't generate variations for BCL projects using the normal procedure, we generate them differently already.

This makes it possible to remove some dead code.

* [xharness] Add a TestPlatform value to TestProject, and use it to indicate that a TestProject might be of a specific platform already.

* [xharness] Make the templates path an input parameter for the BCL templates.

* [xharness] Make the BCL project generation generate each project file into its own subdirectory.

* [tests] Put the iOS and macOS mono-native templates in their own directory.

This makes it possible to remove a few conditions in the code.

* [xharness] Simplify the MonoNativeInfo class a bit by removing the custom Mac-specific subclass (there's almost no difference anymore).

* [tests] Move bindings-test[-mac].csproj to their own directory.

* [xharness] Fix compiler warning. (#9147)

* [xharness] Fix logic to not create makefile targets to run BCL tests. (#9148)

According to the existing code, we're already not supposed to create makefile
targets for BCL tests. However, the code to detect BCL tests wasn't quite
reliable, so we ended up creating makefile targets for some BCL tests.

So always use the same logic to detect BCL tests.

Also remove a lot of dead code to generate makefile code for BCL tests.

* [tests] Set the correct mono-native link mode and flavor defines in the csproj itself.

This makes it possible to simplify a lot of C# code.

* [xharness] Remove a redundant ToArray.

* [xharness] Allow for null environment variables to mlaunch. (#9140)

It's a valid scenario to set a null environment variable.

This happens when changing InCI to always return true (to test locally what's
done on the bots), in which case we try to forward BUILD_REVISION to mlaunch,
but BUILD_REVISION isn't necessarily set. Not forwarding it to mlaunch should
not cause problems in most tests, so just allow this scenario.

* [xharness] Generate makefile targets for non-executable projects. (#9158)

It turns out some Xamarin.Mac projects are library projects (for unit tests),
and we still need to generate makefile targets for those (because we use them
to build Xamarin.Mac tests to run on older macOS bots).

* [xharness] Backport Touch.Unit fix for command line parsing. (#9165)

Apply https://github.com/spouliot/Touch.Unit/pull/78 to the duplicated file.

* [tests] Info.plists should be inside LogicalName, not Link.

This makes it possible to simplify a bit more code inside xharness as well.

* Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project

* [xharness] Fix finding Info.plist, and add some tests too.

* [xharness] Fix how .NET projects are ignored. (#9168)

* [xharness] Fix how .NET projects are ignored.

Now they're actually ignored if .NET tests are not included.

* Fix compile error.

* Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project

* [xharness] If we're not generating projects in the Target class, the project path equals the template path.

* [xharness] Make restoring nugets the default for all test projects. (#9237)

But don't do it for .NET projects, since 'dotnet build' automatically restores.

* [xharness] Improve restoring NuGets for Xamarin.Mac projects in the makefile by depending on the csproj files in addition to the packages.conf files. (#9242)

Packages are listed in the csproj when we're using package references.

Also only list files in git, otherwise we pick up all the generated project files as well.

* [tests] Migrate the sample tests to use package references. (#9244)

* [tests] Switch msbuild-mac to use package references. (#9245)

And don't specify the solution path anymore, because we can restore using just
the csproj just fine now.

* [xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it. (#9251)

* [xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it.

* [xharness] Mark the .NET generator project as a .NET project as well.

* [xharness] Resolve relative project references using the referencing project's directory. (#9252)

Otherwise it would end up being resolved from the current directory, which is
not dependable.

* [xharness] Don't try to parse a build log that doesn't exist. (#9253)

* [xharness] Add support for generating/duplicating projects with a Touch.Client reference.

This also means removing support for generating/duplicating MonoTouch.NUnit references,
since we're not using those anymore.

* [tests] Remove dead code related to GuiUnit and the GuiUnit submodule.

* [xharness] Change how we run macOS unit tests to work with Touch.Client.

This is very similar to how we run iOS unit tests.

* [xharness] Add the Touch.Client projects to our solutions instead of MonoTouch.NUnitLite.

* [tests] The upstream NUnitLine isn't linker safe, so add an xml file to make sure linking doesn't remove too much.

In particular NUnit uses reflection to get a private method, and the linker removes
the corresponding private method:

1c680b4dc8/src/NUnitFramework/framework/Internal/TestExecutionContext.cs (L552)

So add an xml definition to keep this private method, and modify project files to
pass the xml definition to mtouch and mmp.

Some care needs to be taken to make sure xharness is still able to clone these project
files.

* [xharness] Add support for finding/setting the main Xamarin import among multiple imports.

This is required for the previous commit, where we added an additional import to
a few project files to pass an xml definition to mtouch/mmp.

* [xharness] Use LogFile instead of ResultFile in macOS BCL tests to match the Touch.Client usage.

* [tests] Restore projects before building them from the command line.

* [xharness] Implement Log.GetReader for all loggers. (#9257)

This makes it easier to write code that parses logs, since that code won't
have to worry about if a particular log supports GetReader or not.

* [xharness] Fix main log parsing by not requiring it to come from a file. (#9258)

Not all types of logs have files, but all types of logs have a reader (or will
have soon due to PR #9257).

* [xharness] Improve parsing of NUnitV2 xml reports to fix an issue with failures in parameterized tests. (#9259)

We weren't properly reporting all failures when there were multiple failures
in parameterized tests, because we'd incorrectly skip too many xml nodes when
we were looking for the next test failure.

* Merge remote-tracking branch 'origin/main' into HEAD

* Remove wrongly added dir. (#9301)

Someone (Manuel) uses an IDE that uses .idea to store user settings and
that got added by accident.

* [Harness] Fix some typos. (#9303)

* [xharness] Make it possible to include .NET tests by setting a label. (#9298)

This also means that setting 'run-all-tests' enables the .NET tests, which
means they'll now start running on internal Jenkins (as was the intention from
the beginning).

* [xharness] Look at the exact NUnit version an NUnit project is referencing to figure out how to run it in a makefile. (#9322)

* [xharness] Add support for adding PropertyGroups for unknown platform/configuration values in a csproj. Fixes xamarin/maccore@2277. (#9347)

Fixes https://github.com/xamarin/maccore/issues/2277.

* [xharness] Add support for getting the default AssemblyName for projects. (#9369)

In .NET projects there's a default value for most properties, which means that
there won't necessarily be an AssemblyName property in a csproj. We need to know the
AssemblyName, so calculate it from the csproj filename (which is how .NET does it).

This turned out slighly complicated, because we're pass an XmlDocument around,
and the XmlDocument doesn't know the file from where it was loaded, so we need
to keep that information separately.

* [xharness] Add the .NET version of interdependent-binding-projects to our lineup

* [xharness] Enhance ResolveAllPaths to understand $(RootTestsDirectory).

This requires passing the root directory around in multiple places, since ResolveAllPaths
doesn't have access to the static class where we define the root directory.

Also call ResolveAllPaths in a few more places to ensure paths everywhere are resolved.

* [xharness] Do not mark DeviceLoaders as loaded when loading fails (#9367)

* [xharness] Make sure MSBUILD_EXE_PATH is not set when executing dotnet.

Something ends up confused, and dotnet hangs.

* [xharness] Bump timeout for the .NET tests.

More tests take longer to run!

* [xharness] Don't clone the same project multiple times when reached through different project references.

Problem:

1. interdependent-binding-project references binding-test and bindings-test2.
2. bindings-test2 references bindings-test.

This means bindings-test is reached through 2 projects: both
interdependent-binding-projects and bindings-test2, and previously we'd
process each of these references separately, effectively making two separate
clones of the bindings-test project.

Instead keep track of all referenced projects from the leaf project, and if we
encounter a project we've already cloned, use that directly.

* [dotnet] Add support for consuming binding projects. (#9376)

* Port the interdependent-binding-projects test to .NET (it's the simplest
  test project we have with binding projects).
* Add a lot of the shared source code for mtouch/mmp to dotnet-linker, and
  make it compile. Most issues were fixed by adding a few stubbed out classes,
  since there are large chunks of the mtouch/mmp code we're not using yet, so
  stubbing out while things are being implemented works fine.
* Add a step in dotnet-linker for loading the linker output (the linked
  assemblies) into our bundler code.
* Add another step in dotnet-linker to extract native resources from binding
  libraries.
* Augment the build process to take into account the native resources we found
  in any binding libraries.

* [xharness] Make it possible to make a project ignored by default from its initial definition.

Make it possible to make a project ignored by default from its initial definition,
and which takes precedence over any other selection criteria.

This way it's possible to make the .NET version of monotouch-test show up in the
web view, which makes it runnable locally (for testing), while at the same time it
will never be run on CI.

* [xharness] Add monotouch-test to the .NET lineup.

* [xharness] Improve resolving paths in project files.

* Properties may contain a list of files, separated by semi-colon, so if we find
  any semi-colons, treat each entry as a separate path.

* Treat anything that starts with a variable as a full path, because either the
  variable is a full path, or it will be updated according to the new project location
  and resolve correctly.

* [xharness] Process '$(RootTestsDirectory)' before bailing due to any other variables when resolving paths in project files. (#9467)

While keeping '$(RootTestsDirectory)' as-is works fine when building the
project using MSBuild, xharness itself may end up encountering it (in
particular when listing referenced projects), and at that point will end up
confused. So just always resolve '$(RootTestsDirectory)' to the actual
directory to keep other parts of xharness happy.

Fixes this problem (as seen in PR #9460):

    Harness exception for 'interdependent-binding-projects': System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/external/Touch.Unit/Touch.Client/dotnet/iOS/Touch.Client-iOS.dotnet.csproj".
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0015e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:223
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:149
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:86
        at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess)
        at Microsoft.DotNet.XHarness.iOS.Shared.Utilities.PListExtensions.LoadWithoutNetworkAccess (System.Xml.XmlDocument doc, System.String filename) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Utilities/PlistExtensions.cs:17
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x0010c] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:98
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x00811] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:168
        at Microsoft.DotNet.XHarness.iOS.Shared.Tasks.TestTasks.RunInternalAsync () [0x00117] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Tasks/TestTask.cs:274

* [tests] Port dont link to .NET (#9488)

There are a few test failures, so it's ignored by default in xharness for now.

* [xharness] don't link is now green on .NET!

* [tests] Port link sdk to .NET

* [xharness] link sdk is now green on .NET!

At least the Debug configuration is, there's still a test failure in the Release
configuration, so skip that for now.

* [tests] Port link all to .NET (#9515)

* [tests] Port link all to .NET

* [tests] Exclude link all tests in .NET that reference OpenTK-1.0.dll

OpenTK-1.0.dll isn't supported yet.

* [tests] Exclude link all tests using API that isn't available anymore in .NET.

* [xharness] Use the local 'ignore' variable instead of fetching 'test.TestProject.Ignore' for every test when generating test variations. (#9518)

* [xharness] Enable monotouch-test/.NET by default, but ignore all variations. (#9526)

* [xharness] Enable monotouch-test/.NET by default, but ignore all variations.

The default (Debug) configuration is green now, but the rest of the variations aren't yet.

* [tests] Ignore LocaleTest.InitRegionInfo in .NET because it needs globalization data.

Ref: https://github.com/xamarin/xamarin-macios/issues/8906

I can't reproduce locally, because it's ignored for me:

    [INCONCLUSIVE] InitRegionInfo : You can construct locale without countries
        at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in [...]/xamarin-macios/tests/monotouch-test/Foundation/LocaleTest.cs:line 47

but this should fix this monotouch-test test failure (I'm guessing that 'IV'
stands for 'Invariant', which is all the current .NET version ships with):

    MonoTouchFixtures.Foundation.LocaleTest
        [FAIL] InitRegionInfo :   Name
            String lengths are both 2. Strings differ at index 0.
            Expected: "US"
            But was:  "IV"
            -----------^
                 :    at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/Foundation/LocaleTest.cs:line 49

* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified. (#9510)

* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified.

This also required adding support for using regex as file names when selecting
which tests to run.

* Remove redundant dotnet prefix.

* [xharness] Rename variables to match usage.

* [dotnet] Use net5.0-[ios|tvos|watchos|macos] TargetFrameworks. (#9532)

* [dotnet] Set TargetPlatformSupported when the right TargetPlatformIdentifier is used.

* [dotnet] Generate a list of valid OS versions for each platform, and add it to the SupportedTargetPlatform item group.

The generated files: https://gist.github.com/rolfbjarne/765c4e4b38b1b017380c9378d9666317

* [dotnet] Define and set the default platform version if it's not set in the TargetFramework variable.

* [dotnet] Switch to using the new-style TargetFramework values.

This includes bumping spouliot/Touch.Unit to get new-style TargetFramework values for Touch.Client.

* spouliot/Touch.Unit@89afaf7 [Touch.Client] Use the right TargetFrameworks for watchOS and macOS as well. (#92)
* spouliot/Touch.Unit@fd0e576 [Touch.Client] Use the right TargetFrameworks. (#91)
* spouliot/Touch.Unit@40f47db [Touch.Client] Add a macOS and watchOS version for .NET. (#90)
* spouliot/Touch.Unit@1d4b8c0 Add .gitignore for NuGet.config and global.json. (#89)
* spouliot/Touch.Unit@49441f3 Call `mlaunch` instead of `mtouch` (#88)
* spouliot/Touch.Unit@b157cf4 Fix a few markdown issues found by markdownlint. (#87)

Diff: d7f55a6167..89afaf7e05

* [dotnet] Document the script that generates the lists of the target platform versions a little bit better.

* [dotnet] Make the [Platform]SupportedTargetPlatform variables public.

This matches how Android and Windows do it:

* https://github.com/xamarin/xamarin-android/pull/5007
* 18ee4eac8b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSupportedTargetPlatforms.props

* [xharness] Update the TargetFramework value when creating project variations.

* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration. (#9599)

* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.

Also call Application.InitializeCommon to initialize the application instance. The
important part here is that InitializeCommon calls Optimizations.Initialize to compute
the default optimizations. It also calls Set*ExceptionMode and sets the default EnableCoopGC
value (so we don't need to call/set those anymore), and it does a few other initialization
tasks which we don't need yet, but eventually will.

And finally remember to parse the bundler arguments before using them in the dotnet
build logic. How did this not cause problems before? 🤦

* [tests] Set the verbosity using the additional args instead of an internal variable.

The internal _BundlerVerbosity variable is overwritten now (with the verbosity
value from the additional args).

* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.

* [dotnet-linker] Add OptimizeGeneratedCodeSubStep into the pipeline. (#9608)

Fixes these linkall tests:

    Linker.Shared.OptimizeGeneratedCodeTest
        [FAIL] IsARM64CallingConvention :   optimized: no ldsfld instruction
        Expected: 0
        But was:  1
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.IsARM64CallingConvention() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 527

    [FAIL] SetupBlockPerfTest :   At least 6x speedup
        Expected: greater than 6
        But was:  1.0876440665344851d
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.SetupBlockPerfTest() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 120

And linkall is now green for .NET/Debug.

* [xharness] Add support for adding PropertyGroups if none are applicable when adding a property. (#9616)

Some .NET test projects (monotouch-test) require this to set properties for
some test variations, and .NET projects are quite minimal, making it likely
that they won't have a particular property that needs to be set/modified.

This makes it possible to execute the various monotouch-test variations for
.NET in xharness (some of the variations still fail though, so they're still
ignored by default).

* [tests] Ignore a few link sdk tests in .NET for now. (#9614)

There are easier fish to fry right now, so implementing the linker support for
these tests to pass (metadata reduction and code removal) can wait.

This makes the link sdk/Release variation green for .NET.

Ref: https://github.com/xamarin/xamarin-macios/issues/9612
Ref: https://github.com/xamarin/xamarin-macios/issues/9613

* [xharness] The linkall tests are green for .NET/Release now. (#9629)

* [xharness] Skip the 'dont link / AssemblyBuildTarget: SDK framework (release)' variation by default for tvOS. Fixes #xamarin/maccore@2282. (#9659)

This test variation ends up being too big (1.5 GB), so it doesn't install
properly and the app crashes at startup.

So just skip it.

Fixes https://github.com/xamarin/maccore/issues/2282.

* [src] Build the .NET version of our product assemblies using a .NET 5 BCL. (#9637)

* [src] Build the .NET version of our product assemblies using a .NET 5 BCL.

We're not shipping the .NET product assemblies in any stable release, so we
can use a preview version of the .NET 5 BCL.

Also:

* Add all the nuget feeds we need to the top-level NuGet.config, even for .NET
  5/6, there shouldn't be any conflicts with stable feeds since we use exact
  version numbers.

* Generate a top-level global5.json which is copied to every directory that
  needs a .NET 5 global.json (overriding the .NET 3.1 global.json in the root
  directory).

* Use the expected dotnet binary during our local build.

* [tests] Fix the bgen tests to use .NET 5.

* [xharness] Set the current directory to the project directory when running .NET tests.

This way we end up using the dotnet version that's configured in global.json for the tests.

* [xharness] Fix typo in test case creating two identical test cases. (#9702)

* [xharness] Use XmlReaderSettings to ignore stuff we don't care about when parsing xml. (#9703)

At the very least this makes stepping through code while debugging much
faster, since stepping through whitespace and comments is useless.

* [xharness] Fix rendering human-readable results for parameterized tests. Fixes #9400. (#9704)

We weren't probably parsing nested test-suite elements in the xml, so
implement parsing of test-suite elements using recursion, which is easier and
less error-prone (and turns out to work fine too).

Also use TextReader/Writer instead of StreamReader/Writer in a few places.
This makes it easier to write tests, since TextReader/Writer can use in-memory
streams (no need to mess with temporary files).

Fixes https://github.com/xamarin/xamarin-macios/issues/9400.

* [dotnet-linker] Add a CollectUnmarkedMembersStep that will keep linked away types around for the static registrar. (#9722)

The static registrar may need access to types that have been linked away, so
store unmarked types so that the static registrar can access them later.

This also makes all the monotouch-test variations green, so enable them all.

Fixes this monotouch-test when all optimizations are enabled:

    MonoTouchFixtures.ObjCRuntime.RegistrarTest
        [FAIL] TestProtocolRegistration :   UIApplicationDelegate/17669
            Expected: True
            But was:  False
                at MonoTouchFixtures.ObjCRuntime.RegistrarTest.TestProtocolRegistration() in xamarin-macios/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs:line 1350

* [xharness] Only run xammac variations if macOS tests are included. (#9729)

This fixes a build error with a xammac test variation that is executed even if
the macOS build is disabled.

* [xharness] The dotnet version of introspection/iOS 10.3 works fine now. (#9728)

* [xharness] Disable iOS 32-bit simulator tests, they don't work on Xcode 12+. (Re)fixes #xamarin/maccore@2284. (#9732)

Fixes https://github.com/xamarin/maccore/issues/2284.

* Undo does changes that ship and we do not want to bring with us.

* Fix issues that do not allow compilation.

* Fix mtouch tests.

* Ignore generated files.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-10-26 16:05:40 -04:00
Alex Soto 9d1988a3c8
[tests][xcode12.2] Fix xammac tests (#9935)
* [tests][xcode12.2] Fix xammac tests

* Update tests/common/TestRuntime.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* [xammac] Avoid multiple #if statements

* [xammac] Fix missing cases amd reduce amount of changes

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-10-21 17:12:48 -04:00
Manuel de la Pena 00e25199ae [Main] Bring Xcode12.1 support. 2020-10-20 17:55:31 -04:00
Manuel de la Pena 18963f0983 [Xcode12.1] Bring Xcode12.1 support. 2020-10-20 17:27:14 -04:00
Whitney Schmidt de032018aa
add check for xcode12 (#9922) 2020-10-20 14:55:58 -04:00
monojenkins e0ce496804
[xcode12.1] [Tests][Network] Do not really check the value, just make sure that we are called. (#9921) 2020-10-20 09:37:08 -04:00
monojenkins f6f0c76eeb
[Tests][ARKit] Add check for xcode12 (#9923)
Co-authored-by: Whitney Schmidt <whschm@microsoft.com>
2020-10-20 09:36:29 -04:00
monojenkins 5d3db5fde2
[Tests][ARKit] Add check for xcode12 (#9924)
Co-authored-by: Whitney Schmidt <whschm@microsoft.com>
2020-10-20 09:35:53 -04:00