From 2b271cb99751ad3c2aedaed2318b6e1d107da5a1 Mon Sep 17 00:00:00 2001 From: Philippe Creytens Date: Fri, 18 Jan 2019 15:09:42 +0100 Subject: [PATCH 01/23] [coremedia] Add BaseFontSizePercentageRelativeToVideoHeight to CMTextMarkupAttributes. Fixes #5429 reference: https://github.com/xamarin/xamarin-macios/issues/5429 --- src/CoreMedia/CMTextMarkupAttributes.cs | 12 ++++++++++++ src/coremedia.cs | 6 +++++- tests/xtro-sharpie/common-CoreMedia.ignore | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/CoreMedia/CMTextMarkupAttributes.cs b/src/CoreMedia/CMTextMarkupAttributes.cs index f91db19643..dc47e9233e 100644 --- a/src/CoreMedia/CMTextMarkupAttributes.cs +++ b/src/CoreMedia/CMTextMarkupAttributes.cs @@ -168,6 +168,18 @@ namespace CoreMedia { SetNumberValue (CMTextMarkupAttributesKeys.RelativeFontSize, value); } } + + public float? BaseFontSizePercentageRelativeToVideoHeight { + get { + return GetFloatValue (CMTextMarkupAttributesKeys.BaseFontSizePercentageRelativeToVideoHeight); + } + set { + if (value < 0) + throw new ArgumentOutOfRangeException("value"); + + SetNumberValue (CMTextMarkupAttributesKeys.BaseFontSizePercentageRelativeToVideoHeight, value); + } + } #endif } } diff --git a/src/coremedia.cs b/src/coremedia.cs index 19fc41bd5d..06a28cee96 100644 --- a/src/coremedia.cs +++ b/src/coremedia.cs @@ -40,7 +40,11 @@ namespace CoreMedia { [Internal][Field ("kCMTextMarkupAttribute_RelativeFontSize")] NSString RelativeFontSize { get; } - } + + [Internal] + [Field("kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight")] + NSString BaseFontSizePercentageRelativeToVideoHeight { get; } + } [Static][Internal] interface CMSampleAttachmentKey { diff --git a/tests/xtro-sharpie/common-CoreMedia.ignore b/tests/xtro-sharpie/common-CoreMedia.ignore index 5a60391093..1fe605de15 100644 --- a/tests/xtro-sharpie/common-CoreMedia.ignore +++ b/tests/xtro-sharpie/common-CoreMedia.ignore @@ -174,7 +174,6 @@ !missing-field! kCMTextMarkupAlignmentType_Right not bound !missing-field! kCMTextMarkupAlignmentType_Start not bound !missing-field! kCMTextMarkupAttribute_Alignment not bound -!missing-field! kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight not bound !missing-field! kCMTextMarkupAttribute_CharacterBackgroundColorARGB not bound !missing-field! kCMTextMarkupAttribute_CharacterEdgeStyle not bound !missing-field! kCMTextMarkupAttribute_GenericFontFamilyName not bound From ab12d724195c7bf18d6e5de1a927e007619158db Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 21 Jan 2019 07:49:28 +0100 Subject: [PATCH 02/23] [tests] Adjust DispatchBlock tests according to minimum OS. (#5435) * [tests] Adjust DispatchBlock tests according to minimum OS. * [tests] Fix monotouch-test build. --- .../CoreFoundation/DispatchBlockTests.cs | 17 +++++++++++++++++ .../CoreFoundation/DispatchGroupTest.cs | 5 +++++ .../CoreFoundation/DispatchQueueTest.cs | 12 ++++++++++++ 3 files changed, 34 insertions(+) diff --git a/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs b/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs index 6edeba9622..0a08906dea 100644 --- a/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs +++ b/tests/monotouch-test/CoreFoundation/DispatchBlockTests.cs @@ -14,9 +14,11 @@ using System.Threading; #if XAMCORE_2_0 using Foundation; using CoreFoundation; +using ObjCRuntime; #else using MonoTouch.CoreFoundation; using MonoTouch.Foundation; +using MonoTouch.ObjCRuntime; #endif using NUnit.Framework; @@ -27,6 +29,13 @@ namespace MonoTouchFixtures.CoreFoundation [Preserve (AllMembers = true)] public class DispatchBlockTest { + [SetUp] + public void SetUp () + { + TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false); + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false); + } + [Test] public void Invoke () { @@ -90,6 +99,8 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void Wait_DispatchTime () { + TestRuntime.AssertXcodeVersion (8, 0); + var called = false; var callback = new Action (() => called = true); using (var db = new DispatchBlock (callback)) { @@ -109,6 +120,8 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void Wait_TimeSpan () { + TestRuntime.AssertXcodeVersion (8, 0); + var called = false; var callback = new Action (() => called = true); using (var db = new DispatchBlock (callback)) { @@ -142,6 +155,8 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void Constructors () { + TestRuntime.AssertXcodeVersion (8, 0); + var called = false; var callback = new Action (() => called = true); DispatchBlockFlags flags; @@ -220,6 +235,8 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void Create () { + TestRuntime.AssertXcodeVersion (8, 0); + var called = false; var callback = new Action (() => called = true); DispatchBlockFlags flags; diff --git a/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs b/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs index d4838a1424..8efd62ad3a 100644 --- a/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs +++ b/tests/monotouch-test/CoreFoundation/DispatchGroupTest.cs @@ -14,9 +14,11 @@ using System.Threading; #if XAMCORE_2_0 using Foundation; using CoreFoundation; +using ObjCRuntime; #else using MonoTouch.CoreFoundation; using MonoTouch.Foundation; +using MonoTouch.ObjCRuntime; #endif using NUnit.Framework; @@ -55,6 +57,9 @@ namespace MonoTouchFixtures.CoreFoundation { [Test] public void NotifyWithDispatchBlock () { + TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false); + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false); + using (var dg = new DispatchGroup ()) { var called = false; var callback = new Action (() => called = true); diff --git a/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs b/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs index f7341b50f6..fc857063ac 100644 --- a/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs +++ b/tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs @@ -105,6 +105,9 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void DispatchSync () { + TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false); + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false); + using (var queue = new DispatchQueue ("DispatchSync")) { var called = false; var callback = new Action (() => called = true); @@ -121,6 +124,9 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void DispatchBarrierSync () { + TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false); + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false); + using (var queue = new DispatchQueue ("DispatchBarrierSync")) { var called = false; var callback = new Action (() => called = true); @@ -137,6 +143,9 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void DispatchAsync () { + TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false); + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false); + using (var queue = new DispatchQueue ("DispatchAsync")) { var called = false; var callback = new Action (() => called = true); @@ -156,6 +165,9 @@ namespace MonoTouchFixtures.CoreFoundation [Test] public void DispatchBarrierAsync () { + TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false); + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false); + using (var queue = new DispatchQueue ("DispatchBarrierAsync")) { var called = false; var callback = new Action (() => called = true); From d9dcc9ae21a586cd4dcf359dfb32aca515579b97 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 22 Jan 2019 14:59:36 +0100 Subject: [PATCH 03/23] [XHarness] Add support for filtering categories in NUnit. (#5446) --- .../bcl-test/BCLTests/BCLTests-mac.csproj.in | 2 +- .../BCLTests-watchos-extension.csproj.in | 2 +- .../BCLTests/common-SystemTests.ignore | 330 ------------------ .../TestRunner.NUnit/NUnitTestRunner.cs | 17 +- .../templates/iOSApp/ViewController.cs | 12 +- .../BCLTests/templates/macOS/MacTestMain.cs | 8 +- .../templates/tvOSApp/ViewController.cs | 8 +- .../watchOS/Extension/InterfaceController.cs | 7 +- .../BCLTests/watchOS-SystemTests.ignore | 11 +- 9 files changed, 54 insertions(+), 343 deletions(-) delete mode 100644 tests/bcl-test/BCLTests/common-SystemTests.ignore diff --git a/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in b/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in index 2acbc69c37..a2ae15b659 100644 --- a/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in @@ -1,4 +1,4 @@ - + Debug diff --git a/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in b/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in index 7b7d1e14c4..8b72c86a64 100644 --- a/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in @@ -1,4 +1,4 @@ - + Debug diff --git a/tests/bcl-test/BCLTests/common-SystemTests.ignore b/tests/bcl-test/BCLTests/common-SystemTests.ignore deleted file mode 100644 index d821bd5eaa..0000000000 --- a/tests/bcl-test/BCLTests/common-SystemTests.ignore +++ /dev/null @@ -1,330 +0,0 @@ -# Expected: True -# But was: False -MonoTests.System.Net.WebClientTest.UploadFileAsyncCancelEvent -MonoTests.System.Net.WebClientTest.UploadDataAsyncCancelEvent -MonoTests.System.Net.WebClientTest.OpenReadTaskAsyncOnFile - -# System.Net.WebException : maximum number of service points reached -# ----> System.InvalidOperationException : maximum number of service points reached -MonoTests.System.Net.WebClientTest.GetWebRequestOverriding -MonoTests.System.Net.WebClientTest.DownloadTwice - -# Expected: True -# But was: False -MonoTests.System.Net.WebClientTest.UploadValuesAsyncCancelEvent -MonoTests.System.Net.WebClientTest.UploadStringAsyncCancelEvent - -# System.Net.WebException : maximum number of service points reached -# ----> System.InvalidOperationException : maximum number of service points reached -MonoTests.System.Net.WebClientTest.UploadValues1 - -# System.Net.Sockets.SocketException : Not enough buffer space is available -MonoTests.System.Net.Sockets.UdpClientTest.JoinMulticastGroupWithLocal -MonoTests.System.Net.Sockets.UdpClientTest.JoinMulticastGroup1_Socket_NotBound - - -# #3 -# Expected: 10022 -# But was: 10049 -MonoTests.System.Net.Sockets.SocketTest.SetSocketOption3_DropMembershipIPv6_Socket_NotBound -MonoTests.System.Net.Sockets.SocketTest.SetSocketOption3_DropMembershipIPv4_Socket_NotBound - -# #1 -# at MonoTests.System.Net.Sockets.SocketTest.SetSocketOption3_AddMembershipIPv6_Socket_NotBound () -MonoTests.System.Net.Sockets.SocketTest.SetSocketOption3_AddMembershipIPv6_Socket_NotBound -MonoTests.System.Net.Sockets.SocketTest.SetSocketOption3_AddMembershipIPv4_Socket_NotBound - -# System.ArgumentException : Value does not fall within the expected range. -MonoTests.System.Net.Sockets.SocketTest.SetSocketOption2_Linger - -# SendBufferSizeDefault -# Expected: 8192 -# But was: 131072 -MonoTests.System.Net.Sockets.SocketTest.SendBufferSizeDefault - -# ReceiveBufferSizeDefault -# Expected: 8192 -# But was: 131072 -MonoTests.System.Net.Sockets.SocketTest.ReceiveBufferSizeDefault - -# System.Net.Sockets.SocketException : Invalid arguments -MonoTests.System.Net.Sockets.SocketTest.DontFragment - -# System.Net.Sockets.SocketException : Operation on non-blocking socket would block -MonoTests.System.Net.Sockets.SocketTest.ConnectHostPortNotIP - -# System.ArgumentException : Value does not fall within the expected range. -MonoTests.System.Net.Sockets.SocketTest.BuffersCheck_None - -# System.Net.Sockets.SocketException : Operation on non-blocking socket would block -MonoTests.System.Net.Sockets.SocketTest.BeginConnectHostPortNotIP - -##0 -# Expected: True -# But was: False -MonoTests.System.Net.Sockets.SocketTest.BeginConnectMultiple - -# SendBufferSizeDefaultUdp -# Expected: 8192 -# But was: 9216 -MonoTests.System.Net.Sockets.SocketTest.SendBufferSizeDefaultUdp - -# ReceiveBufferSizeDefaultUdp -# Expected: 8192 -# But was: 196724 -MonoTests.System.Net.Sockets.SocketTest.ReceiveBufferSizeDefaultUdp - -# DontFragmentChangeUdp -# Expected: True -# But was: False -MonoTests.System.Net.Sockets.SocketTest.DontFragmentChangeUdp - -# DontFragmentChangeTcp -# Expected: True -# But was: False -MonoTests.System.Net.Sockets.SocketTest.DontFragmentChangeTcp - -# System.Net.Sockets.SocketException : Invalid arguments -MonoTests.System.Net.Sockets.SocketTest.ConnectMultiple - -# #A2 -# Expected: True -# But was: False -MonoTests.System.Net.ServicePointTest.EndPointBind - -# System.Net.WebException : The operation has timed out. -MonoTests.System.Net.ServicePointTest.All - -# #A3 -# Expected: not null -# But was: null -MonoTests.System.Net.HttpWebRequestTest.NoContentLength - -# Should result in 304 -MonoTests.System.Net.HttpWebRequestTest.LastModifiedKind - -# System.Net.WebException : Value cannot be null. -MonoTests.System.Net.HttpWebRequestTest.EndGetResponse_AsyncResult_Invalid - -# #02 -# Expected: 1 -# But was: 0 -MonoTests.System.Net.HttpWebRequestTest.Cookies1 - -# #A1 -# at MonoTests.System.Net.HttpResponseStreamTest.Read_Stream_Closed () [0x000a3] in /Users/builder/jenkins/workspace/archive-mono/2018-08/ios/release/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs:1083 -MonoTests.System.Net.HttpResponseStreamTest.Read_Stream_Closed - -# #2 -# Expected: False -# But was: True -MonoTests.System.Net.HttpResponseStreamTest.CanRead - -# #1 -# at MonoTests.System.Net.HttpRequestStreamTest.Write_Stream_Closed () [0x00072] in /Users/builder/jenkins/workspace/archive-mono/2018-08/ios/release/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs:3224 -MonoTests.System.Net.HttpResponseStreamTest.Write_Stream_Closed - -# #A2 -# at MonoTests.System.Net.FileWebRequestTest.GetRequestStream () [0x00049] in /Users/builder/jenkins/workspace/archive-mono/2018-08/ios/release/mcs/class/System/Test/System.Net/FileWebRequestTest.cs:418 -MonoTests.System.Net.FileWebRequestTest.GetRequestStream - -# Expected and actual are both -# Values differ at index [43] -# Expected: 48 -# But was: 53 -MonoTests.System.Net.FileWebRequestTest.Serialize - -# Expected and actual are both -# Values differ at index [43] -# Expected: 48 -# But was: 53 -MonoTests.System.Collections.Generic.QueueTest.SerializeTest - -# Expected and actual are both -# Values differ at index [43] -# Expected: 48 -# But was: 53 -MonoTests.System.Collections.Generic.StackTest.SerializeTest - -# System.ComponentModel.Win32Exception : Cannot find the specified file -MonoTests.System.Diagnostics.ProcessTest.TestExitedRaisedTooSoon - -# System.IO.DirectoryNotFoundException : Could not find a part of the path -MonoTests.System.IO.Compression.DeflateStreamTest.Bug44994_InflateByteByByte - -# Gets blocked -MonoTests.System.Net.WebClientTest.UploadFileAsyncContentType -MonoTests.System.Net.WebRequestTest.TestReceiveCancelation - -# !Equal -MonoTests.System.Timers.TimersDescriptionAttributeTest.ExistingResourceName - -# Description -# Expected: null -# But was: "Mono" -MonoTests.System.Timers.TimersDescriptionAttributeTest.AnyString - -# An unexpected exception type was thrown -# Expected: System.Threading.WaitHandleCannotBeOpenedException -# but was: System.NotSupportedException : Specified method is not supported. -MonoTests.System.Threading.SemaphoreTest.OpenExisting_Unexisting - -# System.NotSupportedException : Specified method is not supported. -MonoTests.System.Threading.SemaphoreTest.OpenExisting_BadRights - -# System.PlatformNotSupportedException : Operation is not supported on this platform. -MonoTests.System.Threading.SemaphoreTest.AccessControl_Unnamed - -# Matching input 'F�' against pattern '\p{IsHebrew}' with options 'None' -# Expected string length 20 but was 5. Strings differ at index 0. -# Expected: "Pass. Group[0]=(1,1)" -# But was: "Fail." -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0018 - -# Matching input 'F2345678910L70' against pattern '(F)(2)(3)(?4)(5)(6)(?'S'7)(8)(9)(10)(L)(?(K)|\10)' with options 'None' -# String lengths are both 178. Strings differ at index 5. -# Expected: "Pass.\tGroup[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -# But was: "Pass. Group[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0016 - -# Matching input 'F2345678910L70' against pattern '(F)(2)(3)(?4)(5)(6)(?'S'7)(8)(9)(10)(L)(?(7)|\10)' with options 'None' -# String lengths are both 178. Strings differ at index 5. -# Expected: "Pass.\tGroup[0]=(0,12) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -# But was: "Pass. Group[0]=(0,12) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0015 - -# Matching input 'F2345678910L70' against pattern '(F)(2)(3)(?4)(5)(6)(?'S'7)(8)(9)(10)(L)(?(S)|\10)' with options 'None' -# String lengths are both 178. Strings differ at index 5. -# Expected: "Pass.\tGroup[0]=(0,12) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -# But was: "Pass. Group[0]=(0,12) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0014 - -# Matching input 'F2345678910L70' against pattern '(F)(2)(3)(?4)(5)(6)(?'S'7)(8)(9)(10)(L)(?(10)\10)' with options 'None' -# String lengths are both 178. Strings differ at index 5. -# Expected: "Pass.\tGroup[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -# But was: "Pass. Group[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0013 - -# Matching input 'F2345678910L71' against pattern '(F)(2)(3)(?4)(5)(6)(?'S'7)(8)(9)(10)(L)\10' with options 'None' -# String lengths are both 178. Strings differ at index 5. -# Expected: "Pass.\tGroup[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -# But was: "Pass. Group[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0009 - -# [FAIL] RegexMatchTests.RegexJvmTrial0008 : Matching input 'F2345678910L71' against pattern '(F)(2)(3)(4)(5)(6)(?7)(8)(9)(10)(L)\11' with options 'None' -# String lengths are both 189. Strings differ at index 5. -# Expected: "Pass.\tGroup[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -# But was: "Pass. Group[0]=(0,13) Group[1]=(0,1) Group[2]=(1,1) Group[3]=..." -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0008 - -# Matching input 'abc' against pattern '(a)(?<2>b)(c)' with options 'None' -# String lengths are both 55. Strings differ at index 42. -# Expected: "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[1]=(1,1)(2,1)" -# But was: "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(1,1)(2,1)" -MonoTests.System.Text.RegularExpressions.RegexMatchTests.RegexJvmTrial0002 - -# An unexpected exception type was thrown -# Expected: System.Security.Cryptography.CryptographicException -# but was: System.ArgumentException : rawData -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Single_SerializedStore - -# System.NotSupportedException : Specified method is not supported. -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Single_SerializedCert - -# An unexpected exception type was thrown -# Expected: System.Security.Cryptography.CryptographicException -# but was: System.ArgumentException : rawData -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Single_Pkcs7 - -# GetCertContentType -# Expected: Pfx -# But was: Unknown -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Single_Pkcs12 - -# GetCertContentType -# Expected: Pfx -# But was: Unknown -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Single_Pfx - -# An unexpected exception type was thrown -# Expected: System.Security.Cryptography.CryptographicException -# but was: System.ArgumentException : rawData -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Multiple_SerializedStore - -# System.NotSupportedException : Specified method is not supported. -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Multiple_SerializedCert - -# An unexpected exception type was thrown -# Expected: System.Security.Cryptography.CryptographicException -# but was: System.ArgumentException : rawData -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Multiple_Pkcs7 - -# GetCertContentType -# Expected: Pfx -# But was: Unknown -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Multiple_Pkcs12 - -# GetCertContentType -# Expected: Pfx -# But was: Unknown -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Multiple_Pfx - -# data -# Expected: not null -# But was: null -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Empty_SerializedStore - -# data -# Expected: not null -# But was: null -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Empty_Pkcs7 - -# data -# Expected: not null -# But was: null -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Empty_Pkcs12 - -# data -# Expected: not null -# But was: null -MonoTests.System.Security.Cryptography.X509Certificates.X509Certificate2CollectionTest.Export_Empty_Pfx - -# System.NotSupportedException : Specified method is not supported. -MonoTests.System.Security.Cryptography.X509Certificates.X509Cert20Test.Export_SerializedCert -MonoTests.System.Security.Cryptography.X509Certificates.X509Cert20Test.Export_Pfx -MonoTests.System.Security.Cryptography.X509Certificates.X509Cert20Test.Export_Pkcs12 - - - -# Expected: True -# But was: False -MonoTests.System.Net.WebSockets.ClientWebSocketTest.ServerHandshakeReturnWrongUpgradeHeader -MonoTests.System.Net.WebSockets.ClientWebSocketTest.ServerHandshakeReturnWrongConnectionHeader -MonoTests.System.Net.WebSockets.ClientWebSocketTest.ServerHandshakeReturnCrapStatusCodeTest - -# Expected: UnknownError -# But was: NameResolutionFailure -MonoTests.System.Net.WebRequestTest.TestFailedResolution - -# Expected: ConnectFailure -# But was: UnknownError -MonoTests.System.Net.WebRequestTest.TestFailedConnection - -# System.AggregateException : One or more errors occurred. (maximum number of service points reached) -# ----> System.Net.WebException : maximum number of service points reached -# ----> System.InvalidOperationException : maximum number of service points reached -MonoTests.System.Net.WebClientTestAsync.DownloadMultiple3 - -# System.AggregateException : One or more errors occurred. (maximum number of service points reached) -# ----> System.Net.WebException : maximum number of service points reached -# ----> System.InvalidOperationException : maximum number of service points reached -MonoTests.System.Net.WebClientTestAsync.DownloadMultiple2 - -# Expected: True -# But was: False -MonoTests.System.Net.WebClientTestAsync.DownloadMultiple -MonoTests.System.Net.WebClientTestAsync.DownloadFileTaskAsync -MonoTests.System.Net.WebClientTestAsync.Cancellation - -# First assertion fails -MonoTests.System.Net.HttpRequestStreamTest.Write_Stream_Closed \ No newline at end of file diff --git a/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs b/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs index b71065fa5c..32c05eb8e3 100644 --- a/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs +++ b/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs @@ -275,7 +275,22 @@ namespace Xamarin.iOS.UnitTests.NUnit { // grab the tests and create a filter for them if (tests.Any ()) { - Filter = new TestMethodFilter (tests); + if (Filter.IsEmpty) { + Filter = new TestMethodFilter (tests); + } else { + // create a special group filter with the previous one + // and the new one + AndFilter andFilter; + if (Filter is AndFilter) { + // add a new filter + andFilter = Filter as AndFilter; + andFilter.Add (new TestMethodFilter (tests)); + } else { + andFilter = new AndFilter (Filter); + andFilter.Add (new TestMethodFilter (tests)); + } + Filter = andFilter; + } } } } diff --git a/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs b/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs index 31d1a33dda..9bf6fcbbe0 100644 --- a/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs +++ b/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs @@ -13,6 +13,7 @@ using System.IO; using System.Threading.Tasks; using System.Linq; using Foundation; +using NUnit.Framework.Internal.Filters; namespace BCLTests { public partial class ViewController : UIViewController { @@ -77,9 +78,14 @@ namespace BCLTests { Xamarin.iOS.UnitTests.TestRunner runner; if (RegisterType.IsXUnit) runner = new XUnitTestRunner (logger); - else - runner = new NUnitTestRunner (logger); - + else { + runner = new NUnitTestRunner (logger) { + // add known ignored categories. + Filter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter) + }; + } + + // add category filters if they have been added var skippedTests = await IgnoreFileParser.ParseContentFilesAsync (NSBundle.MainBundle.BundlePath); if (skippedTests.Any ()) { // ensure that we skip those tests that have been passed via the ignore files diff --git a/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs b/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs index 208b4eb1ba..ee60a3eb66 100644 --- a/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs +++ b/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs @@ -17,6 +17,7 @@ using Xamarin.iOS.UnitTests.NUnit; using BCLTests.TestRunner.Core; using Xamarin.iOS.UnitTests.XUnit; using System.IO; +using NUnit.Framework.Internal.Filters; namespace Xamarin.Mac.Tests { @@ -51,8 +52,11 @@ namespace Xamarin.Mac.Tests TestRunner runner; if (RegisterType.IsXUnit) runner = new XUnitTestRunner (logger); - else - runner = new NUnitTestRunner (logger); + else { + runner = new NUnitTestRunner (logger) { + Filter = new NotFilter (new CategoryExpression ("MacNotWorking,MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter) + }; + } runner.Run (testAssemblies.ToList ()); diff --git a/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs b/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs index 23776d4b6f..a4a99f2cc6 100644 --- a/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs +++ b/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs @@ -13,6 +13,7 @@ using Xamarin.iOS.UnitTests.XUnit; using System.Threading.Tasks; using System.IO; using Foundation; +using NUnit.Framework.Internal.Filters; namespace BCLTests { public partial class ViewController : UIViewController { @@ -75,8 +76,11 @@ namespace BCLTests { Xamarin.iOS.UnitTests.TestRunner runner; if (RegisterType.IsXUnit) runner = new XUnitTestRunner (logger); - else - runner = new NUnitTestRunner (logger); + else { + runner = new NUnitTestRunner (logger) { + Filter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter) + }; + } var skippedTests = await IgnoreFileParser.ParseContentFilesAsync (NSBundle.MainBundle.BundlePath); if (skippedTests.Any ()) { diff --git a/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs b/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs index a03663b8bb..00acc0a214 100644 --- a/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs +++ b/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs @@ -106,8 +106,11 @@ namespace monotouchtestWatchKitExtension var testAssemblies = GetTestAssemblies (); if (RegisterType.IsXUnit) runner = new XUnitTestRunner (logger); - else - runner = new NUnitTestRunner (logger); + else { + runner = new NUnitTestRunner (logger) { + Filter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter,RequiresBSDSockets").Filter) + }; + } var skippedTests = IgnoreFileParser.ParseContentFiles (NSBundle.MainBundle.BundlePath); if (skippedTests.Any ()) { diff --git a/tests/bcl-test/BCLTests/watchOS-SystemTests.ignore b/tests/bcl-test/BCLTests/watchOS-SystemTests.ignore index 0439bc201c..d2d3974fb8 100644 --- a/tests/bcl-test/BCLTests/watchOS-SystemTests.ignore +++ b/tests/bcl-test/BCLTests/watchOS-SystemTests.ignore @@ -512,4 +512,13 @@ MonoCasTests.System.Net.Sockets.SocketCas.AsyncReceiveFrom MonoCasTests.System.Net.Sockets.SocketCas.AsyncSend MonoCasTests.System.Net.Sockets.SocketCas.AsyncSendTo MonoCasTests.System.Net.Sockets.NetworkStreamCas.AsyncRead -MonoCasTests.System.Net.Sockets.NetworkStreamCas.AsyncWrite \ No newline at end of file +MonoCasTests.System.Net.Sockets.NetworkStreamCas.AsyncWrite + +# System.PlatformNotSupportedException : System.Net.Sockets.UdpClient is not supported on the current platform. +MonoTests.System.Net.Sockets.UdpClientTest.JoinMulticastGroup1_Socket_NotBound +MonoTests.System.Net.Sockets.UdpClientTest.JoinMulticastGroupWithLocal + +# System.Net.HttpWebRequest is not supported on the current platform. +MonoTests.System.Net.WebRequestTest.TestFailedConnection +MonoTests.System.Net.WebRequestTest.TestFailedResolution +MonoTests.System.Net.WebRequestTest.TestReceiveCancelation \ No newline at end of file From 3b098a5019bf62de257c7c45644cefcf4ff0ece4 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Tue, 22 Jan 2019 09:20:39 -0500 Subject: [PATCH 04/23] [appkit] Add missing `[NullAllowed]` on `NSDocument` API. Fixes #5349 (#5443) That's an old binding, predating the nullability information from header files. reference: https://github.com/xamarin/xamarin-macios/issues/5349 --- src/appkit.cs | 79 ++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/src/appkit.cs b/src/appkit.cs index 345eb2baba..f6fc60df77 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -5337,69 +5337,69 @@ namespace AppKit { [BaseType (typeof (NSObject))] partial interface NSDocument /* : NSUserActivityRestoring radar://42781537 */ { [Export ("initWithType:error:")] - IntPtr Constructor (string typeName, out NSError outError); + IntPtr Constructor (string typeName, [NullAllowed] out NSError outError); [Static] [Export ("canConcurrentlyReadDocumentsOfType:")] bool CanConcurrentlyReadDocumentsOfType (string typeName); [Export ("initWithContentsOfURL:ofType:error:")] - IntPtr Constructor (NSUrl url, string typeName, out NSError outError); + IntPtr Constructor (NSUrl url, string typeName, [NullAllowed] out NSError outError); [Export ("initForURL:withContentsOfURL:ofType:error:")] - IntPtr Constructor ([NullAllowed] NSUrl documentUrl, NSUrl documentContentsUrl, string typeName, out NSError outError); + IntPtr Constructor ([NullAllowed] NSUrl documentUrl, NSUrl documentContentsUrl, string typeName, [NullAllowed] out NSError outError); - [Export ("revertDocumentToSaved:")] - void RevertDocumentToSaved (NSObject sender); + [Export ("revertDocumentToSaved:")] + void RevertDocumentToSaved ([NullAllowed] NSObject sender); - [Export ("revertToContentsOfURL:ofType:error:")] - bool RevertToContentsOfUrl (NSUrl url, string typeName, out NSError outError); + [Export ("revertToContentsOfURL:ofType:error:")] + bool RevertToContentsOfUrl (NSUrl url, string typeName, [NullAllowed] out NSError outError); [Export ("readFromURL:ofType:error:")] - bool ReadFromUrl (NSUrl url, string typeName, out NSError outError); + bool ReadFromUrl (NSUrl url, string typeName, [NullAllowed] out NSError outError); [Export ("readFromFileWrapper:ofType:error:")] bool ReadFromFileWrapper (NSFileWrapper fileWrapper, string typeName, out NSError outError); [Export ("readFromData:ofType:error:")] - bool ReadFromData (NSData data, string typeName, out NSError outError); + bool ReadFromData (NSData data, string typeName, [NullAllowed] out NSError outError); [Export ("writeToURL:ofType:error:")] - bool WriteToUrl (NSUrl url, string typeName, out NSError outError); + bool WriteToUrl (NSUrl url, string typeName, [NullAllowed] out NSError outError); [Export ("fileWrapperOfType:error:")] - NSFileWrapper GetAsFileWrapper (string typeName, out NSError outError); + NSFileWrapper GetAsFileWrapper (string typeName, [NullAllowed] out NSError outError); [Export ("dataOfType:error:")] - NSData GetAsData (string typeName, out NSError outError); + NSData GetAsData (string typeName, [NullAllowed] out NSError outError); [Export ("writeSafelyToURL:ofType:forSaveOperation:error:")] - bool WriteSafelyToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, out NSError outError); + bool WriteSafelyToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, [NullAllowed] out NSError outError); [Export ("writeToURL:ofType:forSaveOperation:originalContentsURL:error:")] - bool WriteToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, NSUrl absoluteOriginalContentsUrl, out NSError outError); + bool WriteToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, [NullAllowed] NSUrl absoluteOriginalContentsUrl, [NullAllowed] out NSError outError); [Export ("fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:")] - NSDictionary FileAttributesToWrite (NSUrl toUrl, string typeName, NSSaveOperationType saveOperation, NSUrl absoluteOriginalContentsUrl, out NSError outError); + NSDictionary FileAttributesToWrite (NSUrl toUrl, string typeName, NSSaveOperationType saveOperation, [NullAllowed] NSUrl absoluteOriginalContentsUrl, [NullAllowed] out NSError outError); [Export ("keepBackupFile")] bool KeepBackupFile (); [Export ("saveDocument:")] - void SaveDocument (NSObject sender); + void SaveDocument ([NullAllowed] NSObject sender); [Export ("saveDocumentAs:")] - void SaveDocumentAs (NSObject sender); + void SaveDocumentAs ([NullAllowed] NSObject sender); [Export ("saveDocumentTo:")] - void SaveDocumentTo (NSObject sender); + void SaveDocumentTo ([NullAllowed] NSObject sender); [Export ("saveDocumentWithDelegate:didSaveSelector:contextInfo:")] - void SaveDocument (NSObject delegateObject, Selector didSaveSelector, IntPtr contextInfo); + void SaveDocument ([NullAllowed] NSObject delegateObject, [NullAllowed] Selector didSaveSelector, [NullAllowed] IntPtr contextInfo); [Mac (10,9)] [Export ("saveDocumentToPDF:")] - void SaveDocumentAsPdf (NSObject sender); + void SaveDocumentAsPdf ([NullAllowed] NSObject sender); [Mac (10,9)] [DebuggerBrowsable(DebuggerBrowsableState.Never)] @@ -5407,7 +5407,7 @@ namespace AppKit { NSPrintOperation PDFPrintOperation { get; } [Export ("runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:")] - void RunModalSavePanelForSaveOperation (NSSaveOperationType saveOperation, NSObject delegateObject, Selector didSaveSelector, IntPtr contextInfo); + void RunModalSavePanelForSaveOperation (NSSaveOperationType saveOperation, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector didSaveSelector, [NullAllowed] IntPtr contextInfo); [Export ("shouldRunSavePanelWithAccessoryView")] bool ShouldRunSavePanelWithAccessoryView { get; } @@ -5422,31 +5422,32 @@ namespace AppKit { string FileTypeFromLastRunSavePanel { get; } [Export ("saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:")] - void SaveToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, NSObject delegateObject, Selector didSaveSelector, IntPtr contextInfo); + void SaveToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector didSaveSelector, [NullAllowed] IntPtr contextInfo); [Export ("saveToURL:ofType:forSaveOperation:error:")] - bool SaveToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, out NSError outError); + [Deprecated (PlatformName.MacOSX, 10, 6, message: "Use a 'SaveToUrl' overload accepting a completion handler instead.")] + bool SaveToUrl (NSUrl url, string typeName, NSSaveOperationType saveOperation, [NullAllowed] out NSError outError); [Export ("hasUnautosavedChanges")] bool HasUnautosavedChanges { get; } [Export ("autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:")] - void AutosaveDocument (NSObject delegateObject, Selector didAutosaveSelector, IntPtr contextInfo); + void AutosaveDocument ([NullAllowed] NSObject delegateObject, [NullAllowed] Selector didAutosaveSelector, [NullAllowed] IntPtr contextInfo); [Export ("autosavingFileType")] string AutosavingFileType { get; } [Export ("canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:")] - void CanCloseDocument (NSObject delegateObject, Selector shouldCloseSelector, IntPtr contextInfo); + void CanCloseDocument (NSObject delegateObject, [NullAllowed] Selector shouldCloseSelector, [NullAllowed] IntPtr contextInfo); [Export ("close")] void Close (); [Export ("runPageLayout:")] - void RunPageLayout (NSObject sender); + void RunPageLayout ([NullAllowed] NSObject sender); [Export ("runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:")] - void RunModalPageLayout (NSPrintInfo printInfo, NSObject delegateObject, Selector didRunSelector, IntPtr contextInfo); + void RunModalPageLayout (NSPrintInfo printInfo, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector didRunSelector, [NullAllowed] IntPtr contextInfo); [Export ("preparePageLayout:")] bool PreparePageLayout (NSPageLayout pageLayout); @@ -5455,16 +5456,16 @@ namespace AppKit { bool ShouldChangePrintInfo (NSPrintInfo newPrintInfo); [Export ("printDocument:")] - void PrintDocument (NSObject sender); + void PrintDocument ([NullAllowed] NSObject sender); [Export ("printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:")] - void PrintDocument (NSDictionary printSettings, bool showPrintPanel, NSObject delegateObject, Selector didPrintSelector, IntPtr contextInfo); + void PrintDocument (NSDictionary printSettings, bool showPrintPanel, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector didPrintSelector, [NullAllowed] IntPtr contextInfo); [Export ("printOperationWithSettings:error:")] - NSPrintOperation PrintOperation (NSDictionary printSettings, out NSError outError); + NSPrintOperation PrintOperation (NSDictionary printSettings, [NullAllowed] out NSError outError); [Export ("runModalPrintOperation:delegate:didRunSelector:contextInfo:")] - void RunModalPrintOperation (NSPrintOperation printOperation, NSObject delegateObject, Selector didRunSelector, IntPtr contextInfo); + void RunModalPrintOperation (NSPrintOperation printOperation, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector didRunSelector, [NullAllowed] IntPtr contextInfo); [Export ("isDocumentEdited")] bool IsDocumentEdited { get; } @@ -5473,7 +5474,7 @@ namespace AppKit { void UpdateChangeCount (NSDocumentChangeType change); [Export ("presentError:modalForWindow:delegate:didPresentSelector:contextInfo:")] - void PresentError (NSError error, NSWindow window, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector didPresentSelector, IntPtr contextInfo); + void PresentError (NSError error, NSWindow window, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector didPresentSelector, [NullAllowed] IntPtr contextInfo); [Export ("presentError:")] bool PresentError (NSError error); @@ -5494,7 +5495,7 @@ namespace AppKit { void WindowControllerDidLoadNib (NSWindowController windowController); [Export ("setWindow:")] - void SetWindow (NSWindow window); + void SetWindow ([NullAllowed] NSWindow window); [Export ("addWindowController:")] [PostGet ("WindowControllers")] @@ -5511,7 +5512,7 @@ namespace AppKit { NSWindowController [] WindowControllers { get; } [Export ("shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:")] - void ShouldCloseWindowController (NSWindowController windowController, NSObject delegateObject, Selector shouldCloseSelector, IntPtr contextInfo); + void ShouldCloseWindowController (NSWindowController windowController, [NullAllowed] NSObject delegateObject, [NullAllowed] Selector shouldCloseSelector, [NullAllowed] IntPtr contextInfo); [Export ("displayName")] [NullAllowed] @@ -5605,7 +5606,7 @@ namespace AppKit { bool CanWriteAsynchronously (NSUrl toUrl, string typeName, NSSaveOperationType saveOperation); [Export ("checkAutosavingSafetyAndReturnError:")] - bool CheckAutosavingSafety (out NSError outError); + bool CheckAutosavingSafety ([NullAllowed] out NSError outError); [Export ("scheduleAutosaving")] void ScheduleAutosaving (); @@ -5622,13 +5623,13 @@ namespace AppKit { bool PreservesVersions (); [Export ("duplicateDocument:")] - void DuplicateDocument (NSObject sender); + void DuplicateDocument ([NullAllowed] NSObject sender); [Export ("duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:"), Internal] - void _DuplicateDocument ([NullAllowed] NSObject cbackobject, [NullAllowed] Selector didDuplicateSelector, IntPtr contextInfo); + void _DuplicateDocument ([NullAllowed] NSObject cbackobject, [NullAllowed] Selector didDuplicateSelector, [NullAllowed] IntPtr contextInfo); [Export ("duplicateAndReturnError:")] - NSDocument Duplicate (out NSError outError); + NSDocument Duplicate ([NullAllowed] out NSError outError); [Export ("isInViewingMode")] bool IsInViewingMode { get; } @@ -5693,7 +5694,7 @@ namespace AppKit { [Mac (10,12)] [Export ("stopBrowsingVersionsWithCompletionHandler:")] [Async] - void StopBrowsingVersions (Action completionHandler); + void StopBrowsingVersions ([NullAllowed] Action completionHandler); [Mac (10, 13)] [Export ("allowsDocumentSharing")] From 91250bb615ce92437047df1fcfb0465eadc269ec Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Tue, 22 Jan 2019 09:52:39 -0500 Subject: [PATCH 05/23] [generator] Fix BI0000 when no argument semantics are present on a property. Fixes #5444 (#5451) This can happen if a `[Wrap]` is used on the property getter (and setter) instead of directly on the property. In such condition we can safely assume that no dirty check is needed and can continue with, unmodified, generation (using the wrapped content). reference: https://github.com/xamarin/xamarin-macios/issues/5444 --- src/generator.cs | 2 +- tests/generator/BGenTests.cs | 3 +++ tests/generator/ghissue5444.cs | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/generator/ghissue5444.cs diff --git a/src/generator.cs b/src/generator.cs index bb39b5dfab..5b688a7f64 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -4526,7 +4526,7 @@ public partial class Generator : IMemberGatherer { bool DoesPropertyNeedDirtyCheck (PropertyInfo pi, ExportAttribute ea) { - switch (ea.ArgumentSemantic) { + switch (ea?.ArgumentSemantic) { case ArgumentSemantic.Copy: case ArgumentSemantic.Retain: // same as Strong case ArgumentSemantic.None: diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index 70203e79cb..6141379b59 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -561,6 +561,9 @@ namespace GeneratorTests Assert.AreEqual (modelName, attrib.ConstructorArguments [0].Value, "Custom ObjC name"); } + [Test] + public void GHIssue5444 () => BuildFile (Profile.iOS, "ghissue5444.cs"); + BGenTool BuildFile (Profile profile, params string [] filenames) { return BuildFile (profile, true, false, filenames); diff --git a/tests/generator/ghissue5444.cs b/tests/generator/ghissue5444.cs new file mode 100644 index 0000000000..51aebd573e --- /dev/null +++ b/tests/generator/ghissue5444.cs @@ -0,0 +1,19 @@ +using Foundation; +using ObjCRuntime; + +namespace GHIssue5444 { + + [BaseType (typeof (NSObject))] + interface CardScheme { + [Export ("colorScheme", ArgumentSemantic.Assign)] + new NSString ColorScheme { get; set; } + + [Export ("shapeScheme", ArgumentSemantic.Assign)] + new NSString ShapeScheme { get; set; } + + NSString SemanticColorScheme { + [Wrap ("Runtime.GetNSObject (ColorScheme.Handle, false)")] get; + [Wrap ("ColorScheme = value")] set; + } + } +} \ No newline at end of file From 52de2ea5880f02fb4cd55e4cba794ee9bcd42884 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 22 Jan 2019 17:41:03 +0100 Subject: [PATCH 06/23] [CoreFoundation] Add UnmanagedFunctionPointer attribute to delegate used for native callbacks. Fixes #5447. (#5453) Fixes https://github.com/xamarin/xamarin-macios/issues/5447. --- src/CoreFoundation/DispatchBlock.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CoreFoundation/DispatchBlock.cs b/src/CoreFoundation/DispatchBlock.cs index 3e368787c5..71a2d27ff3 100644 --- a/src/CoreFoundation/DispatchBlock.cs +++ b/src/CoreFoundation/DispatchBlock.cs @@ -170,6 +170,7 @@ namespace CoreFoundation { return Wait (new DispatchTime (DispatchTime.Now, timeout)); } + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void DispatchBlockCallback (IntPtr block); public static explicit operator Action (DispatchBlock block) From a97dddf6db4308468b046ea259d5e4778c6a0959 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 22 Jan 2019 17:49:03 +0100 Subject: [PATCH 07/23] [XHarness] Remove not needed dll from the test templates. (#5454) --- tests/bcl-test/BCLTests/BCLTests-mac.csproj.in | 3 --- tests/bcl-test/BCLTests/BCLTests-tv.csproj.in | 3 --- tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in | 3 --- tests/bcl-test/BCLTests/BCLTests.csproj.in | 3 --- 4 files changed, 12 deletions(-) diff --git a/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in b/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in index a2ae15b659..3a2d7c426f 100644 --- a/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-mac.csproj.in @@ -106,9 +106,6 @@ ..\..\..\packages\xunit.runner.utility.2.4.0\lib\netstandard2.0\xunit.runner.utility.netstandard20.dll - - ..\..\..\external\mono\mcs\class\lib\monotouch\System.Runtime.Serialization.Formatters.Soap.dll - ..\..\..\packages\Microsoft.Extensions.Options.ConfigurationExtensions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll diff --git a/tests/bcl-test/BCLTests/BCLTests-tv.csproj.in b/tests/bcl-test/BCLTests/BCLTests-tv.csproj.in index 61c43e568e..ea8cf63db0 100644 --- a/tests/bcl-test/BCLTests/BCLTests-tv.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-tv.csproj.in @@ -173,9 +173,6 @@ ..\..\..\packages\xunit.runner.utility.2.4.0\lib\netstandard2.0\xunit.runner.utility.netstandard20.dll - - ..\..\..\external\mono\mcs\class\lib\monotouch\System.Runtime.Serialization.Formatters.Soap.dll - ..\..\..\packages\Microsoft.Extensions.Options.ConfigurationExtensions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll diff --git a/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in b/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in index 8b72c86a64..d293ec0bd9 100644 --- a/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in @@ -132,9 +132,6 @@ ..\..\..\packages\xunit.runner.utility.2.4.0\lib\netstandard2.0\xunit.runner.utility.netstandard20.dll - - ..\..\..\external\mono\mcs\class\lib\monotouch\System.Runtime.Serialization.Formatters.Soap.dll - ..\..\..\packages\Microsoft.Extensions.Options.ConfigurationExtensions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll diff --git a/tests/bcl-test/BCLTests/BCLTests.csproj.in b/tests/bcl-test/BCLTests/BCLTests.csproj.in index afcf266c83..47744d03af 100644 --- a/tests/bcl-test/BCLTests/BCLTests.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests.csproj.in @@ -185,9 +185,6 @@ ..\..\..\packages\xunit.runner.utility.2.4.0\lib\netstandard2.0\xunit.runner.utility.netstandard20.dll - - ..\..\..\external\mono\mcs\class\lib\monotouch\System.Runtime.Serialization.Formatters.Soap.dll - ..\..\..\packages\Microsoft.Extensions.Options.ConfigurationExtensions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll From a71f421a6790f326f7ec0f15af08a37f7c7eed87 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 22 Jan 2019 23:18:45 +0100 Subject: [PATCH 08/23] [XHarness] Reneable Sytem.Security tests on iOS, TvOS and WatchOS. (#5421) Reneable the tests and ignore those failing ones. Fixes https://github.com/xamarin/maccore/issues/1139 --- .../BCLTests/common-SystemSecurityTests.ignore | 14 ++++++++++++++ .../BCLTestImporter/BCLTestProjectGenerator.cs | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/bcl-test/BCLTests/common-SystemSecurityTests.ignore diff --git a/tests/bcl-test/BCLTests/common-SystemSecurityTests.ignore b/tests/bcl-test/BCLTests/common-SystemSecurityTests.ignore new file mode 100644 index 0000000000..3a6c96864b --- /dev/null +++ b/tests/bcl-test/BCLTests/common-SystemSecurityTests.ignore @@ -0,0 +1,14 @@ +# An unexpected exception type was thrown +# Expected: System.Security.Cryptography.CryptographicException +# but was: System.PlatformNotSupportedException : The recipients collection is empty. You must specify at least one recipient. This platform does not implement the certificate picker UI. +MonoTests.System.Security.Cryptography.Pkcs.EnvelopedCmsTest.EncryptEmpty + +# System.Security.Cryptography.CryptographicException : The enveloped-data message does not contain the specified recipient. +MonoTests.System.Security.Cryptography.Pkcs.EnvelopedCmsTest.EncryptCmsRecipientUnknown +MonoTests.System.Security.Cryptography.Pkcs.EnvelopedCmsTest.EncryptCmsRecipientIssuerAndSerialNumber + +# ContentEncryptionAlgorithm.Parameters +# Expected: 16 +# But was: 0 +MonoTests.System.Security.Cryptography.Pkcs.EnvelopedCmsTest.Decrypt +MonoTests.System.Security.Cryptography.Pkcs.EnvelopedCmsTest.Decode \ No newline at end of file diff --git a/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs b/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs index 1a3084b5f2..4d0a0898ef 100644 --- a/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs +++ b/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs @@ -109,7 +109,6 @@ namespace BCLTestImporter { }; static readonly List CommonIgnoredAssemblies = new List { - "monotouch_System.Security_test.dll", // issue https://github.com/xamarin/maccore/issues/1139 "monotouch_Commons.Xml.Relaxng_test.dll", // not supported by xamarin "monotouch_Cscompmgd_test.dll", // not supported by xamarin "monotouch_I18N.CJK_test.dll", From 02f65cc1193cb52eb32871e9614dc88fd15a1890 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 22 Jan 2019 23:24:44 +0100 Subject: [PATCH 09/23] [XHarness] Remove not needed ignore file for System.Transactions. (#5457) Since we support filtering via categories, we do not longer need the ignore file in these tests. --- tests/bcl-test/BCLTests/common-SystemTransactionsTests.ignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 tests/bcl-test/BCLTests/common-SystemTransactionsTests.ignore diff --git a/tests/bcl-test/BCLTests/common-SystemTransactionsTests.ignore b/tests/bcl-test/BCLTests/common-SystemTransactionsTests.ignore deleted file mode 100644 index cb2e73dd25..0000000000 --- a/tests/bcl-test/BCLTests/common-SystemTransactionsTests.ignore +++ /dev/null @@ -1,3 +0,0 @@ -# System.NotImplementedException : DTC unsupported, only SinglePhase commit supported for durable resource managers. -MonoTests.System.Transactions.EnlistTest.Vol0_Dur1_2PC -MonoTests.System.Transactions.EnlistTest.Vol0_Dur2 \ No newline at end of file From a63c1c7f629c2c603192f870071041686f90425f Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 23 Jan 2019 10:15:36 +0100 Subject: [PATCH 10/23] [XHarness] Fix small typo in test projet name. (#5461) The small typo made the test projects from mac and ios/tvos/watchos be in different nodes in the xhanress web page which is ugly. They now wil appear in the same node. --- .../BCLTestImporter/BCLTestProjectGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs b/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs index 4d0a0898ef..5724ae9d7c 100644 --- a/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs +++ b/tools/bcl-test-importer/BCLTestImporter/BCLTestProjectGenerator.cs @@ -87,7 +87,7 @@ namespace BCLTestImporter { (name:"SystemXmlTests", assemblies: new [] {"monotouch_System.Xml_test.dll"}), (name:"SystemXmlLinqTests", assemblies: new [] {"monotouch_System.Xml.Linq_test.dll"}), (name:"MonoSecurityTests", assemblies: new [] {"monotouch_Mono.Security_test.dll"}), - (name:"SystemComponentModelDataAnnotationTests", assemblies: new [] {"monotouch_System.ComponentModel.DataAnnotations_test.dll"}), + (name:"SystemComponentModelDataAnnotationsTests", assemblies: new [] {"monotouch_System.ComponentModel.DataAnnotations_test.dll"}), (name:"SystemJsonTests", assemblies: new [] {"monotouch_System.Json_test.dll"}), (name:"SystemServiceModelWebTests", assemblies: new [] {"monotouch_System.ServiceModel.Web_test.dll"}), (name:"MonoDataTdsTests", assemblies: new [] {"monotouch_Mono.Data.Tds_test.dll"}), From 99bda10aa47c35c6e6a037958cd07513ecc0032f Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 23 Jan 2019 10:17:46 +0100 Subject: [PATCH 11/23] [XHarness] Clean the System.Data ignore. (#5458) Since we support filtering there are a number of tests that were ignore that are part of a ignored category, therefore, they are not needed in the file. --- .../BCLTests/common-SystemDataTests.ignore | 102 +----------------- 1 file changed, 1 insertion(+), 101 deletions(-) diff --git a/tests/bcl-test/BCLTests/common-SystemDataTests.ignore b/tests/bcl-test/BCLTests/common-SystemDataTests.ignore index a199c6458f..424d548643 100644 --- a/tests/bcl-test/BCLTests/common-SystemDataTests.ignore +++ b/tests/bcl-test/BCLTests/common-SystemDataTests.ignore @@ -2,33 +2,11 @@ Monotests_Mono.Data.SqlExpressions.DateComparisonTest.TestDateComparisonRight Monotests_Mono.Data.SqlExpressions.DateComparisonTest.TestDateComparisonLeft MonoTests.System.Data.XmlDataReaderTest.XmlLoadTest -MonoTests.System.Data.XmlDataReaderTest.Test6 -MonoTests.System.Data.XmlDataReaderTest.Test5 -MonoTests.System.Data.XmlDataReaderTest.Test4 -MonoTests.System.Data.XmlDataReaderTest.Test3 -MonoTests.System.Data.XmlDataReaderTest.Test2 -MonoTests.System.Data.XmlDataReaderTest.Test1 -MonoTests.System.Data.XmlDataReaderTest.Navigator -MonoTests.System.Data.XmlDataReaderTest.GetRowFromElement -MonoTests.System.Data.XmlDataReaderTest.GetElementFromRow -MonoTests.System.Data.XmlDataReaderTest.EditingXmlTree -MonoTests.System.Data.XmlDataReaderTest.EditingDataSet -MonoTests.System.Data.XmlDataReaderTest.CreateElement3 -MonoTests.System.Data.XmlDataReaderTest.CreateElement2 -MonoTests.System.Data.XmlDataReaderTest.CreateElement1 -MonoTests.System.Data.XmlDataReaderTest.CloneNode # System.NotSupportedException : Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled. MonoTests.System.Data.SqlTypes.SqlStringTest.UnicodeBytes MonoTests.System.Data.SqlTypes.SqlStringTest.Create -# System.FormatException : Input string was not in a correct format. -MonoTests.System.Data.SqlTypes.SqlInt64Test.ReadWriteXmlTest -MonoTests.System.Data.SqlTypes.SqlInt32Test.ReadWriteXmlTest -MonoTests.System.Data.SqlTypes.SqlInt16Test.ReadWriteXmlTest -MonoTests.System.Data.SqlTypes.SqlDoubleTest.ReadWriteXmlTest -MonoTests.System.Data.SqlTypes.SqlDecimalTest.ReadWriteXmlTest - # System.IO.DirectoryNotFoundException : Could not find a part of the path MonoTests.System.Data.Xml.XmlDataDocumentTest.Test6 MonoTests.System.Data.Xml.XmlDataDocumentTest.Test5 @@ -46,59 +24,14 @@ MonoTests.System.Data.Xml.XmlDataDocumentTest.CreateElement2 MonoTests.System.Data.Xml.XmlDataDocumentTest.CreateElement1 MonoTests.System.Data.Xml.XmlDataDocumentTest.CloneNode -# System.NotSupportedException : The keyword 'connection reset' is not supported on this platform. -MonoTests.System.Data.SqlClient.SqlConnectionTest.ConnectionString_OtherKeywords - -# System.NotSupportedException : The keyword 'Network Library' is not supported on this platform, prefix the 'Data Source' with the protocol desired instead ('tcp:' for a TCP connection, or 'np:' for a Named Pipe connection). -MonoTests.System.Data.SqlClient.SqlConnectionTest.ConnectionString_NetworkLibrary_Synonyms - -# System.NotSupportedException : The keyword 'asynchronous processing' is not supported on this platform. -MonoTests.System.Data.SqlClient.SqlConnectionTest.ConnectionString_AsynchronousProcessing - -# #6 -# Expected: True -# But was: False -MonoTests.System.Data.SqlClient.SqlConnectionTest.ChangePassword_ConnectionString_Null -MonoTests.System.Data.SqlClient.SqlConnectionTest.ChangePassword_ConnectionString_Empty - -# Expected string length 568 but was 512. Strings differ at index 70. -# Expected: "...ertyDescriptorChanged,0,0\n----- UpdateIndex : True\n---- On..." -# But was: "...ertyDescriptorChanged,0,0\n---- OnListChanged Reset,-1,-1\nt..." -MonoTests.System.Data.DataViewTest.ComplexEventSequence2 - -# Expected string length 1316 but was 1214. Strings differ at index 70. -# Expected: "...ertyDescriptorChanged,0,0\n----- UpdateIndex : True\n---- On..." -# But was: "...ertyDescriptorChanged,0,0\n---- OnListChanged Reset,-1,-1\nt..." -MonoTests.System.Data.DataViewTest.ComplexEventSequence1 - -# #9 -# String lengths are both 11. Strings differ at index 10. -# Expected: "Constraint1" -# But was: "Constraint2" -MonoTests.System.Data.DataTableTest3.XmlSchemaTest4 - # System.IO.DirectoryNotFoundException : Could not find a part of the path -MonoTests.System.Data.DataTableTest3.WriteXmlSchema -MonoTests.System.Data.DataTableTest3.ReadXmlSchema MonoTests.System.Data.DataTableReadXmlSchemaTest.TestSampleFileXPath MonoTests.System.Data.DataTableReadXmlSchemaTest.TestSampleFileSimpleTables -MonoTests.System.Data.DataTableReadXmlSchemaTest.TestSampleFileImportSimple - -# An unexpected exception type was thrown -# Expected: System.NullReferenceException -# but was: System.IO.DirectoryNotFoundException : Could not find a part of the path -MonoTests.System.Data.DataTableReadXmlSchemaTest.TestSampleFileComplexTablesExp2 -MonoTests.System.Data.DataTableReadXmlSchemaTest.TestSampleFileComplexTablesExp1 # System.IO.DirectoryNotFoundException : Could not find a part of the path MonoTests.System.Data.DataTableReadXmlSchemaTest.TestSampleFileComplexTables3 -MonoTests.System.Data.DataTableReadXmlSchemaTest.TestSampleFileComplexTables2 # System.IO.DirectoryNotFoundException : Could not find a part of the path -MonoTests.System.Data.DataTableReadXmlSchemaTest.TestMoreThanOneRepeatableColumns -MonoTests.System.Data.DataTableReadXmlSchemaTest.TestAnnotatedRelation2 -MonoTests.System.Data.DataTableReadXmlSchemaTest.TestAnnotatedRelation1 -MonoTests.System.Data.DataTableReadXmlSchemaTest.RepeatableSimpleElement MonoTests.System.Data.DataTableReadXmlSchemaTest.ReadConstraints MonoTests.System.Data.DataTableReadXmlSchemaTest.ReadAnnotatedRelations_MultipleColumns MonoTests.System.Data.DataTableTest.WriteXmlSchema @@ -109,11 +42,6 @@ MonoTests.System.Data.DataSetTest2.ReadXmlSchema_Nested MonoTests.System.Data.DataSetTest2.Merge_ConstraintsFromReadXmlSchema MonoTests.System.Data.DataSetTest.WriteXmlSchema -# Expected string length 1817 but was 918. Strings differ at index 1. -# Expected: "\n Date: Wed, 23 Jan 2019 12:28:54 +0100 Subject: [PATCH 12/23] [Xharness] Remove not longer needed System.Service.Model.Web ignore file. (#5460) Since we support categories, the file is not longer needed since the failing tests are part of an ignored category. --- .../common-SystemServiceModelWebTests.ignore | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 tests/bcl-test/BCLTests/common-SystemServiceModelWebTests.ignore diff --git a/tests/bcl-test/BCLTests/common-SystemServiceModelWebTests.ignore b/tests/bcl-test/BCLTests/common-SystemServiceModelWebTests.ignore deleted file mode 100644 index dbc9527c33..0000000000 --- a/tests/bcl-test/BCLTests/common-SystemServiceModelWebTests.ignore +++ /dev/null @@ -1,17 +0,0 @@ -# The following ignores have been reported in the issue: -# issue https://github.com/xamarin/maccore/issues/1137 - -# An unexpected exception type was thrown -MonoTests.System.ServiceModel.Description.JsonQueryStringConverterTest.ConvertStringToValueInvalidCast2 - -# An unexpected exception type was thrown -MonoTests.System.ServiceModel.Description.QueryStringConverterTest.ConvertStringToValueInvalidCast2 - -# Should result in invalid operation -MonoTests.System.ServiceModel.Description.WebHttpBehaviorTest.MultipleParameters2 - -# System.ArgumentException : baseAddress scheme must be either http or https. -MonoTests.System.UriTemplateTest.BindByNameFileUriBaseAddress - -# System.ArgumentException : baseAddress scheme must be either http or https. -MonoTests.System.UriTemplateTest.BindByPositionFileUriBaseAddress From debcee412c4b8bee731a4a578487e400f9f25200 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 24 Jan 2019 13:10:40 +0100 Subject: [PATCH 13/23] [XHarness] Clean the System.Net.Http ignore file. (#5459) Since we support categories, there is a test that does not longer needs to be ignored in ios and tvos but needs to be in watchos (we do not yet have the correct test assembly for the platform). --- tests/bcl-test/BCLTests/common-SystemNetHttpTests.ignore | 5 ----- tests/bcl-test/BCLTests/watchOS-SystemNetHttpTests.ignore | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/bcl-test/BCLTests/common-SystemNetHttpTests.ignore b/tests/bcl-test/BCLTests/common-SystemNetHttpTests.ignore index 5f2071def1..c0a5744b42 100644 --- a/tests/bcl-test/BCLTests/common-SystemNetHttpTests.ignore +++ b/tests/bcl-test/BCLTests/common-SystemNetHttpTests.ignore @@ -60,8 +60,3 @@ MonoTests.System.Net.Http.HttpClientTest.Post_TransferEncodingChunked # Expected: False # But was: True MonoTests.System.Net.Http.HttpClientTest.Post_StreamCaching - -# #3 -# Expected: True -# But was: False -MonoTests.System.Net.Http.HttpClientTest.Send_Complete_Content_MaxResponseContentBufferSize_Error \ No newline at end of file diff --git a/tests/bcl-test/BCLTests/watchOS-SystemNetHttpTests.ignore b/tests/bcl-test/BCLTests/watchOS-SystemNetHttpTests.ignore index 1e426e3e50..6a6ccc2f84 100644 --- a/tests/bcl-test/BCLTests/watchOS-SystemNetHttpTests.ignore +++ b/tests/bcl-test/BCLTests/watchOS-SystemNetHttpTests.ignore @@ -18,4 +18,5 @@ MonoTests.System.Net.Http.HttpClientTest.Send_Complete_CustomHeaders_SpecialSepa MonoTests.System.Net.Http.HttpClientTest.Send_Complete_Error MonoTests.System.Net.Http.HttpClientTest.Send_Content_BomEncoding MonoTests.System.Net.Http.HttpClientTest.Send_Content_Get -MonoTests.System.Net.Http.HttpClientTest.Send_Content_Put \ No newline at end of file +MonoTests.System.Net.Http.HttpClientTest.Send_Content_Put +MonoTests.System.Net.Http.HttpClientTest.Send_Complete_Content_MaxResponseContentBufferSize_Error \ No newline at end of file From 6c12862d3e9161b707099fccb1aed1ae3f782416 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 24 Jan 2019 13:11:11 +0100 Subject: [PATCH 14/23] [XHarness] Remove not needed ignore file. (#5456) Since we support filtering via categories, we do not longer need the ignore file in these tests. --- tests/bcl-test/BCLTests/common-SystemCoreTests.ignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 tests/bcl-test/BCLTests/common-SystemCoreTests.ignore diff --git a/tests/bcl-test/BCLTests/common-SystemCoreTests.ignore b/tests/bcl-test/BCLTests/common-SystemCoreTests.ignore deleted file mode 100644 index 2b8a5a8ae3..0000000000 --- a/tests/bcl-test/BCLTests/common-SystemCoreTests.ignore +++ /dev/null @@ -1,2 +0,0 @@ -# System.NotSupportedException : Cannot create boxed TypedReference, ArgIterator, or RuntimeArgumentHandle Objects. -MonoTests.System.Linq.Expressions.ExpressionTest_Call.Connect319190 \ No newline at end of file From 1c881549a357a03dfece31772892f956ea962bc4 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Thu, 24 Jan 2019 08:57:46 -0500 Subject: [PATCH 15/23] [generator] Warn if [NullAllowed] is used on methods. Fixes #4416 (#5464) The `[NullAllowed]` attribute should not be allowed on methods but it could break existing binding projects. Historically it was used on property setters. However using the attribute on _other_ methods can be misleading, e.g. should it apply to all parameters, the return value... and its presence/action can be misinterpreted in code reviews leading to binding bugs. reference: https://github.com/xamarin/xamarin-macios/issues/5416 --- docs/website/generator-errors.md | 8 ++++++++ src/generator.cs | 8 +++++++- tests/generator/BGenTests.cs | 22 ++++++++++++++++++++++ tests/generator/ghissue5416a.cs | 11 +++++++++++ tests/generator/ghissue5416b.cs | 12 ++++++++++++ 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tests/generator/ghissue5416a.cs create mode 100644 tests/generator/ghissue5416b.cs diff --git a/docs/website/generator-errors.md b/docs/website/generator-errors.md index 62f6ca2969..44c0f96f1e 100644 --- a/docs/website/generator-errors.md +++ b/docs/website/generator-errors.md @@ -216,6 +216,14 @@ This usually indicates a bug in Xamarin.iOS/Xamarin.Mac; please [file a bug repo ### BI1117: The member '*' is decorated with [Static] and its container class * is decorated with [Category] this leads to hard to use code. Please inline * into * class. +### [NullAllowed] should not be used on methods, like '*', but only on properties, parameters and return values. + +The `[NullAllowed]` attribute should not be allowed on methods but it could break existing binding projects. + +Historically it was used on property setters. However using the attribute on _other_ methods can be misleading, e.g. should it apply to all parameters, the return value... and its presence/action can be misinterpreted in code reviews leading to binding bugs. + +To fix this warning use the `[NullAllowed]` attribute only on parameters, properties or return values. + diff --git a/src/generator.cs b/src/generator.cs index 5b688a7f64..670442ea54 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -4096,6 +4096,9 @@ public partial class Generator : IMemberGatherer { if (null_allowed_override) return; + if (AttributeManager.HasAttribute (mi)) + ErrorHelper.Show (new BindingException (1118, false, $"[NullAllowed] should not be used on methods, like '{mi}', but only on properties, parameters and return values.")); + foreach (var pi in mi.GetParameters ()) { var needs_null_check = ParameterNeedsNullCheck (pi, mi, propInfo); if (!needs_null_check) @@ -4808,7 +4811,10 @@ public partial class Generator : IMemberGatherer { if (pi.CanWrite){ var setter = pi.GetSetMethod (); var ba = GetBindAttribute (setter); - bool null_allowed = AttributeManager.HasAttribute (pi) || AttributeManager.HasAttribute (setter); + bool null_allowed = AttributeManager.HasAttribute (setter); + if (null_allowed) + ErrorHelper.Show (new BindingException (1118, false, $"[NullAllowed] should not be used on methods, like '{setter}', but only on properties, parameters and return values.")); + null_allowed |= AttributeManager.HasAttribute (pi); var not_implemented_attr = AttributeManager.GetCustomAttribute (setter); string sel; diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index 6141379b59..f9b4a25cd7 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -564,6 +564,28 @@ namespace GeneratorTests [Test] public void GHIssue5444 () => BuildFile (Profile.iOS, "ghissue5444.cs"); + [Test] + public void GH5416_method () + { + var bgen = new BGenTool (); + bgen.Profile = Profile.iOS; + bgen.AddTestApiDefinition ("ghissue5416b.cs"); + bgen.CreateTemporaryBinding (); + bgen.AssertExecute ("build"); + bgen.AssertWarning (1118, "[NullAllowed] should not be used on methods, like 'NSString Method(Foundation.NSDate, Foundation.NSObject)', but only on properties, parameters and return values."); + } + + [Test] + public void GH5416_setter () + { + var bgen = new BGenTool (); + bgen.Profile = Profile.iOS; + bgen.AddTestApiDefinition ("ghissue5416a.cs"); + bgen.CreateTemporaryBinding (); + bgen.AssertExecute ("build"); + bgen.AssertWarning (1118, "[NullAllowed] should not be used on methods, like 'Void set_Setter(Foundation.NSString)', but only on properties, parameters and return values."); + } + BGenTool BuildFile (Profile profile, params string [] filenames) { return BuildFile (profile, true, false, filenames); diff --git a/tests/generator/ghissue5416a.cs b/tests/generator/ghissue5416a.cs new file mode 100644 index 0000000000..df596a7911 --- /dev/null +++ b/tests/generator/ghissue5416a.cs @@ -0,0 +1,11 @@ +using Foundation; +using ObjCRuntime; + +namespace GHIssue5416 { + + [BaseType (typeof (NSObject))] + interface NullAllowedWarning { + [Export ("setter", ArgumentSemantic.Assign)] + NSString Setter { get; [NullAllowed] set; } + } +} \ No newline at end of file diff --git a/tests/generator/ghissue5416b.cs b/tests/generator/ghissue5416b.cs new file mode 100644 index 0000000000..5832d9229b --- /dev/null +++ b/tests/generator/ghissue5416b.cs @@ -0,0 +1,12 @@ +using Foundation; +using ObjCRuntime; + +namespace GHIssue5416 { + + [BaseType (typeof (NSObject))] + interface NullAllowedWarning { + [Export ("methodWhen:data:", ArgumentSemantic.Assign)] + [NullAllowed] + NSString Method (NSDate d, NSObject o); + } +} \ No newline at end of file From be504be9acd6076ec320f365f4d599f95d03350b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 24 Jan 2019 15:08:50 +0100 Subject: [PATCH 16/23] [mtouch] Properly deserialize cached Objective-C class symbols. Fixes #5467. (#5468) Deserialize cached Objective-C class symbols to match how the objects looked before serialization. This means storing the Objective-C class name in the Symbol.ObjectiveCName field, and not the Symbol.Name field. Fixes https://github.com/xamarin/xamarin-macios/issues/5467. --- tests/mtouch/MTouch.cs | 32 ++++++++++++++++++++++++++++++++ tools/common/Symbols.cs | 16 ++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index 058467f9fc..4dab5d149b 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -3968,6 +3968,38 @@ public partial class KeyboardViewController : UIKit.UIInputViewController } } + [Test] + public void RebuildWhenReferenceSymbolsInCode () + { + using (var mtouch = new MTouchTool ()) { + var bindingsLibrary = GetBindingsLibrary (Profile.iOS); + mtouch.References = new string [] { bindingsLibrary }; + mtouch.CreateTemporaryApp_LinkWith (); + mtouch.CreateTemporaryCacheDirectory (); + mtouch.SymbolMode = MTouchSymbolMode.Code; + mtouch.Verbosity = 9; + + // first build + mtouch.AssertExecute (MTouchAction.BuildSim, "build"); + + // first rebuild, no changes + mtouch.AssertExecute (MTouchAction.BuildSim, "build"); + var output = mtouch.Output.ToString (); + Assert.That (output, Does.Not.Contain ("must be rebuilt"), "nothing rebuilt in first rebuild"); + Assert.That (output, Does.Not.Contain ("clang"), "no clang in first rebuild"); + + // second build, touch an assembly + new FileInfo (bindingsLibrary).LastWriteTimeUtc = DateTime.UtcNow; + mtouch.AssertExecute (MTouchAction.BuildSim, "build"); + output = mtouch.Output.ToString (); + Assert.That (output, Does.Contain ("Reloading cached assemblies."), "reloaded cached assemblies"); + // we touched the binding assembly, which means mtouch re-extracted the .a from the binding library, + // which causes clang to execute for the main executable. This is good in this particular case, because + // re-executing clang successfully means we got the clang command line right. + Assert.That (output, Does.Contain ("clang"), "clang in second rebuild"); + } + } + public void XamarinSdkAdjustLibs () { using (var exttool = new MTouchTool ()) { diff --git a/tools/common/Symbols.cs b/tools/common/Symbols.cs index 64299ca12c..83dd7caee1 100644 --- a/tools/common/Symbols.cs +++ b/tools/common/Symbols.cs @@ -27,19 +27,27 @@ namespace Xamarin.Bundler public SymbolType Type; public bool Ignore; + static string ObjectiveCPrefix { + get { + return Driver.SupportsModernObjectiveC ? "OBJC_CLASS_$_" : ".objc_class_name_"; + } + } + string name; public string Name { get { if (name != null) return name; - if (ObjectiveCName != null) { - var prefix = Driver.SupportsModernObjectiveC ? "OBJC_CLASS_$_" : ".objc_class_name_"; - return prefix + ObjectiveCName; - } + if (ObjectiveCName != null) + return ObjectiveCPrefix + ObjectiveCName; throw ErrorHelper.CreateError (99, $"Internal error: symbol without a name (type: {Type}). Please file a bug report with a test case (https://github.com/xamarin/xamarin-macios/issues/new)."); } set { name = value; + if (name.StartsWith (ObjectiveCPrefix, StringComparison.Ordinal)) { + ObjectiveCName = name.Substring (ObjectiveCPrefix.Length); + name = null; + } } } public string ObjectiveCName; From 83718c0b728c599c0b7b38157253a691b19e5f7f Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 25 Jan 2019 17:33:58 +0100 Subject: [PATCH 17/23] [jenkins] Try to give better information when api comparison / generator diff fails. (#5477) --- jenkins/compare.sh | 13 ++++++++++- tools/compare-commits.sh | 49 ++++++++++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/jenkins/compare.sh b/jenkins/compare.sh index 09e1c35d39..9ae9453fab 100755 --- a/jenkins/compare.sh +++ b/jenkins/compare.sh @@ -22,10 +22,19 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.." WORKSPACE=$(pwd) +MARKDOWN_INDENT="    " +echo "*** Comparing API & creating generator diff... ***" +export COMPARE_FAILURE_FILE=$TMPDIR/api-diff-compare-failures.txt report_error () { printf "🔥 [Failed to compare API and create generator diff](%s/console) 🔥\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md" + if test -f "$COMPARE_FAILURE_FILE"; then + sed "s/^/${MARKDOWN_INDENT//&/\\&}/" "$COMPARE_FAILURE_FILE" >> "$WORKSPACE/jenkins/pr-comments.md" + fi + printf "${MARKDOWN_INDENT}Search for \`Comparing API & creating generator diff\` in the log to view the complete log.\\n" >> "$WORKSPACE/jenkins/pr-comments.md" touch "$WORKSPACE/jenkins/failure-stamp" + rm -f "$COMPARE_FAILURE_FILE" + echo "*** Comparing API & creating generator diff failed ***" exit 0 } trap report_error ERR @@ -55,7 +64,7 @@ if ! git rev-parse "$BASE" >/dev/null 2>&1; then exit 0 fi -./tools/compare-commits.sh --base="$BASE^1" +./tools/compare-commits.sh --base="$BASE^1" "--failure-file=$COMPARE_FAILURE_FILE" mkdir -p jenkins-results/apicomparison @@ -89,3 +98,5 @@ else printf "✅ [Generator Diff](%s) (only version changes)" "$URL_GENERATOR" >> "$WORKSPACE/jenkins/pr-comments.md" fi printf "\\n" >> "$WORKSPACE/jenkins/pr-comments.md" + +echo "*** Comparing API & creating generator diff completed ***" diff --git a/tools/compare-commits.sh b/tools/compare-commits.sh index 6485351519..13bed92945 100755 --- a/tools/compare-commits.sh +++ b/tools/compare-commits.sh @@ -16,6 +16,16 @@ if df -t apfs / >/dev/null 2>&1; then CP="cp -c" fi +function report_error_line () +{ + echo "$@" + if test -n "$FAILURE_FILE"; then + # remove color codes when writing to failure file + # shellcheck disable=SC2001 + echo "$@" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' >> "$FAILURE_FILE" + fi +} + function show_help () { echo "$(basename "$0"): Compare the managed API and generate a diff for the generated code between the currently built assemblies and a specific hash." @@ -30,6 +40,7 @@ function show_help () } ORIGINAL_ARGS=("$@") +FAILURE_FILE= while ! test -z "$1"; do case "$1" in --help|-\?|-h) @@ -56,15 +67,23 @@ while ! test -z "$1"; do WORKING_DIR="${1#*=}" shift ;; + --failure-file=*) + FAILURE_FILE="${1#*=}" + shift + ;; + --failure-file) + FAILURE_FILE="$2" + shift 2 + ;; *) - echo "Unknown argument: $1" + echo "Error: Unknown argument: $1" exit 1 ;; esac done if test -z "$BASE_HASH"; then - echo "${RED}It's required to specify the hash to compare against (--base=HASH).${CLEAR}" + report_error_line "${RED}Error: It's required to specify the hash to compare against (--base=HASH).${CLEAR}" exit 1 fi @@ -93,8 +112,8 @@ if test -z "$BUILD_REVISION"; then fi if [ -n "$(git status --porcelain --ignore-submodule)" ]; then - echo "${RED}Working directory isn't clean:${CLEAR}" - git $GIT_COLOR_P status --ignore-submodule | sed 's/^/ /' + report_error_line "${RED}** Error: Working directory isn't clean:${CLEAR}" + git $GIT_COLOR_P status --ignore-submodule | sed 's/^/ /' | while read line; do report_error_line "$line"; done exit 1 fi @@ -174,7 +193,11 @@ git checkout --quiet --force --detach "$BASE_HASH" touch "$OUTPUT_DIR/stamp" echo "${BLUE}Building src/...${CLEAR}" -make -C "$ROOT_DIR/src" BUILD_DIR=../tools/comparison/build PROJECT_DIR="$OUTPUT_DIR/project-files" "IOS_DESTDIR=$OUTPUT_DIR/_ios-build" "MAC_DESTDIR=$OUTPUT_DIR/_mac-build" -j8 +if ! make -C "$ROOT_DIR/src" BUILD_DIR=../tools/comparison/build PROJECT_DIR="$OUTPUT_DIR/project-files" "IOS_DESTDIR=$OUTPUT_DIR/_ios-build" "MAC_DESTDIR=$OUTPUT_DIR/_mac-build" -j8; then + EC=$? + report_error_line "${RED}Failed to build src/${CLEAR}" + exit "$EC" +fi # # API diff @@ -182,12 +205,20 @@ make -C "$ROOT_DIR/src" BUILD_DIR=../tools/comparison/build PROJECT_DIR="$OUTPUT # Calculate apidiff references according to the temporary build echo "${BLUE}Updating apidiff references...${CLEAR}" -make update-refs -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$OUTPUT_DIR/apidiff" IOS_DESTDIR="$OUTPUT_DIR/_ios-build" MAC_DESTDIR="$OUTPUT_DIR/_mac-build" +if ! make update-refs -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$OUTPUT_DIR/apidiff" IOS_DESTDIR="$OUTPUT_DIR/_ios-build" MAC_DESTDIR="$OUTPUT_DIR/_mac-build"; then + EC=$? + report_error_line "${RED}Failed to update apidiff references${CLEAR}" + exit "$EC" +fi # Now compare the current build against those references echo "${BLUE}Running apidiff...${CLEAR}" APIDIFF_FILE=$OUTPUT_DIR/apidiff/api-diff.html -make all-local -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$OUTPUT_DIR/apidiff" +if ! make all-local -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$OUTPUT_DIR/apidiff"; then + EC=$? + report_error_line "${RED}Failed to run apidiff${CLEAR}" + exit "$EC" +fi # # Generator diff @@ -216,7 +247,7 @@ MODIFIED_FILES=$(find \ if test -n "$MODIFIED_FILES"; then # If this list files, it means something's wrong with the build process # (the logic to build/work in a different directory is incomplete/broken) - echo "${RED}The following files were modified, and they shouldn't have been:${CLEAR}" - echo "$MODIFIED_FILES" | sed 's/^/ /' + report_error_line "${RED}** Error: The following files were modified, and they shouldn't have been:${CLEAR}" + echo "$MODIFIED_FILES" | sed 's/^/ /' | while read line; do report_error_line "$line"; done exit 1 fi From 87c77db369eaf782e8cab53fd3bb63b98e4b0d45 Mon Sep 17 00:00:00 2001 From: Ema Date: Fri, 25 Jan 2019 19:21:57 -0300 Subject: [PATCH 18/23] [msbuild] Fixes Microsoft.NET.Build.Extensions.Tasks.dll path Replaces the hardcoded path to Microsoft.NET.Build.Extensions.Tasks.dll by the MicrosoftNETBuildExtensionsTasksAssembly property. The assembly is in a different location in dev16. Also removed the old condition that only applied to VS 2015 and early builds of 2017 where the assembly did not exist. Bug 778800 - Certain iOS projects are failing to build against dev16 seemingly due to a netstandard resolution issue Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/778800 --- msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets index a4a78d3dad..f85ebd3015 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets @@ -162,8 +162,8 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. + Condition="'$(IsXBuild)' != 'true'" + AssemblyFile="$(MicrosoftNETBuildExtensionsTasksAssembly)" /> @@ -189,8 +189,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. If $(_HasReferenceToSystemRuntime) is true, then the facades are going to be expanded anyway, so don't run this. --> From af30117abcdf0d35d3d2ad558efa9bd13b030013 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 28 Jan 2019 15:05:42 +0100 Subject: [PATCH 19/23] [tests] Automatically build the mtouch test assembly when needed. (#5496) --- tests/mtouch/.gitignore | 2 ++ tests/mtouch/Makefile | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/mtouch/.gitignore b/tests/mtouch/.gitignore index d71152c756..e145d600c0 100644 --- a/tests/mtouch/.gitignore +++ b/tests/mtouch/.gitignore @@ -3,3 +3,5 @@ TestResult.xml index.html .failed-stamp test.config +*.csproj.inc + diff --git a/tests/mtouch/Makefile b/tests/mtouch/Makefile index 676a82b0cb..405cc1f494 100644 --- a/tests/mtouch/Makefile +++ b/tests/mtouch/Makefile @@ -19,20 +19,27 @@ all-local:: # or multiple tests: # make run-tests TEST_FIXTURE="-test=Xamarin.MTouch.MT1016,Xamarin.MTouch.MT1017" -run-tests: test.config +run-tests: bin/Debug/mtouch.dll test.config rm -f .failed-stamp - $(SYSTEM_MONO) --debug $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe $(abspath $(TOP)/tests/mtouch/bin/Debug/mtouch.dll) "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All --inprocess || touch $(CURDIR)/.failed-stamp + $(SYSTEM_MONO) --debug $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe "$(abspath $<)" "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All --inprocess || touch $(CURDIR)/.failed-stamp @# Create an html file and tell MonkeyWrench to upload it (if we're running there) @[[ -z "$$BUILD_REPOSITORY" ]] || \ ( xsltproc $(TOP)/tests/HtmlTransform.xslt TestResult.xml > index.html && \ echo "@MonkeyWrench: AddFile: $$PWD/index.html") @[[ ! -e .failed-stamp ]] -build: +# mtouch.csproj.inc contains the mtouch_dependencies variable used to determine if mtouch.dll needs to be rebuilt or not. +mtouch.csproj.inc: $(TOP)/tools/common/create-makefile-fragment.sh Makefile + $(Q_GEN) $< $(CURDIR)/mtouch.csproj +-include mtouch.csproj.inc + +bin/Debug/mtouch.dll: $(mtouch_dependencies) $(Q) $(SYSTEM_MONO) /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore packages.config $(SYSTEM_XIBUILD) -- mtouch.csproj $(XBUILD_VERBOSITY) $(Q) rm -f .failed-stamp +build: bin/Debug/mtouch.dll + test.config: $(TOP)/Make.config Makefile @rm -f $@ @echo "MONOTOUCH_PREFIX=$(MONOTOUCH_PREFIX)" >> $@ From 7f4a1db36fa0544020b73deefbac0ed0b1d5f0c8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 28 Jan 2019 15:06:40 +0100 Subject: [PATCH 20/23] [runtime] Use a single mono profiler for both newrefcount and NSAutoreleasePool thread hooks. (#5495) Additionally don't use malloc'ed memory, to avoid having to free the memory. This fixes a leak, since mono does not free the MonoProfiler argument: STACK OF 1 INSTANCE OF 'ROOT LEAK: <0x7fb94495c460>': [thread 0x10f3f85c0]: 19 libdyld.dylib 0x7fff6e009ed9 start + 1 18 NameNotImportant 0x10592dec4 main + 36 launcher.m:679 17 NameNotImportant 0x10592d039 xamarin_main + 1305 launcher.m:661 16 NameNotImportant 0x105973473 mono_main + 11731 driver.g.c:2484 15 NameNotImportant 0x10597020d mono_jit_exec + 349 driver.g.c:1236 14 NameNotImportant 0x105b4217e mono_runtime_exec_main_checked + 110 object.c:0 13 NameNotImportant 0x105b3af28 mono_runtime_invoke_checked + 136 object.c:2960 12 NameNotImportant 0x105a143a1 mono_jit_runtime_invoke + 513 mini-runtime.c:3011 11 NameNotImportant 0x105a103c1 mono_jit_compile_method_with_opt + 2577 mini-runtime.c:2411 10 NameNotImportant 0x105a21aa7 mono_jit_compile_method_inner + 1207 mini.c:4184 9 NameNotImportant 0x105b3b75f mono_runtime_class_init_full + 847 object.c:527 8 NameNotImportant 0x105b3c9d4 mono_runtime_try_invoke + 148 object.c:2960 7 NameNotImportant 0x105a147d3 mono_jit_runtime_invoke + 1587 mini-runtime.c:3148 6 ??? 0x106d00fb0 0x7fffffffffffffff + 9223372041264041905 5 NameNotImportant 0x105921b0c xamarin_initialize + 812 runtime.m:1412 4 NameNotImportant 0x10591e7e7 xamarin_install_nsautoreleasepool_hooks + 55 shared.m:241 3 NameNotImportant 0x105b4fd0a mono_profiler_install + 26 profiler.c:1019 2 NameNotImportant 0x105c3127b monoeg_malloc0 + 27 gmem.c:121 1 libsystem_malloc.dylib 0x7fff6e1bacba calloc + 30 0 libsystem_malloc.dylib 0x7fff6e1bad62 malloc_zone_calloc + 139 Also remove the call to mono_profiler_set_events, it doesn't do anything anymore ([1]). [1]: https://github.com/mono/mono/blob/14b061ba65815d4580078e93c4f2df77ec84b882/mono/metadata/profiler.c#L1098-L1101 --- runtime/exports.t4 | 4 ---- runtime/runtime.m | 22 +++++++++++++++------- runtime/shared.m | 13 ------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/runtime/exports.t4 b/runtime/exports.t4 index 19b08dc317..487a273af6 100644 --- a/runtime/exports.t4 +++ b/runtime/exports.t4 @@ -196,10 +196,6 @@ #region metadata/profiler.h - new Export ("void", "mono_profiler_set_events", - "MonoProfileFlags", "events" - ), - new Export ("void", "mono_profiler_install", "MonoProfiler *", "prof", "MonoProfileFunc", "shutdown_callback" diff --git a/runtime/runtime.m b/runtime/runtime.m index 6f4911da4c..c8aa46cef2 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -864,10 +864,6 @@ gc_toggleref_callback (MonoObject *object) return res; } -typedef struct { - int dummy; -} NRCProfiler; - static void gc_event_callback (MonoProfiler *prof, MonoGCEvent event, int generation) { @@ -896,12 +892,9 @@ gc_enable_new_refcount (void) pthread_mutex_init (&framework_peer_release_lock, &attr); pthread_mutexattr_destroy (&attr); - NRCProfiler *prof = (NRCProfiler *) malloc (sizeof (NRCProfiler)); - mono_gc_toggleref_register_callback (gc_toggleref_callback); xamarin_add_internal_call (xamarin_use_new_assemblies ? "Foundation.NSObject::RegisterToggleRef" : PRODUCT_COMPAT_NAMESPACE ".Foundation.NSObject::RegisterToggleRef", (const void *) gc_register_toggleref); - mono_profiler_install ((MonoProfiler *) prof, NULL); mono_profiler_install_gc (gc_event_callback, NULL); } @@ -915,6 +908,19 @@ get_class_from_name (MonoImage* image, const char *nmspace, const char *name, bo return rv; } +struct _MonoProfiler { + int dummy; +}; + +static void +xamarin_install_mono_profiler () +{ + static _MonoProfiler profiler = { 0 }; + // This must be done before any other mono_profiler_install_* functions are called + // (currently gc_enable_new_refcount and xamarin_install_nsautoreleasepool_hooks). + mono_profiler_install (&profiler, NULL); +} + bool xamarin_file_exists (const char *path) { @@ -1406,6 +1412,8 @@ xamarin_initialize () if (!register_assembly (assembly, &exception_gchandle)) xamarin_process_managed_exception_gchandle (exception_gchandle); + xamarin_install_mono_profiler (); // must be called before xamarin_install_nsautoreleasepool_hooks or gc_enable_new_refcount + xamarin_install_nsautoreleasepool_hooks (); #if defined (DEBUG) diff --git a/runtime/shared.m b/runtime/shared.m index 3931d7e2ec..4e22e13680 100644 --- a/runtime/shared.m +++ b/runtime/shared.m @@ -162,17 +162,6 @@ xamarin_initialize_cocoa_threads (init_cocoa_func *func) static CFMutableDictionaryRef xamarin_thread_hash = NULL; static pthread_mutex_t thread_hash_lock = PTHREAD_MUTEX_INITIALIZER; -struct _MonoProfiler { - int dummy; -}; - -static MonoProfiler* -create_thread_helper () -{ - // COOP: no managed memory access: any mode. - return (MonoProfiler *)malloc (sizeof (MonoProfiler)); -} - static void xamarin_thread_start (void *user_data) { @@ -238,9 +227,7 @@ xamarin_install_nsautoreleasepool_hooks () // COOP: executed at startup (and no managed memory access): any mode. xamarin_thread_hash = CFDictionaryCreateMutable (kCFAllocatorDefault, 0, NULL, NULL); - mono_profiler_install (create_thread_helper (), NULL); mono_profiler_install_thread (thread_start, thread_end); - mono_profiler_set_events (MONO_PROFILE_THREADS); } /* Threads & Blocks From f2ab1f6daf2417b19e05b4445d9c465a960511ab Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Mon, 28 Jan 2019 10:07:06 -0500 Subject: [PATCH 21/23] [tests] Ignore failing GestureRecognizerTest for now (#5486) - WIP PR https://github.com/xamarin/xamarin-macios/pull/5462 more investigation needed so ignore test which is preventing green builds --- tests/monotouch-test/UIKit/GestureRecognizerTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/monotouch-test/UIKit/GestureRecognizerTest.cs b/tests/monotouch-test/UIKit/GestureRecognizerTest.cs index 9832001cc8..e9b85542c8 100644 --- a/tests/monotouch-test/UIKit/GestureRecognizerTest.cs +++ b/tests/monotouch-test/UIKit/GestureRecognizerTest.cs @@ -40,6 +40,7 @@ namespace MonoTouchFixtures.UIKit { } [Test] + [Ignore ("Issue: https://github.com/xamarin/maccore/issues/1345 && WIP PR: https://github.com/xamarin/xamarin-macios/pull/5462")] public void NoStrongCycles () { bool finalizedAnyCtor = false; From 40c998e264592b8666a0378a53901f822ad33a69 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Mon, 28 Jan 2019 17:47:36 +0100 Subject: [PATCH 22/23] [XHarness] Add XUnit category filtering. (#5455) Provide the ability to filter per categories in the xunit runner and add the default categories for Mac, iOS, TvOS and WatchOS. --- .../common/TestRunner.Core/TestRunner.cs | 1 + .../TestRunner.NUnit/NUnitTestRunner.cs | 48 ++++++++++++------- .../TestRunner.xUnit/XUnitTestRunner.cs | 15 ++++++ .../templates/iOSApp/ViewController.cs | 35 ++++++++++---- .../BCLTests/templates/macOS/MacTestMain.cs | 41 ++++++++++++---- .../templates/tvOSApp/ViewController.cs | 33 ++++++++++--- .../watchOS/Extension/InterfaceController.cs | 31 ++++++++++-- 7 files changed, 159 insertions(+), 45 deletions(-) diff --git a/tests/bcl-test/BCLTests/templates/common/TestRunner.Core/TestRunner.cs b/tests/bcl-test/BCLTests/templates/common/TestRunner.Core/TestRunner.cs index 1c446a0477..eef6641920 100644 --- a/tests/bcl-test/BCLTests/templates/common/TestRunner.Core/TestRunner.cs +++ b/tests/bcl-test/BCLTests/templates/common/TestRunner.Core/TestRunner.cs @@ -34,6 +34,7 @@ namespace Xamarin.iOS.UnitTests public abstract string WriteResultsToFile (); public abstract void WriteResultsToFile (TextWriter writer); public abstract void SkipTests (IEnumerable tests); + public abstract void SkipCategories (IEnumerable categories); protected void OnError (string message) { diff --git a/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs b/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs index 32c05eb8e3..a534f25488 100644 --- a/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs +++ b/tests/bcl-test/BCLTests/templates/common/TestRunner.NUnit/NUnitTestRunner.cs @@ -271,26 +271,42 @@ namespace Xamarin.iOS.UnitTests.NUnit resultsXml.WriteResultFile (results, writer); } + void AppendFilter (ITestFilter filter) + { + if (filter == null) + throw new ArgumentNullException (nameof (filter)); + if (Filter.IsEmpty) { + Filter = filter; + } else { + AndFilter andFilter; + if (Filter is AndFilter) { + // add a new filter + andFilter = Filter as AndFilter; + andFilter.Add (filter); + } else { + andFilter = new AndFilter (Filter); + andFilter.Add (filter); + } + Filter = andFilter; + } + } + public override void SkipTests (IEnumerable tests) { // grab the tests and create a filter for them if (tests.Any ()) { - if (Filter.IsEmpty) { - Filter = new TestMethodFilter (tests); - } else { - // create a special group filter with the previous one - // and the new one - AndFilter andFilter; - if (Filter is AndFilter) { - // add a new filter - andFilter = Filter as AndFilter; - andFilter.Add (new TestMethodFilter (tests)); - } else { - andFilter = new AndFilter (Filter); - andFilter.Add (new TestMethodFilter (tests)); - } - Filter = andFilter; - } + AppendFilter (new TestMethodFilter (tests)); + } + } + + public override void SkipCategories (IEnumerable categories) + { + if (categories.Any ()) { + // build a category expression and trust the nunit lib + var expression = categories.Aggregate ( + (current, next) => current + "," + next); + var categoriesFilter = new NotFilter (new CategoryExpression (expression).Filter); + AppendFilter (categoriesFilter); } } } diff --git a/tests/bcl-test/BCLTests/templates/common/TestRunner.xUnit/XUnitTestRunner.cs b/tests/bcl-test/BCLTests/templates/common/TestRunner.xUnit/XUnitTestRunner.cs index bcec29e039..2792647705 100644 --- a/tests/bcl-test/BCLTests/templates/common/TestRunner.xUnit/XUnitTestRunner.cs +++ b/tests/bcl-test/BCLTests/templates/common/TestRunner.xUnit/XUnitTestRunner.cs @@ -73,6 +73,12 @@ namespace Xamarin.iOS.UnitTests.XUnit messageSink.Execution.TestStartingEvent += (MessageHandlerArgs args) => HandleEvent ("TestStartingEvent", args, HandleTestStarting); } + public void AddFilter (XUnitFilter filter) + { + if (filter != null) { + filters.Add (filter); + } + } public void SetFilters (List newFilters) { if (newFilters == null) { @@ -1015,5 +1021,14 @@ namespace Xamarin.iOS.UnitTests.XUnit } } } + + public override void SkipCategories (IEnumerable categories) + { + if (categories.Any ()) { + foreach (var c in categories) { + filters.Add (XUnitFilter.CreateTraitFilter ("category", c, true)); + } + } + } } } diff --git a/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs b/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs index 9bf6fcbbe0..edbc6c93b2 100644 --- a/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs +++ b/tests/bcl-test/BCLTests/templates/iOSApp/ViewController.cs @@ -75,17 +75,36 @@ namespace BCLTests { var logger = (writer == null || options.EnableXml) ? new LogWriter () : new LogWriter (writer); logger.MinimumLogLevel = MinimumLogLevel.Info; var testAssemblies = GetTestAssemblies (); - Xamarin.iOS.UnitTests.TestRunner runner; - if (RegisterType.IsXUnit) - runner = new XUnitTestRunner (logger); - else { - runner = new NUnitTestRunner (logger) { - // add known ignored categories. - Filter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter) + var runner = RegisterType.IsXUnit ? (Xamarin.iOS.UnitTests.TestRunner) new XUnitTestRunner (logger) : new NUnitTestRunner (logger); + var categories = RegisterType.IsXUnit ? + new List { + "failing", + "nonmonotests", + "outerloop", + "nonosxtests" + } : + new List { + "MobileNotWorking", + "NotOnMac", + "NotWorking", + "ValueAdd", + "CAS", + "InetAccess", + "NotWorkingLinqInterpreter", }; + + if (RegisterType.IsXUnit) { + // special case when we are using the xunit runner, + // there is a trait we are not interested in which is + // the Benchmark one + var xunitRunner = runner as XUnitTestRunner; + xunitRunner.AddFilter (XUnitFilter.CreateTraitFilter ("Benchmark", "true", true)); } - + // add category filters if they have been added + runner.SkipCategories (categories); + + // if we have ignore files, ignore those tests var skippedTests = await IgnoreFileParser.ParseContentFilesAsync (NSBundle.MainBundle.BundlePath); if (skippedTests.Any ()) { // ensure that we skip those tests that have been passed via the ignore files diff --git a/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs b/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs index ee60a3eb66..e1910fb096 100644 --- a/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs +++ b/tests/bcl-test/BCLTests/templates/macOS/MacTestMain.cs @@ -49,21 +49,42 @@ namespace Xamarin.Mac.Tests var logger = new LogWriter (Console.Out); logger.MinimumLogLevel = MinimumLogLevel.Info; var testAssemblies = GetTestAssemblies (); - TestRunner runner; - if (RegisterType.IsXUnit) - runner = new XUnitTestRunner (logger); - else { - runner = new NUnitTestRunner (logger) { - Filter = new NotFilter (new CategoryExpression ("MacNotWorking,MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter) + var runner = RegisterType.IsXUnit ? (TestRunner) new XUnitTestRunner (logger) : new NUnitTestRunner (logger); + var categories = RegisterType.IsXUnit ? + new List { + "failing", + "nonmonotests", + "outerloop", + "nonosxtests" + } : + new List { + "MacNotWorking", + "MobileNotWorking", + "NotOnMac", + "NotWorking", + "ValueAdd", + "CAS", + "InetAccess", + "NotWorkingLinqInterpreter" }; + + if (RegisterType.IsXUnit) { + // special case when we are using the xunit runner, + // there is a trait we are not interested in which is + // the Benchmark one + var xunitRunner = runner as XUnitTestRunner; + xunitRunner.AddFilter (XUnitFilter.CreateTraitFilter ("Benchmark", "true", true)); } + runner.SkipCategories (categories); runner.Run (testAssemblies.ToList ()); - - using (var writer = new StreamWriter(options.ResultFile)) { - runner.WriteResultsToFile (writer); + + if (options.ResultFile != null) { + using (var writer = new StreamWriter (options.ResultFile)) { + runner.WriteResultsToFile (writer); + } + logger.Info ($"Xml result can be found {options.ResultFile}"); } - logger.Info ($"Xml result can be found {options.ResultFile}"); logger.Info ($"Tests run: {runner.TotalTests} Passed: {runner.PassedTests} Inconclusive: {runner.InconclusiveTests} Failed: {runner.FailedTests} Ignored: {runner.SkippedTests}"); return runner.FailedTests != 0 ? 1 : 0; diff --git a/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs b/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs index a4a99f2cc6..350ae411fa 100644 --- a/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs +++ b/tests/bcl-test/BCLTests/templates/tvOSApp/ViewController.cs @@ -73,15 +73,36 @@ namespace BCLTests { var logger = (writer == null || options.EnableXml) ? new LogWriter () : new LogWriter (writer); logger.MinimumLogLevel = MinimumLogLevel.Info; var testAssemblies = GetTestAssemblies (); - Xamarin.iOS.UnitTests.TestRunner runner; - if (RegisterType.IsXUnit) - runner = new XUnitTestRunner (logger); - else { - runner = new NUnitTestRunner (logger) { - Filter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter) + var runner = RegisterType.IsXUnit ? (Xamarin.iOS.UnitTests.TestRunner) new XUnitTestRunner (logger) : new NUnitTestRunner (logger); + var categories = RegisterType.IsXUnit ? + new List { + "failing", + "nonmonotests", + "outerloop", + "nonosxtests" + } : + new List { + "MobileNotWorking", + "NotOnMac", + "NotWorking", + "ValueAdd", + "CAS", + "InetAccess", + "NotWorkingLinqInterpreter", }; + + if (RegisterType.IsXUnit) { + // special case when we are using the xunit runner, + // there is a trait we are not interested in which is + // the Benchmark one + var xunitRunner = runner as XUnitTestRunner; + xunitRunner.AddFilter (XUnitFilter.CreateTraitFilter ("Benchmark", "true", true)); } + // add category filters if they have been added + runner.SkipCategories (categories); + + // if we have ignore files, ignore those tests var skippedTests = await IgnoreFileParser.ParseContentFilesAsync (NSBundle.MainBundle.BundlePath); if (skippedTests.Any ()) { // ensure that we skip those tests that have been passed via the ignore files diff --git a/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs b/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs index 00acc0a214..6f7bc931b5 100644 --- a/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs +++ b/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs @@ -104,14 +104,35 @@ namespace monotouchtestWatchKitExtension var logger = (writer == null || options.EnableXml) ? new LogWriter () : new LogWriter (writer); logger.MinimumLogLevel = MinimumLogLevel.Info; var testAssemblies = GetTestAssemblies (); - if (RegisterType.IsXUnit) - runner = new XUnitTestRunner (logger); - else { - runner = new NUnitTestRunner (logger) { - Filter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter,RequiresBSDSockets").Filter) + runner = RegisterType.IsXUnit ? (Xamarin.iOS.UnitTests.TestRunner) new XUnitTestRunner (logger) : new NUnitTestRunner (logger); + var categories = RegisterType.IsXUnit ? + new List { + "failing", + "nonmonotests", + "outerloop", + "nonosxtests" + } : + new List { + "MobileNotWorking", + "NotOnMac", + "NotWorking", + "ValueAdd", + "CAS", + "InetAccess", + "NotWorkingLinqInterpreter", }; + + if (RegisterType.IsXUnit) { + // special case when we are using the xunit runner, + // there is a trait we are not interested in which is + // the Benchmark one + var xunitRunner = runner as XUnitTestRunner; + xunitRunner.AddFilter (XUnitFilter.CreateTraitFilter ("Benchmark", "true", true)); } + // add category filters if they have been added + runner.SkipCategories (categories); + // if we have ignore files, ignore those tests var skippedTests = IgnoreFileParser.ParseContentFiles (NSBundle.MainBundle.BundlePath); if (skippedTests.Any ()) { // ensure that we skip those tests that have been passed via the ignore files From 742f0df45971ed8837bd65c76e5ad7ada572bd36 Mon Sep 17 00:00:00 2001 From: Alex Soto Date: Wed, 30 Jan 2019 07:21:49 -0500 Subject: [PATCH 23/23] [Appkit] Adds missing ModelAttribute to NSFilePromiseProviderDelegate (#5514) Fixes xamarin/xamarin-macios#5504 --- src/appkit.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/appkit.cs b/src/appkit.cs index f6fc60df77..1eb0fa277e 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -25599,7 +25599,8 @@ namespace AppKit { } [Mac (10,12)] - [Protocol] + [Protocol, Model] + [BaseType (typeof (NSObject))] interface NSFilePromiseProviderDelegate { [Abstract]