From 4d767b3f37f2b5278822ff67e58fc77d27329eb2 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 12 Jan 2023 11:22:21 -0500 Subject: [PATCH 01/60] [BussinessChat] Add nullability to forgotten files. (#17188) --- src/BusinessChat/Enums.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/BusinessChat/Enums.cs b/src/BusinessChat/Enums.cs index 178df62ed1..69c0403d3b 100644 --- a/src/BusinessChat/Enums.cs +++ b/src/BusinessChat/Enums.cs @@ -1,6 +1,8 @@ using ObjCRuntime; using Foundation; +#nullable enable + namespace BusinessChat { [Mac (10, 13, 4), iOS (11, 3)] From cf5bcd57cfde28fe5f22608f7d50b07c5b3640fd Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 12 Jan 2023 11:23:28 -0500 Subject: [PATCH 02/60] [BackgroundTasks] Add nullability to forgotten files. (#17187) --- src/BackgroundTasks/Enums.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/BackgroundTasks/Enums.cs b/src/BackgroundTasks/Enums.cs index ed9ac62cd1..16b8d49b90 100644 --- a/src/BackgroundTasks/Enums.cs +++ b/src/BackgroundTasks/Enums.cs @@ -10,6 +10,8 @@ using System; using Foundation; using ObjCRuntime; +#nullable enable + namespace BackgroundTasks { [TV (13, 0), NoWatch, NoMac, iOS (13, 0)] From 2604a811ba3dea5221e145a628a15e3489fde319 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:37:48 -0500 Subject: [PATCH 03/60] [CloudKit] Add nullability to forgotten file. (#17209) --- src/CloudKit/Enums.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CloudKit/Enums.cs b/src/CloudKit/Enums.cs index d1b7006e5a..72af7b31d4 100644 --- a/src/CloudKit/Enums.cs +++ b/src/CloudKit/Enums.cs @@ -3,6 +3,8 @@ using ObjCRuntime; using Foundation; using System; +#nullable enable + namespace CloudKit { // NSInteger -> CKContainer.h [Watch (3, 0)] From a0591a2fb1fa9e5efd002f92ab618587be98be36 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:38:26 -0500 Subject: [PATCH 04/60] [Contacts] Add nullability to forgotten file. (#17210) --- src/Contacts/CNEnums.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Contacts/CNEnums.cs b/src/Contacts/CNEnums.cs index 6528f30c5d..6838c2aec3 100644 --- a/src/Contacts/CNEnums.cs +++ b/src/Contacts/CNEnums.cs @@ -11,6 +11,8 @@ using System; using ObjCRuntime; using Foundation; +#nullable enable + namespace Contacts { // NSInteger -> CNContact.h From 10df3289a1b430e03e29c44ba52c650690e667c5 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:39:26 -0500 Subject: [PATCH 05/60] [CoreHaptics] Add nullability to forgotten file. (#17211) --- src/CoreHaptics/Enums.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CoreHaptics/Enums.cs b/src/CoreHaptics/Enums.cs index eadd27fb12..e62dcbd845 100644 --- a/src/CoreHaptics/Enums.cs +++ b/src/CoreHaptics/Enums.cs @@ -10,6 +10,8 @@ using System; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreHaptics { [Mac (10, 15), iOS (13, 0), TV (14, 0)] From 4058b5a30e48c2186f967f37ab68ae99aefb2224 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:40:12 -0500 Subject: [PATCH 06/60] [CoreMedia] Add nullability to missing files. (#17213) --- src/CoreMedia/CMEnums.cs | 2 ++ src/CoreMedia/Enums.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/CoreMedia/CMEnums.cs b/src/CoreMedia/CMEnums.cs index 3e894f649f..1d3049b8cc 100644 --- a/src/CoreMedia/CMEnums.cs +++ b/src/CoreMedia/CMEnums.cs @@ -12,6 +12,8 @@ using System.Runtime.InteropServices; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreMedia { // FourCharCode -> CMFormatDescription.h diff --git a/src/CoreMedia/Enums.cs b/src/CoreMedia/Enums.cs index cb20506593..77a4cef893 100644 --- a/src/CoreMedia/Enums.cs +++ b/src/CoreMedia/Enums.cs @@ -3,6 +3,8 @@ using System.Runtime.InteropServices; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreMedia { // keys names got changed at some point, but they all refer to a CMSampleBuffer (there is not CMSample obj) [Watch (6, 0)] From 3cd54e30c119a7302c67e5c2cf215d78dbee0d7b Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:40:51 -0500 Subject: [PATCH 07/60] [ColreLocation] Add nullability to forgotten file and remove dead code. (#17212) --- src/CoreLocation/CLEnums.cs | 2 + src/CoreLocation/CLLocationDistance.cs | 65 -------------------------- src/frameworks.sources | 1 - 3 files changed, 2 insertions(+), 66 deletions(-) delete mode 100644 src/CoreLocation/CLLocationDistance.cs diff --git a/src/CoreLocation/CLEnums.cs b/src/CoreLocation/CLEnums.cs index cd43278d9d..08ac15e299 100644 --- a/src/CoreLocation/CLEnums.cs +++ b/src/CoreLocation/CLEnums.cs @@ -32,6 +32,8 @@ using System; using ObjCRuntime; +#nullable enable + namespace CoreLocation { // NSInteger -> CLError.h diff --git a/src/CoreLocation/CLLocationDistance.cs b/src/CoreLocation/CLLocationDistance.cs deleted file mode 100644 index d1cda7e2e8..0000000000 --- a/src/CoreLocation/CLLocationDistance.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// CLLocationDistance.cs: Type wrapper for CLLocationDistance -// -// Authors: -// Marek Safar (marek.safar@gmail.com) -// -// Copyright 2012-2013, Xamarin, Inc -// -// The class can be either constructed from a string (from user code) -// or from a handle (from iphone-sharp.dll internal calls). This -// delays the creation of the actual managed string until actually -// required -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -// moved to corelocation.cs -#if false - -using System; -using ObjCRuntime; - -namespace CoreLocation { - - public static class CLLocationDistance - { - static double? max_distance; - static double? filter_none; - - public static double MaxDistance { - get { - if (max_distance == null) - max_distance = Dlfcn.GetDouble (Libraries.CoreLocation.Handle, "CLLocationDistanceMax"); - return max_distance.Value; - } - } - - public static double FilterNone { - get { - if (filter_none == null) - filter_none = Dlfcn.GetDouble (Libraries.CoreLocation.Handle, "kCLDistanceFilterNone"); - return filter_none.Value; - } - } - } -} - -#endif diff --git a/src/frameworks.sources b/src/frameworks.sources index 106dd0554e..b9eeb09bef 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -568,7 +568,6 @@ CORELOCATION_API_SOURCES = \ CoreLocation/CLEnums.cs CORELOCATION_CORE_SOURCES = \ - CoreLocation/CLLocationDistance.cs \ CoreLocation/CoreLocation.cs \ CORELOCATION_SOURCES = \ From b83b545633922968849712212169bd46aea55bf2 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:41:35 -0500 Subject: [PATCH 08/60] [CoreMidi] Add nullability to missing files. (#17214) --- src/CoreMidi/MidiCompat.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CoreMidi/MidiCompat.cs b/src/CoreMidi/MidiCompat.cs index d649726494..ae18c76a9a 100644 --- a/src/CoreMidi/MidiCompat.cs +++ b/src/CoreMidi/MidiCompat.cs @@ -5,6 +5,8 @@ using System; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreMidi { #if !COREBUILD public delegate void MidiCIPropertyChangedHandler (MidiCISession session, byte channel, NSData data); @@ -27,7 +29,7 @@ namespace CoreMidi { => throw new NotSupportedException (); [Obsolete ("Empty stub (not a public API).")] - public virtual MidiCIPropertyChangedHandler PropertyChangedCallback { get; set; } + public virtual MidiCIPropertyChangedHandler? PropertyChangedCallback { get; set; } [Obsolete ("Always throws 'NotSupportedException' (not a public API).")] public virtual void SetProperty (NSData inquiry, byte channel, MidiCIPropertyResponseHandler handler) From e8df3e17d5cd42879c6299208d35371d2c13d391 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:41:56 -0500 Subject: [PATCH 09/60] Remove not needed .gitignore. (#17218) --- src/AddressBookUI/.gitignore | 1 - src/AppKit/.gitignore | 1 - src/Foundation/.gitignore | 2 -- src/ObjCRuntime/.gitignore | 1 - src/QTKit/.gitignore | 1 - src/StoreKit/.gitignore | 1 - src/UIKit/.gitignore | 1 - 7 files changed, 8 deletions(-) delete mode 100644 src/AddressBookUI/.gitignore delete mode 100644 src/AppKit/.gitignore delete mode 100644 src/Foundation/.gitignore delete mode 100644 src/ObjCRuntime/.gitignore delete mode 100644 src/QTKit/.gitignore delete mode 100644 src/StoreKit/.gitignore delete mode 100644 src/UIKit/.gitignore diff --git a/src/AddressBookUI/.gitignore b/src/AddressBookUI/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/AddressBookUI/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs diff --git a/src/AppKit/.gitignore b/src/AppKit/.gitignore deleted file mode 100644 index bd99fb0524..0000000000 --- a/src/AppKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.g.cs diff --git a/src/Foundation/.gitignore b/src/Foundation/.gitignore deleted file mode 100644 index d9fb70c58f..0000000000 --- a/src/Foundation/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -/*.g.cs diff --git a/src/ObjCRuntime/.gitignore b/src/ObjCRuntime/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/ObjCRuntime/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs diff --git a/src/QTKit/.gitignore b/src/QTKit/.gitignore deleted file mode 100644 index bd99fb0524..0000000000 --- a/src/QTKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.g.cs diff --git a/src/StoreKit/.gitignore b/src/StoreKit/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/StoreKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs diff --git a/src/UIKit/.gitignore b/src/UIKit/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/UIKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs From f96001b93481c277e3763a1db8e9f4371f33ea99 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 00:42:19 -0500 Subject: [PATCH 10/60] [CoreTelephony] Add nullability to missing file. (#17217) --- src/CoreTelephony/CTEnums.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CoreTelephony/CTEnums.cs b/src/CoreTelephony/CTEnums.cs index d45223ba7c..b639438cd4 100644 --- a/src/CoreTelephony/CTEnums.cs +++ b/src/CoreTelephony/CTEnums.cs @@ -1,6 +1,8 @@ using ObjCRuntime; using System; +#nullable enable + namespace CoreTelephony { // untyped enum -> CoreTelephonyDefines.h From 37376d3b1a9ee2ad3818bdb8b9ce239b6d5a6f3c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 Jan 2023 12:23:28 +0100 Subject: [PATCH 11/60] [main] Update dependencies from dotnet/runtime (#17202) This pull request updates the following dependencies ## From https://github.com/dotnet/runtime - **Subscription**: 38d2313f-22d5-4062-c8e1-08dabd6d8c77 - **Build**: 20230111.13 - **Date Produced**: January 12, 2023 7:38:25 AM UTC - **Commit**: f5f9a7054e459a8c03fbbcc736d64fcba817b697 - **Branch**: refs/heads/release/7.0 - **Updates**: - **Microsoft.NETCore.App.Ref**: [from 7.0.3 to 7.0.3][1] [1]: https://github.com/dotnet/runtime/compare/2f7c3f4...f5f9a70 --- NuGet.config | 2 +- eng/Version.Details.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index 97316ed83f..e671b18409 100644 --- a/NuGet.config +++ b/NuGet.config @@ -15,7 +15,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c09a5ddda4..e4992ced9d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -10,7 +10,7 @@ https://github.com/dotnet/runtime - 2f7c3f4a4f4a49362055d45751756eb4224c7414 + f5f9a7054e459a8c03fbbcc736d64fcba817b697 From 53d47fb8939ecf4b05ff23e4c883d80851b328f8 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 07:38:42 -0500 Subject: [PATCH 12/60] [FileProvider] Add nullability to forgotten file. (#17219) --- src/FileProvider/Compat.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/FileProvider/Compat.cs b/src/FileProvider/Compat.cs index eb1a386537..dcc89d6c90 100644 --- a/src/FileProvider/Compat.cs +++ b/src/FileProvider/Compat.cs @@ -3,6 +3,8 @@ using System; using ObjCRuntime; +#nullable enable + namespace FileProvider { #if MONOMAC From b6a896e78577536f81ef19f197770bfc8d3b3296 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 13 Jan 2023 11:31:23 -0500 Subject: [PATCH 13/60] [CFNetwork] Add nullability to forgotten files. (#17208) Add nullability to the files. Although this files won't be present in the new dotnet versions, it is good to add them for classic. Also, if we move all files to have nullability enabled we should be able to pass it as a flag and remove the need to use '#nullable enable' which people can forget. --- src/CFNetwork/CFHTTPMessage.cs | 2 +- src/CFNetwork/Content.cs | 6 +- src/CFNetwork/MessageHandler.cs | 75 +++++++++--------- src/CFNetwork/WebRequestStream.cs | 6 +- src/CFNetwork/WebResponseStream.cs | 118 +++++++++++++++-------------- src/CFNetwork/WorkerThread.cs | 47 ++++++------ 6 files changed, 133 insertions(+), 121 deletions(-) diff --git a/src/CFNetwork/CFHTTPMessage.cs b/src/CFNetwork/CFHTTPMessage.cs index 4154932066..b0bf3a5326 100644 --- a/src/CFNetwork/CFHTTPMessage.cs +++ b/src/CFNetwork/CFHTTPMessage.cs @@ -257,7 +257,7 @@ namespace CoreServices { /* CFHTTPAuthenticationRef */ IntPtr auth, /* CFString */ IntPtr username, /* CFString */ IntPtr password, /* CFStreamError* */ out CFStreamError error); - public void ApplyCredentials (CFHTTPAuthentication auth, NetworkCredential credential) + public void ApplyCredentials (CFHTTPAuthentication? auth, NetworkCredential credential) { if (auth is null) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (auth)); diff --git a/src/CFNetwork/Content.cs b/src/CFNetwork/Content.cs index 1ad7798d65..8c98ef2108 100644 --- a/src/CFNetwork/Content.cs +++ b/src/CFNetwork/Content.cs @@ -37,6 +37,8 @@ using System.Net.Http.Headers; using System.Threading.Tasks; using Foundation; +#nullable enable + namespace CFNetwork { class Content : StreamContent { @@ -61,9 +63,7 @@ namespace CFNetwork { protected override void Dispose (bool disposing) { if (disposing) { - if (responseStream != null) - responseStream.Dispose (); - responseStream = null; + responseStream.Dispose (); } } diff --git a/src/CFNetwork/MessageHandler.cs b/src/CFNetwork/MessageHandler.cs index 2e26aca665..afaebc9ae0 100644 --- a/src/CFNetwork/MessageHandler.cs +++ b/src/CFNetwork/MessageHandler.cs @@ -41,6 +41,8 @@ using CoreFoundation; using CoreServices; using Foundation; +#nullable enable + namespace CFNetwork { [Obsolete ("Use 'System.Net.Http.CFNetworkHandler' or the more recent 'Foundation.NSUrlSessionHandler' instead.")] @@ -54,7 +56,7 @@ namespace CFNetwork { WorkerThread = worker; } - public WorkerThread WorkerThread { + public WorkerThread? WorkerThread { get; private set; } @@ -77,7 +79,7 @@ namespace CFNetwork { * request. * */ - CFHTTPAuthentication auth; + CFHTTPAuthentication? auth; #region implemented abstract members of HttpMessageHandler #if MONOMAC && !NET @@ -121,15 +123,15 @@ namespace CFNetwork { void SetupRequest (HttpRequestMessage request, CFHTTPMessage message, bool isFirstRequest) { - string accept_encoding = null; + string? accept_encoding = null; if ((AutomaticDecompression & DecompressionMethods.GZip) != 0) accept_encoding = "gzip"; if ((AutomaticDecompression & DecompressionMethods.Deflate) != 0) - accept_encoding = accept_encoding != null ? "gzip, deflate" : "deflate"; - if (accept_encoding != null) + accept_encoding = accept_encoding is not null ? "gzip, deflate" : "deflate"; + if (accept_encoding is not null) message.SetHeaderFieldValue ("Accept-Encoding", accept_encoding); - if (request.Content != null) { + if (request.Content is not null) { foreach (var header in request.Content.Headers) { if (!isFirstRequest && header.Key == "Authorization") continue; @@ -139,23 +141,23 @@ namespace CFNetwork { } foreach (var header in request.Headers) { - if ((accept_encoding != null) && header.Key.Equals ("Accept-Encoding")) + if ((accept_encoding is not null) && header.Key.Equals ("Accept-Encoding")) continue; var value = string.Join (",", header.Value); message.SetHeaderFieldValue (header.Key, value); } - if (UseCookies && (CookieContainer != null)) { + if (UseCookies && (CookieContainer is not null)) { string cookieHeader = CookieContainer.GetCookieHeader (request.RequestUri); if (cookieHeader != "") message.SetHeaderFieldValue ("Cookie", cookieHeader); } } - async Task CreateBody (HttpRequestMessage request, CFHTTPMessage message, + async Task CreateBody (HttpRequestMessage request, CFHTTPMessage message, CancellationToken cancellationToken) { - if (request.Content == null) + if (request.Content is null) return null; /* @@ -174,7 +176,7 @@ namespace CFNetwork { * */ var length = request.Content.Headers.ContentLength; - if ((request.Content is StreamContent) || (length == null)) { + if ((request.Content is StreamContent) || (length is null)) { var stream = await request.Content.ReadAsStreamAsync ().ConfigureAwait (false); return new WebRequestStream (stream, cancellationToken); } @@ -210,31 +212,33 @@ namespace CFNetwork { async Task ProcessRequest (HttpRequestMessage request, CFHTTPMessage message, - WebRequestStream body, + WebRequestStream? body, bool retryWithCredentials, CancellationToken cancellationToken, bool isFirstRequest) { cancellationToken.ThrowIfCancellationRequested (); - WebResponseStream stream; - if (body != null) + WebResponseStream? stream; + if (body is not null) stream = WebResponseStream.Create (message, body); else stream = WebResponseStream.Create (message); - if (stream == null) + if (stream is null) throw new HttpRequestException (string.Format ( "Failed to create web request for '{0}'.", request.RequestUri) ); - if (!isFirstRequest) - stream.Stream.ShouldAutoredirect = AllowAutoRedirect; - stream.Stream.AttemptPersistentConnection = GetKeepAlive (request); + if (stream.Stream is not null) { + if (!isFirstRequest) + stream.Stream.ShouldAutoredirect = AllowAutoRedirect; + stream.Stream.AttemptPersistentConnection = GetKeepAlive (request); + } var response = await stream.Open ( - WorkerThread, cancellationToken).ConfigureAwait (true); // with false, we will have a deadlock. + WorkerThread!, cancellationToken).ConfigureAwait (true); // with false, we will have a deadlock. - var status = (HttpStatusCode) response.ResponseStatusCode; + var status = (HttpStatusCode) response!.ResponseStatusCode; if (IsRedirect (status)) { request.Headers.Authorization = null; @@ -247,7 +251,7 @@ namespace CFNetwork { } } - if (retryWithCredentials && (body == null) && + if (retryWithCredentials && (body is null) && (status == HttpStatusCode.Unauthorized) || (status == HttpStatusCode.ProxyAuthenticationRequired)) { if (HandleAuthentication (request.RequestUri, message, response)) { @@ -274,7 +278,7 @@ namespace CFNetwork { return retval; } - string GetReasonPhrase (CFHTTPMessage response) + string? GetReasonPhrase (CFHTTPMessage response) { var line = response.ResponseStatusLine; var match = Regex.Match (line, "HTTP/1.(0|1) (\\d+) (.*)"); @@ -286,7 +290,7 @@ namespace CFNetwork { bool HandleAuthentication (Uri uri, CFHTTPMessage request, CFHTTPMessage response) { - if (Credentials == null) + if (Credentials is null) return false; if (PreAuthenticate) { @@ -298,10 +302,10 @@ namespace CFNetwork { var digest = Credentials.GetCredential (uri, "Digest"); bool ok = false; - if ((basic != null) && (digest == null)) + if ((basic is not null) && (digest is null)) ok = HandleAuthentication ( request, response, CFHTTPMessage.AuthenticationScheme.Basic, basic); - if ((digest != null) && (basic == null)) + if ((digest is not null) && (basic is null)) ok = HandleAuthentication ( request, response, CFHTTPMessage.AuthenticationScheme.Digest, digest); if (ok) @@ -313,9 +317,9 @@ namespace CFNetwork { bool HandlePreAuthentication (Uri uri, CFHTTPMessage message) { - var method = auth.GetMethod (); + var method = auth?.GetMethod (); var credential = Credentials.GetCredential (uri, method); - if (credential == null) + if (credential is null) return false; message.ApplyCredentials (auth, credential); @@ -335,16 +339,16 @@ namespace CFNetwork { void FindAuthenticationObject (CFHTTPMessage response) { - if (auth != null) { + if (auth is not null) { if (auth.IsValid) return; auth.Dispose (); auth = null; } - if (auth == null) { + if (auth is null) { auth = CFHTTPAuthentication.CreateFromResponse (response); - if (auth == null) + if (auth is null) throw new HttpRequestException ("Failed to create CFHTTPAuthentication"); } @@ -354,10 +358,11 @@ namespace CFNetwork { void DecodeHeaders (CFHTTPMessage message, HttpResponseMessage response, Content content) { - using (var dict = message.GetAllHeaderFields ()) { - foreach (var entry in dict) { - DecodeHeader (response, content, entry); - } + using var dict = message.GetAllHeaderFields (); + if (dict is null) + return; + foreach (var entry in dict) { + DecodeHeader (response, content, entry); } } @@ -388,7 +393,7 @@ namespace CFNetwork { protected override void Dispose (bool disposing) { if (disposing) { - if (auth != null) { + if (auth is not null) { auth.Dispose (); auth = null; } diff --git a/src/CFNetwork/WebRequestStream.cs b/src/CFNetwork/WebRequestStream.cs index 219f2247e2..8bc16ba0d2 100644 --- a/src/CFNetwork/WebRequestStream.cs +++ b/src/CFNetwork/WebRequestStream.cs @@ -37,13 +37,15 @@ using CoreFoundation; using CoreServices; using Foundation; +#nullable enable + namespace CFNetwork { class WebRequestStream { Stream stream; CFReadStream readStream; CFWriteStream writeStream; - TaskCompletionSource openTcs; + TaskCompletionSource openTcs; CancellationTokenSource cts; byte [] buffer; @@ -61,7 +63,7 @@ namespace CFNetwork { buffer = new byte [BufferSize]; cts = CancellationTokenSource.CreateLinkedTokenSource (cancellationToken); - openTcs = new TaskCompletionSource (); + openTcs = new TaskCompletionSource (); cts.Token.Register (() => Close ()); diff --git a/src/CFNetwork/WebResponseStream.cs b/src/CFNetwork/WebResponseStream.cs index 04e1dc7cc2..e0582f73fe 100644 --- a/src/CFNetwork/WebResponseStream.cs +++ b/src/CFNetwork/WebResponseStream.cs @@ -39,6 +39,8 @@ using CoreServices; using Foundation; using CFNetwork; +#nullable enable + namespace CFNetwork { /* * For optimal performance and reliability, either only access the @@ -51,55 +53,55 @@ namespace CFNetwork { */ class WebResponseStream : Stream, IDisposable { - CFHTTPStream stream; - WorkerThread worker; - WebRequestStream body; - CancellationTokenSource openCts; - TaskCompletionSource openTcs; - IOperation currentOperation; + CFHTTPStream? stream; + WorkerThread? worker; + WebRequestStream? body; + CancellationTokenSource? openCts; + TaskCompletionSource? openTcs; + IOperation? currentOperation; bool bytesAvailable; bool busy; - Thread mainThread; - Thread workerThread; + Thread? mainThread; + Thread? workerThread; volatile bool crossThreadAccess; object syncRoot; bool open; bool canceled; bool completed; - Exception lastError; + Exception? lastError; - WebResponseStream (CFHTTPStream stream, WebRequestStream body) + WebResponseStream (CFHTTPStream stream, WebRequestStream? body) { this.stream = stream; this.body = body; syncRoot = new object (); } - public static WebResponseStream Create (CFHTTPMessage request) + public static WebResponseStream? Create (CFHTTPMessage request) { var stream = CFStream.CreateForHTTPRequest (request); - if (stream == null) + if (stream is null) return null; return new WebResponseStream (stream, null); } - public static WebResponseStream Create (CFHTTPMessage request, WebRequestStream body) + public static WebResponseStream? Create (CFHTTPMessage request, WebRequestStream body) { var stream = CFStream.CreateForStreamedHTTPRequest (request, body.ReadStream); - if (stream == null) + if (stream is null) return null; return new WebResponseStream (stream, body); } - public static WebResponseStream Create (Uri uri, HttpMethod method, Version version) + public static WebResponseStream? Create (Uri uri, HttpMethod method, Version version) { using (var req = CFHTTPMessage.CreateRequest (uri, method.Method, version)) return Create (req); } - public CFHTTPStream Stream { + public CFHTTPStream? Stream { get { return stream; } } @@ -112,11 +114,11 @@ namespace CFNetwork { { if (disposing) { OnCanceled (); - if (stream != null) { + if (stream is not null) { stream.Dispose (); stream = null; } - if (openCts != null) { + if (openCts is not null) { openCts.Dispose (); openCts = null; } @@ -124,9 +126,9 @@ namespace CFNetwork { base.Dispose (disposing); } - void OnError (Exception error) + void OnError (Exception? error) { - if (error == null) + if (error is null) error = new InvalidOperationException ("Unknown error."); if (completed) @@ -134,13 +136,13 @@ namespace CFNetwork { lastError = error; completed = true; - stream.Close (); + stream?.Close (); if (!open) - openTcs.SetException (error); + openTcs?.SetException (error); var operation = Interlocked.Exchange (ref currentOperation, null); - if (operation != null) + if (operation is not null) operation.SetException (error); } @@ -150,13 +152,13 @@ namespace CFNetwork { return; completed = canceled = true; - stream.Close (); + stream?.Close (); if (!open) - openTcs.SetCanceled (); + openTcs?.SetCanceled (); var operation = Interlocked.Exchange (ref currentOperation, null); - if (operation != null) + if (operation is not null) operation.SetCanceled (); } @@ -166,15 +168,15 @@ namespace CFNetwork { return; completed = true; - stream.Close (); + stream?.Close (); if (!open) { - openTcs.SetException (new InvalidOperationException ()); + openTcs?.SetException (new InvalidOperationException ()); return; } var operation = Interlocked.Exchange (ref currentOperation, null); - if (operation != null) + if (operation is not null) operation.SetCompleted (); } @@ -194,14 +196,14 @@ namespace CFNetwork { { bool isCrossThread; lock (syncRoot) { - if (!open || (currentOperation != null)) + if (!open || (currentOperation is not null)) throw new InvalidOperationException (); if (canceled) { operation.SetCanceled (); return; } - if (lastError != null) { + if (lastError is not null) { operation.SetException (lastError); return; } @@ -225,7 +227,7 @@ namespace CFNetwork { * don't have to worry about any locking or anything. * */ - if ((worker != null) && !Thread.CurrentThread.Equals (workerThread)) { + if ((worker is not null) && !Thread.CurrentThread.Equals (workerThread)) { worker.Post (() => { if (bytesAvailable) OnBytesAvailable (false); @@ -278,7 +280,7 @@ namespace CFNetwork { * */ if (!crossThreadAccess) { - if ((currentOperation == null) || busy) { + if ((currentOperation is null) || busy) { bytesAvailable = true; return; } @@ -296,7 +298,7 @@ namespace CFNetwork { Monitor.Enter (syncRoot); - if ((currentOperation == null) || busy) { + if ((currentOperation is null) || busy) { bytesAvailable = true; Monitor.Exit (syncRoot); return; @@ -331,11 +333,11 @@ namespace CFNetwork { async Task ReadFromServer (bool exitContext) { int index, count; - var buffer = currentOperation.GetBuffer (out index, out count); + var buffer = currentOperation!.GetBuffer (out index, out count); nint ret; try { - ret = stream.Read (buffer, index, count); + ret = stream!.Read (buffer, index, count); } catch (Exception ex) { OnError (ex); return false; @@ -348,7 +350,7 @@ namespace CFNetwork { */ if (ret < 0) { - OnError (stream.GetError ()); + OnError (stream?.GetError ()); return false; } else if (ret == 0) { OnCompleted (); @@ -385,8 +387,8 @@ namespace CFNetwork { if (keepGoing) return true; - var operation = Interlocked.Exchange (ref currentOperation, null); - operation.SetCompleted (); + var operation = Interlocked.Exchange (ref currentOperation, null); + operation?.SetCompleted (); return false; } @@ -407,8 +409,8 @@ namespace CFNetwork { } abstract class Operation : IOperation, IDisposable { - CancellationTokenSource cts; - TaskCompletionSource tcs; + CancellationTokenSource? cts; + TaskCompletionSource tcs; bool completed; protected Operation (WebResponseStream parent, @@ -417,10 +419,10 @@ namespace CFNetwork { cts = CancellationTokenSource.CreateLinkedTokenSource ( cancellationToken); cts.Token.Register (() => parent.OnCanceled ()); - tcs = new TaskCompletionSource (); + tcs = new TaskCompletionSource (); } - public Task Task { + public Task Task { get { return tcs.Task; } } @@ -428,12 +430,12 @@ namespace CFNetwork { get { return completed; } } - protected TaskCompletionSource TaskCompletionSource { + protected TaskCompletionSource TaskCompletionSource { get { return tcs; } } - protected CancellationToken CancellationToken { - get { return cts.Token; } + protected CancellationToken? CancellationToken { + get { return cts?.Token; } } public void SetCanceled () @@ -481,7 +483,7 @@ namespace CFNetwork { { if (disposing) { SetCanceled (); - if (cts != null) { + if (cts is not null) { cts.Dispose (); cts = null; } @@ -511,7 +513,7 @@ namespace CFNetwork { public override async Task Write (int count) { - await destination.WriteAsync (buffer, 0, count, CancellationToken); + await destination.WriteAsync (buffer, 0, count, CancellationToken ?? System.Threading.CancellationToken.None); return true; } @@ -558,11 +560,11 @@ namespace CFNetwork { } } - public async Task Open (WorkerThread worker, + public async Task Open (WorkerThread worker, CancellationToken cancellationToken) { this.worker = worker; - openTcs = new TaskCompletionSource (); + openTcs = new TaskCompletionSource (); openCts = CancellationTokenSource.CreateLinkedTokenSource (cancellationToken); openCts.Token.Register (() => OnCanceled ()); @@ -570,7 +572,7 @@ namespace CFNetwork { mainThread = Thread.CurrentThread; try { - if (worker != null) + if (worker is not null) await worker.Post (c => DoOpen (), openCts.Token); else DoOpen (); @@ -584,8 +586,8 @@ namespace CFNetwork { void DoOpen () { - if (lastError != null) { - openTcs.SetException (lastError); + if (lastError is not null) { + openTcs!.SetException (lastError); return; } @@ -595,26 +597,26 @@ namespace CFNetwork { * */ - stream.ErrorEvent += (sender, e) => { - OnError (stream.GetError ()); + stream!.ErrorEvent += (sender, e) => { + OnError (stream!.GetError ()); }; stream.ClosedEvent += (sender, e) => { if (!open) { open = true; - openTcs.SetResult (stream.GetResponseHeader ()); + openTcs!.SetResult (stream.GetResponseHeader ()); } OnCompleted (); }; stream.HasBytesAvailableEvent += (sender, e) => { if (!open) { open = true; - openTcs.SetResult (stream.GetResponseHeader ()); + openTcs!.SetResult (stream.GetResponseHeader ()); } HasBytesAvailable (); }; stream.OpenCompletedEvent += (sender, e) => { - if (body == null) + if (body is null) return; body.Open (); }; diff --git a/src/CFNetwork/WorkerThread.cs b/src/CFNetwork/WorkerThread.cs index 5eeed2173e..82929bcae8 100644 --- a/src/CFNetwork/WorkerThread.cs +++ b/src/CFNetwork/WorkerThread.cs @@ -38,14 +38,16 @@ using System.Diagnostics; using Foundation; using CoreFoundation; +#nullable enable + using CFRunLoopModeString = global::Foundation.NSString; namespace CFNetwork { public class WorkerThread { - CFRunLoop loop; - Source source; - Context context; + CFRunLoop? loop; + Source? source; + Context? context; CancellationTokenSource cts; ManualResetEventSlim readyEvent; ConcurrentQueue eventQueue = new ConcurrentQueue (); @@ -88,8 +90,9 @@ namespace CFNetwork { public void Stop () { cts.Cancel (); - loop.RemoveSource (source, CFRunLoop.ModeDefault); - loop.Stop (); + if (source is not null) + loop?.RemoveSource (source, CFRunLoop.ModeDefault); + loop?.Stop (); } protected void PostNoResult (Action callback) @@ -100,8 +103,8 @@ namespace CFNetwork { return null; }; eventQueue.Enqueue (ev); - source.Signal (); - loop.WakeUp (); + source?.Signal (); + loop?.WakeUp (); } public Task Post (Action callback) @@ -116,11 +119,11 @@ namespace CFNetwork { callback (c); return null; }; - ev.Tcs = new TaskCompletionSource (); + ev.Tcs = new TaskCompletionSource (); ev.Cts = CancellationTokenSource.CreateLinkedTokenSource (cts.Token, cancellationToken); eventQueue.Enqueue (ev); - source.Signal (); - loop.WakeUp (); + source?.Signal (); + loop?.WakeUp (); try { await ev.Tcs.Task; @@ -129,25 +132,25 @@ namespace CFNetwork { } } - public Task Post (Func callback) + public Task Post (Func callback) { return Post (c => callback (), CancellationToken.None); } - public async Task Post (Func callback, + public async Task Post (Func callback, CancellationToken cancellationToken) { var ev = new Event (); ev.Callback = c => callback (c); - ev.Tcs = new TaskCompletionSource (); + ev.Tcs = new TaskCompletionSource (); ev.Cts = CancellationTokenSource.CreateLinkedTokenSource (cts.Token, cancellationToken); eventQueue.Enqueue (ev); - source.Signal (); - loop.WakeUp (); + source?.Signal (); + loop?.WakeUp (); try { var result = await ev.Tcs.Task; - if (result != null) + if (result is not null) return (T) result; else return default (T); @@ -162,7 +165,7 @@ namespace CFNetwork { if (!eventQueue.TryDequeue (out ev)) return; - if ((ev.Cts != null) && ev.Cts.IsCancellationRequested) { + if ((ev.Cts is not null) && ev.Cts.IsCancellationRequested) { ev.Tcs.SetCanceled (); return; } @@ -171,20 +174,20 @@ namespace CFNetwork { try { var result = ev.Callback (effectiveCts.Token); - if (ev.Tcs != null) + if (ev.Tcs is not null) ev.Tcs.SetResult (result); } catch (TaskCanceledException) { - if (ev.Tcs != null) + if (ev.Tcs is not null) ev.Tcs.SetCanceled (); } catch (Exception ex) { - if (ev.Tcs != null) + if (ev.Tcs is not null) ev.Tcs.SetException (ex); } } struct Event { - public Func Callback; - public TaskCompletionSource Tcs; + public Func Callback; + public TaskCompletionSource Tcs; public CancellationTokenSource Cts; } From 480a6ed8447eaa4ede07b6990fcdfb5665023f46 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 13 Jan 2023 21:58:34 +0100 Subject: [PATCH 14/60] [src/runtime] Fix lookup of RID-specific satellite resources. Fixes #16847. (#17117) If we're creating a universal app, and here are satellite assemblies that are not identical across all RuntimeIdentifiers, those assemblies will be stored in a RuntimeIdentifier-specific subdirectory during the build. Unfortunately we didn't know how to find those assemblies at runtime, causing localizations in universal apps to not work. This change will: * Add support for looking in the directory where RID-specific satellite assemblies are stored. * Add an assembly resolution event handler to our CoreCLR bridge so that we can execute our custom lookup code. * Add an assembly resource lookup test to monotouch-test. * Add a macOS + Mac Catalyst variation of monotouch-test to xharness that triggers the bug (a universal test app). Fixes https://github.com/xamarin/xamarin-macios/issues/16847. --- runtime/runtime.m | 10 ++ src/Makefile | 1 + src/ObjCRuntime/Runtime.CoreCLR.cs | 28 ++++ src/ObjCRuntime/TransientString.cs | 13 +- .../ObjCRuntime/ResourcesTest.cs | 41 ++++++ .../monotouch-test/Resources/Welcome.de.resx | 123 ++++++++++++++++++ .../Resources/Welcome.en-AU.resx | 123 ++++++++++++++++++ .../monotouch-test/Resources/Welcome.es.resx | 123 ++++++++++++++++++ tests/monotouch-test/Resources/Welcome.resx | 123 ++++++++++++++++++ tests/monotouch-test/dotnet/shared.csproj | 12 ++ tests/monotouch-test/monotouch-test.csproj | 12 ++ tests/xammac_tests/xammac_tests.csproj | 12 ++ .../xharness/Jenkins/TestVariationsFactory.cs | 7 +- 13 files changed, 626 insertions(+), 2 deletions(-) create mode 100644 tests/monotouch-test/ObjCRuntime/ResourcesTest.cs create mode 100755 tests/monotouch-test/Resources/Welcome.de.resx create mode 100755 tests/monotouch-test/Resources/Welcome.en-AU.resx create mode 100755 tests/monotouch-test/Resources/Welcome.es.resx create mode 100755 tests/monotouch-test/Resources/Welcome.resx diff --git a/runtime/runtime.m b/runtime/runtime.m index e83c64b015..d063c23d5c 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -2830,6 +2830,16 @@ xamarin_locate_assembly_resource_for_root (const char *root, const char *culture } else if (xamarin_file_exists (path)) { return true; } + + if (culture != NULL && *culture != 0) { + // culture-specific directory + if (snprintf (path, pathlen, "%s/%s/.xamarin/%s/%s", root, culture, RUNTIMEIDENTIFIER, resource) < 0) { + LOG (PRODUCT ": Failed to construct path for assembly resource (root directory: '%s', culture: '%s', resource: '%s', runtimeidentifier: %s): %s", root, culture, resource, RUNTIMEIDENTIFIER, strerror (errno)); + return false; + } else if (xamarin_file_exists (path)) { + return true; + } + } #endif // just the file, no extensions, etc. diff --git a/src/Makefile b/src/Makefile index 65181ba941..264e7dd3fb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -72,6 +72,7 @@ DOTNET_REFERENCES = \ /r:$(DOTNET_BCL_DIR)/System.Runtime.CompilerServices.Unsafe.dll \ /r:$(DOTNET_BCL_DIR)/System.Runtime.Extensions.dll \ /r:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll \ + /r:$(DOTNET_BCL_DIR)/System.Runtime.Loader.dll \ /r:$(DOTNET_BCL_DIR)/System.Security.Cryptography.dll \ /r:$(DOTNET_BCL_DIR)/System.Security.Cryptography.X509Certificates.dll \ /r:$(DOTNET_BCL_DIR)/System.Text.RegularExpressions.dll \ diff --git a/src/ObjCRuntime/Runtime.CoreCLR.cs b/src/ObjCRuntime/Runtime.CoreCLR.cs index b2edefa14d..4d77311135 100644 --- a/src/ObjCRuntime/Runtime.CoreCLR.cs +++ b/src/ObjCRuntime/Runtime.CoreCLR.cs @@ -30,6 +30,7 @@ using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ObjectiveC; +using System.Runtime.Loader; using System.Text; using Foundation; @@ -142,6 +143,33 @@ namespace ObjCRuntime { delegate* unmanaged isReferencedCallback = (delegate* unmanaged) options->reference_tracking_is_referenced_callback; delegate* unmanaged trackedObjectEnteredFinalization = (delegate* unmanaged) options->reference_tracking_tracked_object_entered_finalization; ObjectiveCMarshal.Initialize (beginEndCallback, isReferencedCallback, trackedObjectEnteredFinalization, UnhandledExceptionPropagationHandler); + + AssemblyLoadContext.Default.Resolving += ResolvingEventHandler; + } + + [DllImport ("__Internal")] + static extern byte xamarin_locate_assembly_resource (IntPtr assembly_name, IntPtr culture, IntPtr resource, IntPtr path, nint pathlen); + + static bool xamarin_locate_assembly_resource (string assembly_name, string? culture, string resource, [NotNullWhen (true)] out string? path) + { + path = null; + + const int path_size = 1024; + using var assembly_name_ptr = new TransientString (assembly_name); + using var culture_ptr = new TransientString (culture); + using var resource_ptr = new TransientString (resource); + using var path_ptr = new TransientString (path_size); + var rv = xamarin_locate_assembly_resource (assembly_name_ptr, culture_ptr, resource_ptr, path_ptr, path_size) != 0; + if (rv) + path = (string?) path_ptr; + return path is not null; + } + + static Assembly? ResolvingEventHandler (AssemblyLoadContext sender, AssemblyName assemblyName) + { + if (xamarin_locate_assembly_resource (assemblyName.Name!, assemblyName.CultureName, assemblyName.Name + ".dll", out var path)) + return sender.LoadFromAssemblyPath (path); + return null; } static unsafe delegate* unmanaged UnhandledExceptionPropagationHandler (Exception exception, RuntimeMethodHandle lastMethod, out IntPtr context) diff --git a/src/ObjCRuntime/TransientString.cs b/src/ObjCRuntime/TransientString.cs index 04df0f790b..56382b8b1b 100644 --- a/src/ObjCRuntime/TransientString.cs +++ b/src/ObjCRuntime/TransientString.cs @@ -11,6 +11,13 @@ namespace ObjCRuntime { // // If SomePInvoke doesn't make a copy, this is not the right tool // for you. + // + // It can also allocate a chunk of memory to be used as a parameter + // for a method that will write a string to a pointer: + // using var outstr = new NativeString (255); // 255 bytes of memory + // SomePInvoke (outstr); + // var str = (string) outstr; // convert the returned native string + // to a managed string. internal struct TransientString : IDisposable { IntPtr ptr; public enum Encoding { @@ -20,6 +27,10 @@ namespace ObjCRuntime { Unicode, }; + public TransientString (nint size) + { + ptr = Marshal.AllocHGlobal ((IntPtr) size); + } public TransientString (string? str, Encoding encoding = Encoding.Auto) { @@ -50,7 +61,7 @@ namespace ObjCRuntime { } public static implicit operator IntPtr (TransientString str) => str.ptr; - + public static explicit operator string? (TransientString str) => Marshal.PtrToStringAuto (str.ptr); public static string? ToStringAndFree (IntPtr ptr, Encoding encoding = Encoding.Auto) { diff --git a/tests/monotouch-test/ObjCRuntime/ResourcesTest.cs b/tests/monotouch-test/ObjCRuntime/ResourcesTest.cs new file mode 100644 index 0000000000..5db5e07231 --- /dev/null +++ b/tests/monotouch-test/ObjCRuntime/ResourcesTest.cs @@ -0,0 +1,41 @@ +// +// Resource Bundling Tests +// +// Authors: +// Rolf Bjarne Kvinge (rolf@xamarin.com) +// +// Copyright 2022 Microsoft Corp. All rights reserved. +// + +using System; +using System.IO; +using System.Resources; +using System.Globalization; +using System.Reflection; +using System.Reflection.Emit; +using NUnit.Framework; + +using Foundation; +using ObjCRuntime; + +namespace MonoTouchFixtures.ObjCRuntime { + + [TestFixture] + [Preserve (AllMembers = true)] + public class ResourcesTest { + + [Test] + public void Embedded () + { + var manager = new ResourceManager ("monotouchtest.Welcome", typeof (ResourcesTest).Assembly); + + Assert.AreEqual ("Welcome!", manager.GetString ("String1", new CultureInfo ("en")), "en"); + Assert.AreEqual ("G'day!", manager.GetString ("String1", new CultureInfo ("en-AU")), "en-AU"); + Assert.AreEqual ("Willkommen!", manager.GetString ("String1", new CultureInfo ("de")), "de"); + Assert.AreEqual ("Willkommen!", manager.GetString ("String1", new CultureInfo ("de-DE")), "de-DE"); + Assert.AreEqual ("Bienvenido!", manager.GetString ("String1", new CultureInfo ("es")), "es"); + Assert.AreEqual ("Bienvenido!", manager.GetString ("String1", new CultureInfo ("es-AR")), "es-AR"); + Assert.AreEqual ("Bienvenido!", manager.GetString ("String1", new CultureInfo ("es-ES")), "es-ES"); + } + } +} diff --git a/tests/monotouch-test/Resources/Welcome.de.resx b/tests/monotouch-test/Resources/Welcome.de.resx new file mode 100755 index 0000000000..b3af7f8a05 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.de.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Willkommen! + + \ No newline at end of file diff --git a/tests/monotouch-test/Resources/Welcome.en-AU.resx b/tests/monotouch-test/Resources/Welcome.en-AU.resx new file mode 100755 index 0000000000..78128ea5a6 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.en-AU.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + G'day! + + \ No newline at end of file diff --git a/tests/monotouch-test/Resources/Welcome.es.resx b/tests/monotouch-test/Resources/Welcome.es.resx new file mode 100755 index 0000000000..01def8cc90 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.es.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Bienvenido! + + \ No newline at end of file diff --git a/tests/monotouch-test/Resources/Welcome.resx b/tests/monotouch-test/Resources/Welcome.resx new file mode 100755 index 0000000000..84bd58aab1 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Welcome! + + \ No newline at end of file diff --git a/tests/monotouch-test/dotnet/shared.csproj b/tests/monotouch-test/dotnet/shared.csproj index 38998cd86b..4fd89a5113 100644 --- a/tests/monotouch-test/dotnet/shared.csproj +++ b/tests/monotouch-test/dotnet/shared.csproj @@ -156,6 +156,18 @@ monotouchtest.Security.openssl_crt.der + + monotouchtest.Welcome.resources + + + monotouchtest.Welcome.en-AU.resources + + + monotouchtest.Welcome.es.resources + + + monotouchtest.Welcome.de.resources + diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index a0f1a8ad5b..2c773ea6cb 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -352,6 +352,18 @@ monotouchtest.Security.openssl_crt.der + + monotouchtest.Welcome.resources + + + monotouchtest.Welcome.en-AU.resources + + + monotouchtest.Welcome.es.resources + + + monotouchtest.Welcome.de.resources + diff --git a/tests/xammac_tests/xammac_tests.csproj b/tests/xammac_tests/xammac_tests.csproj index 6cef21d0c5..a1e9c825ee 100644 --- a/tests/xammac_tests/xammac_tests.csproj +++ b/tests/xammac_tests/xammac_tests.csproj @@ -265,6 +265,18 @@ EmbeddedResources\Welcome.es.resx + + monotouchtest.Welcome.resources + + + monotouchtest.Welcome.en-AU.resources + + + monotouchtest.Welcome.es.resources + + + monotouchtest.Welcome.de.resources + diff --git a/tests/xharness/Jenkins/TestVariationsFactory.cs b/tests/xharness/Jenkins/TestVariationsFactory.cs index a891584ee8..5f5e89bf53 100644 --- a/tests/xharness/Jenkins/TestVariationsFactory.cs +++ b/tests/xharness/Jenkins/TestVariationsFactory.cs @@ -151,8 +151,13 @@ namespace Xharness.Jenkins { yield return new TestData { Variation = "Debug (static registrar)", Registrar = "static", Debug = true, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac), }; yield return new TestData { Variation = "Debug (static registrar, ARM64)", Registrar = "static", Debug = true, Profiling = false, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) || !mac_supports_arm64, RuntimeIdentifier = arm64_runtime_identifier, }; } - if (test.Platform == TestPlatform.MacCatalyst) + if (test.Platform == TestPlatform.MacCatalyst) { yield return new TestData { Variation = "Release (ARM64, LLVM)", Debug = false, UseLlvm = true, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.MacCatalyst) || !mac_supports_arm64, RuntimeIdentifier = arm64_runtime_identifier }; + yield return new TestData { Variation = "Release", Debug = false, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.MacCatalyst) }; + } + if (test.Platform == TestPlatform.Mac) { + yield return new TestData { Variation = "Release", Debug = false, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) }; + } } break; case "xammac tests": From 05b92d5cf0060d7449c782f88030530eb93f64ae Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 13 Jan 2023 21:58:57 +0100 Subject: [PATCH 15/60] [msbuild] Fix typo in comment. (#17220) --- msbuild/Xamarin.Shared/Xamarin.Shared.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.targets index 079b2e686f..0baffa42b0 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.targets @@ -164,8 +164,8 @@ Copyright (C) 2018 Microsoft. All rights reserved. Outputs="$(BindingResourcePath).stamp"> From abf96190d713c0a66313d3a9a91f4a33b105d29e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 Jan 2023 22:10:58 +0100 Subject: [PATCH 16/60] [main] Update dependencies from dotnet/installer (#17223) This pull request updates the following dependencies ## Coherency Updates The following updates ensure that dependencies with a *CoherentParentDependency* attribute were produced in a build used as input to the parent dependency's build. See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview) - **Coherency Updates**: - **Microsoft.NET.ILLink.Tasks**: from 7.0.100-1.22471.3 to 7.0.100-1.22579.2 (parent: Microsoft.Dotnet.Sdk.Internal) - **Microsoft.AspNetCore.App.Ref**: from 7.0.0 to 7.0.2 (parent: Microsoft.Dotnet.Sdk.Internal) ## From https://github.com/dotnet/installer - **Subscription**: 50c9492e-4671-4d1d-7920-08dabd1031a2 - **Build**: 20230112.18 - **Date Produced**: January 13, 2023 1:55:30 AM UTC - **Commit**: 1e15b09a1df5407ba921ac4212d1fdeadecbf215 - **Branch**: refs/heads/release/7.0.1xx - **Updates**: - **Microsoft.Dotnet.Sdk.Internal**: [from 7.0.103-servicing.23053.11 to 7.0.103-servicing.23062.18][1] - **Microsoft.NET.ILLink.Tasks**: [from 7.0.100-1.22471.3 to 7.0.100-1.22579.2][2] - **Microsoft.AspNetCore.App.Ref**: [from 7.0.0 to 7.0.2][3] [1]: https://github.com/dotnet/installer/compare/e0c95ad...1e15b09 [2]: https://github.com/dotnet/linker/compare/219e84c...8db10f4 [3]: https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore/branches?baseVersion=GCbb01bbf&targetVersion=GC7c81065&_a=files --- NuGet.config | 1 - eng/Version.Details.xml | 12 ++++++------ eng/Versions.props | 4 ++-- global.json | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/NuGet.config b/NuGet.config index e671b18409..d70c17ca9c 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,7 +10,6 @@ - diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e4992ced9d..4bc1e232e3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,21 +1,21 @@ - + https://github.com/dotnet/installer - e0c95ad21e5eac311e454c65335008161b3e4763 + 1e15b09a1df5407ba921ac4212d1fdeadecbf215 - + https://github.com/dotnet/linker - 219e84c88def8276179f66282b2f7cb5f1d0d126 + 8db10f44053ed4cb95a99676ac7b8ccae681b79d https://github.com/dotnet/runtime f5f9a7054e459a8c03fbbcc736d64fcba817b697 - + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore - bb01bbf4433e27289b99001b7de6a582879d1835 + 7c810658463f35c39c54d5fb8a8dbbfd463bf747 https://github.com/dotnet/emsdk diff --git a/eng/Versions.props b/eng/Versions.props index 20441ae6af..0cec511d61 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,8 +1,8 @@ - 7.0.103-servicing.23053.11 - 7.0.100-1.22471.3 + 7.0.103-servicing.23062.18 + 7.0.100-1.22579.2 6.0.0-beta.21212.6 6.0.0-rc.2.21468.3 7.0.3 diff --git a/global.json b/global.json index 29b7786832..e987eb7c98 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "7.0.103-servicing.23053.11" + "version": "7.0.103-servicing.23062.18" } } From 4453d773ce1ebfaae58f06a78ed8119e7290e3d0 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 13 Jan 2023 22:20:47 +0100 Subject: [PATCH 17/60] [tests] Unify code related to how to load test assemblies. (#17111) Unify a lot of code related to how to load test assemblies. This resulted in adding a couple of test assemblies to monotouch-test when executed on macOS (this was a bug), and this also required adapting some of those tests to work correctly on macOS. --- tests/EmbeddedResources/ResourcesTest.cs | 2 +- tests/bindings-test/ProtocolTest.cs | 8 +++- tests/bindings-test/RegistrarBindingTest.cs | 6 +++ tests/common/AppDelegate.cs | 4 +- tests/common/TestAssemblyLoader.cs | 17 +++++++ tests/common/mac/MacMain.cs | 15 +----- tests/framework-test/dotnet/shared.csproj | 4 +- tests/framework-test/iOS/AppDelegate.cs | 17 ------- .../iOS/framework-test-ios.csproj | 2 +- .../macOS/framework-test-mac.csproj | 3 ++ tests/interdependent-binding-projects/Main.cs | 47 ++++--------------- .../dotnet/shared.csproj | 1 + .../interdependent-binding-projects.csproj | 1 + .../Mac/introspection-mac.csproj | 3 ++ tests/introspection/dotnet/shared.csproj | 4 +- tests/introspection/iOS/AppDelegate.cs | 17 ------- .../iOS/introspection-ios.csproj | 2 +- tests/linker/AppDelegate.cs | 21 +++++---- tests/linker/ios/dont link/dont link.csproj | 1 + .../linker/ios/dont link/dotnet/shared.csproj | 1 + .../linker/ios/link all/dotnet/shared.csproj | 1 + tests/linker/ios/link all/link all.csproj | 1 + .../linker/ios/link sdk/dotnet/shared.csproj | 1 + tests/linker/ios/link sdk/link sdk.csproj | 1 + .../ios/trimmode copy/dotnet/shared.csproj | 1 + .../ios/trimmode link/dotnet/shared.csproj | 1 + .../linker/mac/dont link/dont link-mac.csproj | 3 ++ tests/linker/mac/link all/link all-mac.csproj | 3 ++ tests/linker/mac/link sdk/link sdk-mac.csproj | 3 ++ .../macOS/mono-native.csproj.template | 3 ++ tests/monotouch-test/AppDelegate.cs | 9 ---- tests/monotouch-test/TestLoader.cs | 27 +++++++++++ tests/monotouch-test/dotnet/shared.csproj | 3 ++ tests/monotouch-test/monotouch-test.csproj | 3 ++ tests/xammac_tests/xammac_tests.csproj | 3 ++ tests/xcframework-test/dotnet/shared.csproj | 2 +- tests/xcframework-test/iOS/AppDelegate.cs | 17 ------- .../iOS/xcframework-test-ios.csproj | 2 +- .../macOS/xcframework-test-mac.csproj | 3 ++ 39 files changed, 130 insertions(+), 133 deletions(-) create mode 100644 tests/common/TestAssemblyLoader.cs delete mode 100644 tests/framework-test/iOS/AppDelegate.cs delete mode 100644 tests/introspection/iOS/AppDelegate.cs create mode 100644 tests/monotouch-test/TestLoader.cs delete mode 100644 tests/xcframework-test/iOS/AppDelegate.cs diff --git a/tests/EmbeddedResources/ResourcesTest.cs b/tests/EmbeddedResources/ResourcesTest.cs index 4fc723abe0..4677cd110d 100644 --- a/tests/EmbeddedResources/ResourcesTest.cs +++ b/tests/EmbeddedResources/ResourcesTest.cs @@ -35,7 +35,7 @@ namespace EmbeddedResources { #endif -#if MONOMAC +#if MONOMAC && !NET var manager = new ResourceManager ("xammac_tests.EmbeddedResources.Welcome", typeof (ResourcesTest).Assembly); #else var manager = new ResourceManager ("EmbeddedResources.Welcome", typeof (ResourcesTest).Assembly); diff --git a/tests/bindings-test/ProtocolTest.cs b/tests/bindings-test/ProtocolTest.cs index ef7d04c1ba..c0a1253c0e 100644 --- a/tests/bindings-test/ProtocolTest.cs +++ b/tests/bindings-test/ProtocolTest.cs @@ -14,8 +14,14 @@ namespace Xamarin.BindingTests { public class ProtocolTest { bool HasProtocolAttributes { get { - if (TestRuntime.IsLinkAll && !Runtime.DynamicRegistrationSupported) + if (TestRuntime.IsLinkAll) { +#if OPTIMIZEALL && __MACOS__ return false; +#endif + if (!Runtime.DynamicRegistrationSupported) + return false; + } + return true; } diff --git a/tests/bindings-test/RegistrarBindingTest.cs b/tests/bindings-test/RegistrarBindingTest.cs index e1944ae0fe..b483997349 100644 --- a/tests/bindings-test/RegistrarBindingTest.cs +++ b/tests/bindings-test/RegistrarBindingTest.cs @@ -332,8 +332,14 @@ namespace Xamarin.BindingTests { Messaging.void_objc_msgSend_IntPtr_bool_bool (Class.GetHandle (typeof (ObjCBlockTester)), Selector.GetHandle ("setProtocolWithBlockProperties:required:instance:"), pb.Handle, required, instance); Assert.Fail ("Expected an MT8028 error"); } catch (RuntimeException re) { +#if __MACOS__ + Assert.AreEqual (8009, re.Code, "Code"); + Console.WriteLine (re.Message); + Assert.That (re.Message, Does.StartWith ("Unable to locate the block to delegate conversion method for the method Xamarin.BindingTests.RegistrarBindingTest+FakePropertyBlock.set_"), re.Message, "Message"); +#else Assert.AreEqual (8028, re.Code, "Code"); Assert.AreEqual ("The runtime function get_block_wrapper_creator has been linked away.", re.Message, "Message"); +#endif } } } diff --git a/tests/common/AppDelegate.cs b/tests/common/AppDelegate.cs index c4d5ac3e9f..bc895afcec 100644 --- a/tests/common/AppDelegate.cs +++ b/tests/common/AppDelegate.cs @@ -20,8 +20,6 @@ public partial class AppDelegate : UIApplicationDelegate { public override UIWindow Window { get; set; } #endif - public partial IEnumerable GetTestAssemblies (); - partial void PostFinishedLaunching (); public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) @@ -32,7 +30,7 @@ public partial class AppDelegate : UIApplicationDelegate { var window = new UIWindow (UIScreen.MainScreen.Bounds); var runner = new TouchRunner (window); - foreach (var assembly in GetTestAssemblies ()) + foreach (var assembly in TestLoader.GetTestAssemblies ()) runner.Add (assembly); Window = window; diff --git a/tests/common/TestAssemblyLoader.cs b/tests/common/TestAssemblyLoader.cs new file mode 100644 index 0000000000..2d3d2bb913 --- /dev/null +++ b/tests/common/TestAssemblyLoader.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +#nullable enable + +public static partial class TestLoader { + public static IEnumerable GetTestAssemblies () + { + var assemblies = new HashSet (); + assemblies.Add (Assembly.GetExecutingAssembly ()); + AddTestAssembliesImpl (assemblies); + return assemblies; + } + + static partial void AddTestAssembliesImpl (HashSet assemblies); +} diff --git a/tests/common/mac/MacMain.cs b/tests/common/mac/MacMain.cs index e8774972c4..53c80c5db6 100644 --- a/tests/common/mac/MacMain.cs +++ b/tests/common/mac/MacMain.cs @@ -16,11 +16,7 @@ namespace Xamarin.Mac.Tests { var arguments = new List (args); arguments.RemoveAll ((arg) => arg.StartsWith ("-psn_", StringComparison.Ordinal)); - var assemblies = new List (); - assemblies.Add (typeof (MainClass).Assembly); - TestLoader.AddTestAssemblies (assemblies); - - var exit_code = await MonoTouch.NUnit.UI.MacRunner.MainAsync (arguments, true, _exit, assemblies.ToArray ()); + var exit_code = await MonoTouch.NUnit.UI.MacRunner.MainAsync (arguments, true, _exit, TestLoader.GetTestAssemblies ().ToArray ()); #if NET var exit_monitor = new Thread (() => { @@ -48,13 +44,4 @@ namespace Xamarin.Mac.Tests { [DllImport ("/usr/lib/libSystem.dylib")] static extern void _exit (int exit_code); } - - public static partial class TestLoader { - static partial void AddTestAssembliesImpl (List assemblies); - - public static void AddTestAssemblies (List assemblies) - { - AddTestAssembliesImpl (assemblies); - } - } } diff --git a/tests/framework-test/dotnet/shared.csproj b/tests/framework-test/dotnet/shared.csproj index 67e522e170..958d2c4ad4 100644 --- a/tests/framework-test/dotnet/shared.csproj +++ b/tests/framework-test/dotnet/shared.csproj @@ -28,10 +28,10 @@ - - + + TestRuntime.cs diff --git a/tests/framework-test/iOS/AppDelegate.cs b/tests/framework-test/iOS/AppDelegate.cs deleted file mode 100644 index 6cf252b489..0000000000 --- a/tests/framework-test/iOS/AppDelegate.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if !__WATCHOS__ -using System; -using System.Reflection; -using System.Collections.Generic; - -using Foundation; - -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - }; - } -} - -#endif // !__WATCHOS__ diff --git a/tests/framework-test/iOS/framework-test-ios.csproj b/tests/framework-test/iOS/framework-test-ios.csproj index 2ee795dc06..c31cabbb6b 100644 --- a/tests/framework-test/iOS/framework-test-ios.csproj +++ b/tests/framework-test/iOS/framework-test-ios.csproj @@ -150,9 +150,9 @@ - + diff --git a/tests/framework-test/macOS/framework-test-mac.csproj b/tests/framework-test/macOS/framework-test-mac.csproj index af49aa0af5..bf7cc2bc62 100644 --- a/tests/framework-test/macOS/framework-test-mac.csproj +++ b/tests/framework-test/macOS/framework-test-mac.csproj @@ -69,6 +69,9 @@ MacMain.cs + + TestAssemblyLoader.cs + TestRuntime.cs diff --git a/tests/interdependent-binding-projects/Main.cs b/tests/interdependent-binding-projects/Main.cs index 55db402d2f..0142548af5 100644 --- a/tests/interdependent-binding-projects/Main.cs +++ b/tests/interdependent-binding-projects/Main.cs @@ -1,53 +1,24 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Reflection; -using Foundation; -#if !__MACOS__ -using UIKit; -#endif - -using MonoTouch.NUnit.UI; using NUnit.Framework; -using NUnit.Framework.Internal; -#if __MACOS__ -namespace Xamarin.Mac.Tests { - public static partial class TestLoader { - static partial void AddTestAssembliesImpl (List assemblies) - { - assemblies.Add (typeof (Xamarin.BindingTests2.BindingTest).Assembly); - assemblies.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); - } - } -} -#elif !__WATCHOS__ -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - typeof (Xamarin.BindingTests2.BindingTest).Assembly, - typeof (Xamarin.BindingTests.ProtocolTest).Assembly, - }; - } -} -#else +#nullable enable + public static partial class TestLoader { - static partial void AddTestAssembliesImpl (BaseTouchRunner runner) + static partial void AddTestAssembliesImpl (HashSet assemblies) { - runner.Add (typeof (Xamarin.BindingTests2.BindingTest).Assembly); - runner.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); + assemblies.Add (typeof (Xamarin.BindingTests2.BindingTest).Assembly); + assemblies.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); } } -#endif // !__WATCHOS__ - -// In some cases NUnit fails if asked to run tests from an assembly that doesn't have any tests. So add a dummy test here to not fail in that scenario. [TestFixture] -public class DummyTest { - public void TestMe () +public class LoaderTest { + public void TestAssemblyCount () { - Assert.True (true, "YAY!"); + Assert.AreEqual (3, TestLoader.GetTestAssemblies ().Count (), "Test assembly count"); } } diff --git a/tests/interdependent-binding-projects/dotnet/shared.csproj b/tests/interdependent-binding-projects/dotnet/shared.csproj index d879074086..199798b31b 100644 --- a/tests/interdependent-binding-projects/dotnet/shared.csproj +++ b/tests/interdependent-binding-projects/dotnet/shared.csproj @@ -30,6 +30,7 @@ + TestRuntime.cs diff --git a/tests/interdependent-binding-projects/interdependent-binding-projects.csproj b/tests/interdependent-binding-projects/interdependent-binding-projects.csproj index 92acbcb055..86a5aad46b 100644 --- a/tests/interdependent-binding-projects/interdependent-binding-projects.csproj +++ b/tests/interdependent-binding-projects/interdependent-binding-projects.csproj @@ -144,6 +144,7 @@ + diff --git a/tests/introspection/Mac/introspection-mac.csproj b/tests/introspection/Mac/introspection-mac.csproj index 95e7913491..64c5b40d46 100644 --- a/tests/introspection/Mac/introspection-mac.csproj +++ b/tests/introspection/Mac/introspection-mac.csproj @@ -141,6 +141,9 @@ SdkVersions.cs + + TestAssemblyLoader.cs + ApiFrameworkTest.cs diff --git a/tests/introspection/dotnet/shared.csproj b/tests/introspection/dotnet/shared.csproj index 724a30ac5c..e1e8979eb8 100644 --- a/tests/introspection/dotnet/shared.csproj +++ b/tests/introspection/dotnet/shared.csproj @@ -41,7 +41,6 @@ - @@ -139,6 +138,9 @@ SdkVersions.cs + + TestAssemblyLoader.cs + ApiFrameworkTest.cs diff --git a/tests/introspection/iOS/AppDelegate.cs b/tests/introspection/iOS/AppDelegate.cs deleted file mode 100644 index 6cf252b489..0000000000 --- a/tests/introspection/iOS/AppDelegate.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if !__WATCHOS__ -using System; -using System.Reflection; -using System.Collections.Generic; - -using Foundation; - -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - }; - } -} - -#endif // !__WATCHOS__ diff --git a/tests/introspection/iOS/introspection-ios.csproj b/tests/introspection/iOS/introspection-ios.csproj index f626cf8284..7493a26333 100644 --- a/tests/introspection/iOS/introspection-ios.csproj +++ b/tests/introspection/iOS/introspection-ios.csproj @@ -149,8 +149,8 @@ - + diff --git a/tests/linker/AppDelegate.cs b/tests/linker/AppDelegate.cs index 49c837407f..93a07e3b3b 100644 --- a/tests/linker/AppDelegate.cs +++ b/tests/linker/AppDelegate.cs @@ -1,18 +1,21 @@ -#if !__WATCHOS__ using System; using System.Reflection; using System.Collections.Generic; +using System.Linq; -using Foundation; +using NUnit.Framework; -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () +public static partial class TestLoader { + static partial void AddTestAssembliesImpl (HashSet assemblies) { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - typeof (BundledResources.ResourcesTest).Assembly, - }; + assemblies.Add (typeof (BundledResources.ResourcesTest).Assembly); } } -#endif // !__WATCHOS__ +[TestFixture] +public class LoaderTest { + public void TestAssemblyCount () + { + Assert.AreEqual (2, TestLoader.GetTestAssemblies ().Count (), "Test assembly count"); + } +} diff --git a/tests/linker/ios/dont link/dont link.csproj b/tests/linker/ios/dont link/dont link.csproj index b5af873d23..406316e285 100644 --- a/tests/linker/ios/dont link/dont link.csproj +++ b/tests/linker/ios/dont link/dont link.csproj @@ -142,6 +142,7 @@ + diff --git a/tests/linker/ios/dont link/dotnet/shared.csproj b/tests/linker/ios/dont link/dotnet/shared.csproj index 485b4e57ab..6a3ce95cf2 100644 --- a/tests/linker/ios/dont link/dotnet/shared.csproj +++ b/tests/linker/ios/dont link/dotnet/shared.csproj @@ -46,6 +46,7 @@ CommonDontLinkTest.cs + diff --git a/tests/linker/ios/link all/dotnet/shared.csproj b/tests/linker/ios/link all/dotnet/shared.csproj index 1984e81389..0f5ef0851e 100644 --- a/tests/linker/ios/link all/dotnet/shared.csproj +++ b/tests/linker/ios/link all/dotnet/shared.csproj @@ -84,6 +84,7 @@ NetworkResources.cs + diff --git a/tests/linker/ios/link all/link all.csproj b/tests/linker/ios/link all/link all.csproj index 28f9918fb6..16b1734a2f 100644 --- a/tests/linker/ios/link all/link all.csproj +++ b/tests/linker/ios/link all/link all.csproj @@ -185,6 +185,7 @@ + TestRuntime.cs diff --git a/tests/linker/ios/link sdk/dotnet/shared.csproj b/tests/linker/ios/link sdk/dotnet/shared.csproj index c110980a21..e833d901fc 100644 --- a/tests/linker/ios/link sdk/dotnet/shared.csproj +++ b/tests/linker/ios/link sdk/dotnet/shared.csproj @@ -78,6 +78,7 @@ NetworkResources.cs + diff --git a/tests/linker/ios/link sdk/link sdk.csproj b/tests/linker/ios/link sdk/link sdk.csproj index e565e31e3e..177802e4a9 100644 --- a/tests/linker/ios/link sdk/link sdk.csproj +++ b/tests/linker/ios/link sdk/link sdk.csproj @@ -179,6 +179,7 @@ + TestRuntime.cs diff --git a/tests/linker/ios/trimmode copy/dotnet/shared.csproj b/tests/linker/ios/trimmode copy/dotnet/shared.csproj index 68c6f06d54..6cc8a0ed2f 100644 --- a/tests/linker/ios/trimmode copy/dotnet/shared.csproj +++ b/tests/linker/ios/trimmode copy/dotnet/shared.csproj @@ -47,6 +47,7 @@ ApplePlatform.cs + diff --git a/tests/linker/ios/trimmode link/dotnet/shared.csproj b/tests/linker/ios/trimmode link/dotnet/shared.csproj index 4c05aaf8ea..5bd441413b 100644 --- a/tests/linker/ios/trimmode link/dotnet/shared.csproj +++ b/tests/linker/ios/trimmode link/dotnet/shared.csproj @@ -84,6 +84,7 @@ ApplePlatform.cs + diff --git a/tests/linker/mac/dont link/dont link-mac.csproj b/tests/linker/mac/dont link/dont link-mac.csproj index c003ff5c41..9c052ca104 100644 --- a/tests/linker/mac/dont link/dont link-mac.csproj +++ b/tests/linker/mac/dont link/dont link-mac.csproj @@ -74,6 +74,9 @@ MacMain.cs + + TestAssemblyLoader.cs + TestRuntime.cs diff --git a/tests/linker/mac/link all/link all-mac.csproj b/tests/linker/mac/link all/link all-mac.csproj index 5113e024f5..c348bb1acf 100644 --- a/tests/linker/mac/link all/link all-mac.csproj +++ b/tests/linker/mac/link all/link all-mac.csproj @@ -75,6 +75,9 @@ Mac.cs + + TestAssemblyLoader.cs + DataContractTest.cs diff --git a/tests/linker/mac/link sdk/link sdk-mac.csproj b/tests/linker/mac/link sdk/link sdk-mac.csproj index 47d2e77f36..68d5ed4d4c 100644 --- a/tests/linker/mac/link sdk/link sdk-mac.csproj +++ b/tests/linker/mac/link sdk/link sdk-mac.csproj @@ -73,6 +73,9 @@ Mac.cs + + TestAssemblyLoader.cs + ApplePlatform.cs diff --git a/tests/mono-native/macOS/mono-native.csproj.template b/tests/mono-native/macOS/mono-native.csproj.template index a4081ec327..8727ac7e7f 100644 --- a/tests/mono-native/macOS/mono-native.csproj.template +++ b/tests/mono-native/macOS/mono-native.csproj.template @@ -52,6 +52,9 @@ MonoNativeConfig.cs + + TestAssemblyLoader.cs + MonoNativePlatform.cs diff --git a/tests/monotouch-test/AppDelegate.cs b/tests/monotouch-test/AppDelegate.cs index 32f786445e..caef479bea 100644 --- a/tests/monotouch-test/AppDelegate.cs +++ b/tests/monotouch-test/AppDelegate.cs @@ -26,15 +26,6 @@ public partial class AppDelegate : UIApplicationDelegate { } #endif - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - typeof (EmbeddedResources.ResourcesTest).Assembly, - typeof (Xamarin.BindingTests.ProtocolTest).Assembly, - }; - } - partial void PostFinishedLaunching () { // required for the background tasks tests, we can only register the tasks in this method diff --git a/tests/monotouch-test/TestLoader.cs b/tests/monotouch-test/TestLoader.cs new file mode 100644 index 0000000000..7ae2b57f18 --- /dev/null +++ b/tests/monotouch-test/TestLoader.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +using NUnit.Framework; + +using Foundation; + +#nullable enable + +public static partial class TestLoader { + static partial void AddTestAssembliesImpl (HashSet assemblies) + { + assemblies.Add (typeof (EmbeddedResources.ResourcesTest).Assembly); + assemblies.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); + } +} + +[TestFixture] +[Preserve (AllMembers = true)] +public class LoaderTest { + public void TestAssemblyCount () + { + Assert.AreEqual (3, TestLoader.GetTestAssemblies ().Count (), "Test assembly count"); + } +} diff --git a/tests/monotouch-test/dotnet/shared.csproj b/tests/monotouch-test/dotnet/shared.csproj index 4fd89a5113..927abc37a0 100644 --- a/tests/monotouch-test/dotnet/shared.csproj +++ b/tests/monotouch-test/dotnet/shared.csproj @@ -55,6 +55,9 @@ Extensions.cs + + TestAssemblyLoader.cs + ApplePlatform.cs diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index 2c773ea6cb..ce040de6d1 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -206,6 +206,9 @@ Extensions.cs + + TestAssemblyLoader.cs + ApplePlatform.cs diff --git a/tests/xammac_tests/xammac_tests.csproj b/tests/xammac_tests/xammac_tests.csproj index a1e9c825ee..193a040dd0 100644 --- a/tests/xammac_tests/xammac_tests.csproj +++ b/tests/xammac_tests/xammac_tests.csproj @@ -132,6 +132,9 @@ ExecutionHelper.cs + + TestAssemblyLoader.cs + api-shared\ObjCRuntime\RegistrarTest.cs diff --git a/tests/xcframework-test/dotnet/shared.csproj b/tests/xcframework-test/dotnet/shared.csproj index 80466ebc6a..4434b8963c 100644 --- a/tests/xcframework-test/dotnet/shared.csproj +++ b/tests/xcframework-test/dotnet/shared.csproj @@ -28,10 +28,10 @@ - + TestRuntime.cs diff --git a/tests/xcframework-test/iOS/AppDelegate.cs b/tests/xcframework-test/iOS/AppDelegate.cs deleted file mode 100644 index 6cf252b489..0000000000 --- a/tests/xcframework-test/iOS/AppDelegate.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if !__WATCHOS__ -using System; -using System.Reflection; -using System.Collections.Generic; - -using Foundation; - -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - }; - } -} - -#endif // !__WATCHOS__ diff --git a/tests/xcframework-test/iOS/xcframework-test-ios.csproj b/tests/xcframework-test/iOS/xcframework-test-ios.csproj index 04413c7620..85e6289e5d 100644 --- a/tests/xcframework-test/iOS/xcframework-test-ios.csproj +++ b/tests/xcframework-test/iOS/xcframework-test-ios.csproj @@ -165,8 +165,8 @@ - + diff --git a/tests/xcframework-test/macOS/xcframework-test-mac.csproj b/tests/xcframework-test/macOS/xcframework-test-mac.csproj index c33c25f5cf..d65f4db1c1 100644 --- a/tests/xcframework-test/macOS/xcframework-test-mac.csproj +++ b/tests/xcframework-test/macOS/xcframework-test-mac.csproj @@ -69,6 +69,9 @@ MacMain.cs + + TestAssemblyLoader.cs + TestRuntime.cs From 73ae0d603199735c6594caeed09b78d1f92635a9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 07:28:33 +0100 Subject: [PATCH 18/60] [main] Update dependencies from dotnet/runtime (#17239) This pull request updates the following dependencies ## Coherency Updates The following updates ensure that dependencies with a *CoherentParentDependency* attribute were produced in a build used as input to the parent dependency's build. See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview) - **Coherency Updates**: - **Microsoft.NET.Workload.Emscripten.net7.Manifest-7.0.100**: from 7.0.2 to 7.0.3 (parent: Microsoft.NETCore.App.Ref) ## From https://github.com/dotnet/runtime - **Subscription**: 38d2313f-22d5-4062-c8e1-08dabd6d8c77 - **Build**: 20230113.11 - **Date Produced**: January 14, 2023 6:59:23 AM UTC - **Commit**: c8a73afdf24cd1182b19c8b7ead209a798edf893 - **Branch**: refs/heads/release/7.0 - **Updates**: - **Microsoft.NETCore.App.Ref**: [from 7.0.3 to 7.0.3][3] - **Microsoft.NET.Workload.Emscripten.net7.Manifest-7.0.100**: [from 7.0.2 to 7.0.3][4] [3]: https://github.com/dotnet/runtime/compare/f5f9a70...c8a73af [4]: https://github.com/dotnet/emsdk/compare/00fbd97...67006e8 --- NuGet.config | 3 ++- eng/Version.Details.xml | 6 +++--- eng/Versions.props | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NuGet.config b/NuGet.config index d70c17ca9c..3c0946e96a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,11 +10,12 @@ + - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4bc1e232e3..b0bbc75b2f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -10,16 +10,16 @@ https://github.com/dotnet/runtime - f5f9a7054e459a8c03fbbcc736d64fcba817b697 + c8a73afdf24cd1182b19c8b7ead209a798edf893 https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore 7c810658463f35c39c54d5fb8a8dbbfd463bf747 - + https://github.com/dotnet/emsdk - 00fbd974da8e15ee323c57e44a8e3d59560105a6 + 67006e8fe3c3ba1a6e9282d116782fd4fea9dfcb diff --git a/eng/Versions.props b/eng/Versions.props index 0cec511d61..44e5044010 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -6,7 +6,7 @@ 6.0.0-beta.21212.6 6.0.0-rc.2.21468.3 7.0.3 - 7.0.2 + 7.0.3 7.0.100-alpha.1.21601.1 net7.0 From a646315d64f26c0204ae4662873ec7fb65003f30 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 07:30:53 +0100 Subject: [PATCH 19/60] [main] Update dependencies from dotnet/installer (#17236) This pull request updates the following dependencies ## From https://github.com/dotnet/installer - **Subscription**: 50c9492e-4671-4d1d-7920-08dabd1031a2 - **Build**: 20230113.7 - **Date Produced**: January 13, 2023 9:22:06 PM UTC - **Commit**: 4a2d55e922b2b72664b3081e57120eae5a3af86e - **Branch**: refs/heads/release/7.0.1xx - **Updates**: - **Microsoft.Dotnet.Sdk.Internal**: [from 7.0.103-servicing.23062.18 to 7.0.103-servicing.23063.7][2] [2]: https://github.com/dotnet/installer/compare/1e15b09...4a2d55e --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b0bbc75b2f..c6a315191c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/installer - 1e15b09a1df5407ba921ac4212d1fdeadecbf215 + 4a2d55e922b2b72664b3081e57120eae5a3af86e https://github.com/dotnet/linker diff --git a/eng/Versions.props b/eng/Versions.props index 44e5044010..54b8d29c50 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 7.0.103-servicing.23062.18 + 7.0.103-servicing.23063.7 7.0.100-1.22579.2 6.0.0-beta.21212.6 6.0.0-rc.2.21468.3 diff --git a/global.json b/global.json index e987eb7c98..2a36cbbf49 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "7.0.103-servicing.23062.18" + "version": "7.0.103-servicing.23063.7" } } From 6a5176ad508b1b3a1e364e8758bccfabe1654012 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 16 Jan 2023 07:32:45 +0100 Subject: [PATCH 20/60] Bump to MSBuild.StructuredLogger v2.1.758. (#17229) To get new log format: > System.NotSupportedException : Unsupported log file format. Latest supported version is 14, the log file has version 15. --- tests/bgen/bgen-tests.csproj | 2 +- tests/dotnet/UnitTests/DotNetUnitTests.csproj | 2 +- tests/generator/generator-tests.csproj | 2 +- tests/mmptest/mmptest.csproj | 2 +- tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj | 2 +- tests/mtouch/mtouchtests.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/bgen/bgen-tests.csproj b/tests/bgen/bgen-tests.csproj index 184bd2ee63..6971dd9622 100644 --- a/tests/bgen/bgen-tests.csproj +++ b/tests/bgen/bgen-tests.csproj @@ -12,7 +12,7 @@ - + diff --git a/tests/dotnet/UnitTests/DotNetUnitTests.csproj b/tests/dotnet/UnitTests/DotNetUnitTests.csproj index c5fda93bbd..f97fc30214 100644 --- a/tests/dotnet/UnitTests/DotNetUnitTests.csproj +++ b/tests/dotnet/UnitTests/DotNetUnitTests.csproj @@ -12,7 +12,7 @@ - + diff --git a/tests/generator/generator-tests.csproj b/tests/generator/generator-tests.csproj index 8b6345295d..877f9cb377 100644 --- a/tests/generator/generator-tests.csproj +++ b/tests/generator/generator-tests.csproj @@ -34,7 +34,7 @@ - + diff --git a/tests/mmptest/mmptest.csproj b/tests/mmptest/mmptest.csproj index d625a44614..1aa05eb331 100644 --- a/tests/mmptest/mmptest.csproj +++ b/tests/mmptest/mmptest.csproj @@ -42,7 +42,7 @@ \Library\Frameworks\Xamarin.Mac.framework\Versions\Current\lib\mmp\mmp.exe - + diff --git a/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj b/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj index f9654dbad0..e072a890bc 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj +++ b/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj @@ -13,7 +13,7 @@ - + diff --git a/tests/mtouch/mtouchtests.csproj b/tests/mtouch/mtouchtests.csproj index 2f43dc02d4..f8ca67ecce 100644 --- a/tests/mtouch/mtouchtests.csproj +++ b/tests/mtouch/mtouchtests.csproj @@ -28,7 +28,7 @@ - + ..\..\builds\mono-ios-sdk-destdir\ios-bcl\monotouch_tools\Mono.Cecil.dll From b828df956be47a53cfa165067456b67ed8b8020a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 16 Jan 2023 07:49:24 +0100 Subject: [PATCH 21/60] [Foundation] [NSTask launchedTaskWithLaunchPath:arguments:] is not available on Mac Catalyst. (#17232) But we can't just remove it, so obsolete it until we can. --- src/foundation.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/foundation.cs b/src/foundation.cs index ee28ad2fa0..b6e27e43e0 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -15461,6 +15461,13 @@ namespace Foundation { [Static] [Deprecated (PlatformName.MacOSX, 10, 15)] +#if XAMCORE_5_0 + [NoMacCatalyst] +#else +#if MACCATALYST + [Obsolete ("Do not use; this method is not available on Mac Catalyst.")] +#endif // MACCATALYST +#endif // XAMCORE_5_0 [Export ("launchedTaskWithLaunchPath:arguments:")] NSTask LaunchFromPath (string path, string [] arguments); From d00f5a701b7ff97663c2078d731be847270b7692 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 16 Jan 2023 07:50:06 +0100 Subject: [PATCH 22/60] [AudioUnit] Make AudioUnitParameterType.AUDCFilterDecayTime obsolete on Mac Catalyst. (#17231) Mark this field as obsolete on Mac Catalyst to match iOS, but also completely remove it in XAMCORE_5_0, since I can't find it in the headers anymore anyways. --- src/AudioUnit/AUEnums.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/AudioUnit/AUEnums.cs b/src/AudioUnit/AUEnums.cs index 8011ee073f..4340ed9dd6 100644 --- a/src/AudioUnit/AUEnums.cs +++ b/src/AudioUnit/AUEnums.cs @@ -565,8 +565,11 @@ namespace AudioUnit { AULowShelfCutoffFrequency = 0, AULowShelfGain = 1, +#if !XAMCORE_5_0 // I can't find this value in the headers anymore [Obsoleted (PlatformName.iOS, 7, 0)] + [Obsoleted (PlatformName.MacCatalyst, 13, 1)] AUDCFilterDecayTime = 0, +#endif // AUParametricEQ ParametricEQCenterFreq = 0, From 7d02fa6f4fcff074b4f56e4e437140bcb9b9fb09 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 16 Jan 2023 08:21:09 +0100 Subject: [PATCH 23/60] [dotnet] Ensure any trimmer components are restored properly. (#17227) .NET 8 will load the ILLink component based on the target framework of the project file - so if .NET 8 is building a net7.0-ios app, the build will restore and use the ILLink component from .NET 7. There is a problem however: * The inclusion of the ILLink component is dpendent on the PublishTrimmed property - if PublishTrimmed is true, then the ILLink component is restored (which makes sense, why restore it if it's not going to be used?). * We always PublishTrimmed, because the linker must always be executed for our projects. So far so good - we can just always enable PublishTrimmed, right? * Nope, when building on Windows, we only enable PublishTrimmed when connected to a Mac, because that's where the ILLink target must be executed (and if we're not connected to a Mac, we can't run the ILLink target, and things fall apart - so just disable PublishTrimmed in that, since it won't work anyway). * Early on in the build we have no idea if we're connected to a Mac or not, which means we can only enable PublishTrimmed in a target, and not as an early-on default value. This is *way* to late for the ILLink component, which needs PublishTrimmed set quite early in the build process. * Fortunately, the ILLink inclusion is actually gated on a different variable (_IsTrimmingEnabled) - which is initialized from PublishTrimmed if it's not set. So the way out here is to set _IsTrimmingEnabled early enough, and now the ILLink component is included and restored. * The additional hurdle is that we need to set _IsTrimmingEnabled in our .NET 6 and .NET 7 workloads as well, it's not enough to set it in our .NET 8 workload (which isn't even loaded when building an earlier TFM). --- dotnet/targets/Xamarin.Shared.Sdk.props | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.props b/dotnet/targets/Xamarin.Shared.Sdk.props index 77adbac40a..a8dcdb5e04 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.props +++ b/dotnet/targets/Xamarin.Shared.Sdk.props @@ -39,6 +39,14 @@ true + + + <_IsTrimmingEnabled>true From ca8ae0801d576e1c1213ca7a2646da31049c1f51 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 17 Jan 2023 10:38:49 -0500 Subject: [PATCH 24/60] [CoreSpotlight] Add nullability to forgotten files. (#17216) --- src/CoreSpotlight/CSCompat.cs | 4 +++- src/CoreSpotlight/CSEnums.cs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CoreSpotlight/CSCompat.cs b/src/CoreSpotlight/CSCompat.cs index a210bd144a..b911392f61 100644 --- a/src/CoreSpotlight/CSCompat.cs +++ b/src/CoreSpotlight/CSCompat.cs @@ -4,6 +4,8 @@ using System; using System.ComponentModel; using ObjCRuntime; +#nullable enable + namespace CoreSpotlight { #if !NET && IOS @@ -27,7 +29,7 @@ namespace CoreSpotlight { [UnsupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("macos")] #endif - public virtual string [] ProtectionClasses { + public virtual string []? ProtectionClasses { get => null; set => throw new InvalidOperationException (Constants.ApiRemovedGeneral); } diff --git a/src/CoreSpotlight/CSEnums.cs b/src/CoreSpotlight/CSEnums.cs index fc379abe15..bd4d8cf0cb 100644 --- a/src/CoreSpotlight/CSEnums.cs +++ b/src/CoreSpotlight/CSEnums.cs @@ -11,6 +11,8 @@ using System; using ObjCRuntime; using Foundation; +#nullable enable + namespace CoreSpotlight { // NSInteger -> CNContact.h [NoTV] // CS_TVOS_UNAVAILABLE From 6f4774be84bfd697e0589ee9907f97c9b80fb2e9 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Jan 2023 17:05:03 +0100 Subject: [PATCH 25/60] [generator] Don't generate accessors with No* availability attributes on them. (#17249) Previously API definitions like this: string Property { get; [NoiOS] set; } would generate a setter for every platform, even iOS. This is rather unexpected, so fix the generator to honor No* attributes on property getters and setters. --- src/generator.cs | 48 ++++++++++------ tests/generator/BGenTests.cs | 36 ++++++++++++ tests/generator/BGenTool.cs | 46 +++++++++++---- .../tests/no-availability-for-accessors.cs | 56 +++++++++++++++++++ 4 files changed, 157 insertions(+), 29 deletions(-) create mode 100644 tests/generator/tests/no-availability-for-accessors.cs diff --git a/src/generator.cs b/src/generator.cs index 6c0fdc7755..eb6d11941c 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -5283,6 +5283,7 @@ public partial class Generator : IMemberGatherer { bool use_underscore = minfo.is_unified_internal; var mod = minfo.GetVisibility (); minfo.protocolize = Protocolize (pi); + GetAccessorInfo (pi, out var getter, out var setter, out var generate_getter, out var generate_setter); var nullable = !pi.PropertyType.IsValueType && AttributeManager.HasAttribute (pi); @@ -5322,7 +5323,7 @@ public partial class Generator : IMemberGatherer { pi.Name.GetSafeParamName (), use_underscore ? "_" : ""); indent++; - if (pi.CanRead) { + if (generate_getter) { #if !NET PrintAttributes (pi, platform: true); #endif @@ -5344,7 +5345,7 @@ public partial class Generator : IMemberGatherer { indent--; print ("}"); } - if (pi.CanWrite) { + if (generate_setter) { #if !NET PrintAttributes (pi, platform: true); #endif @@ -5422,7 +5423,7 @@ public partial class Generator : IMemberGatherer { if (minfo.has_inner_wrap_attribute) { // If property getter or setter has its own WrapAttribute we let the user do whatever their heart desires - if (pi.CanRead) { + if (generate_getter) { PrintAttributes (pi, platform: true); PrintAttributes (pi.GetGetMethod (), platform: true, preserve: true, advice: true); print ("get {"); @@ -5433,8 +5434,7 @@ public partial class Generator : IMemberGatherer { indent--; print ("}"); } - if (pi.CanWrite) { - var setter = pi.GetSetMethod (); + if (generate_setter) { var not_implemented_attr = AttributeManager.GetCustomAttribute (setter); PrintAttributes (pi, platform: true); @@ -5455,8 +5455,7 @@ public partial class Generator : IMemberGatherer { return; } - if (pi.CanRead) { - var getter = pi.GetGetMethod (); + if (generate_getter) { var ba = GetBindAttribute (getter); string sel = ba != null ? ba.Selector : export.Selector; @@ -5517,8 +5516,7 @@ public partial class Generator : IMemberGatherer { print ("}\n"); } } - if (pi.CanWrite) { - var setter = pi.GetSetMethod (); + if (generate_setter) { var ba = GetBindAttribute (setter); bool null_allowed = AttributeManager.HasAttribute (setter); if (null_allowed) @@ -6393,11 +6391,11 @@ public partial class Generator : IMemberGatherer { mod = "unsafe "; // IsValueType check needed for `IntPtr` signatures (which can't become `IntPtr?`) var nullable = !pi.PropertyType.IsValueType && AttributeManager.HasAttribute (pi) ? "?" : String.Empty; - print ("{0}{1}{2} {3} {{", mod, FormatType (type, pi.PropertyType), nullable, pi.Name, pi.CanRead ? "get;" : string.Empty, pi.CanWrite ? "set;" : string.Empty); + GetAccessorInfo (pi, out var getMethod, out var setMethod, out var generate_getter, out var generate_setter); + print ("{0}{1}{2} {3} {{", mod, FormatType (type, pi.PropertyType), nullable, pi.Name, generate_getter ? "get;" : string.Empty, generate_setter ? "set;" : string.Empty); indent++; - if (pi.CanRead) { + if (generate_getter) { var ea = GetGetterExportAttribute (pi); - var getMethod = pi.GetGetMethod (); // there can be a [Bind] there that override the selector name to be used // e.g. IMTLTexture.FramebufferOnly var ba = GetBindAttribute (getMethod); @@ -6411,8 +6409,7 @@ public partial class Generator : IMemberGatherer { PrintAttributes (getMethod, notImplemented: true); print ("get;"); } - if (pi.CanWrite) { - var setMethod = pi.GetSetMethod (); + if (generate_setter) { PrintBlockProxy (pi.PropertyType); PrintAttributes (setMethod, notImplemented: true); if (!AttributeManager.HasAttribute (setMethod)) @@ -6450,15 +6447,14 @@ public partial class Generator : IMemberGatherer { // C# does not support extension properties, so create Get* and Set* accessors instead. foreach (var pi in optionalInstanceProperties) { + GetAccessorInfo (pi, out var getter, out var setter, out var generate_getter, out var generate_setter); var attrib = GetExportAttribute (pi); - var getter = pi.GetGetMethod (); - if (getter != null) { + if (generate_getter) { PrintAttributes (pi, preserve: true, advice: true); var ba = GetBindAttribute (getter); GenerateMethod (type, getter, false, null, false, false, true, ba?.Selector ?? attrib.ToGetter (pi).Selector); } - var setter = pi.GetSetMethod (); - if (setter != null) { + if (generate_setter) { PrintAttributes (pi, preserve: true, advice: true); var ba = GetBindAttribute (setter); GenerateMethod (type, setter, false, null, false, false, true, ba?.Selector ?? attrib.ToSetter (pi).Selector); @@ -6597,6 +6593,22 @@ public partial class Generator : IMemberGatherer { } } + void GetAccessorInfo (PropertyInfo pi, out MethodInfo getter, out MethodInfo setter, out bool generate_getter, out bool generate_setter) + { + getter = null; + setter = null; + generate_getter = false; + generate_setter = false; + if (pi.CanRead) { + getter = pi.GetGetMethod (); + generate_getter = !getter.IsUnavailable (this); + } + if (pi.CanWrite) { + setter = pi.GetSetMethod (); + generate_setter = !setter.IsUnavailable (this); + } + } + class MethodData { public MethodInfo Method; public ExportAttribute ExportAttribute; diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index 2f1cacb929..6f41c1a491 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -1020,6 +1020,42 @@ namespace GeneratorTests { Assert.IsNotNull (pinvoke, "PInvoke"); } + [Test] + [TestCase (Profile.iOS)] + public void NoAvailabilityForAccessors (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = new BGenTool (); + bgen.Profile = profile; + bgen.AddTestApiDefinition ("tests/no-availability-for-accessors.cs"); + bgen.CreateTemporaryBinding (); + bgen.AssertExecute ("build"); + + bgen.AssertMethod ("NS.Whatever", "get_PropA"); + bgen.AssertNoMethod ("NS.Whatever", "set_PropA", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.Whatever", "set_PropB", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.Whatever", "get_PropB"); + bgen.AssertMethod ("NS.Whatever", "get_IPropA"); + bgen.AssertNoMethod ("NS.Whatever", "set_IPropA", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.Whatever", "set_IPropB", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.Whatever", "get_IPropB"); + bgen.AssertMethod ("NS.Whatever", "get_IPropAOpt"); + bgen.AssertNoMethod ("NS.Whatever", "set_IPropAOpt", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.Whatever", "set_IPropBOpt", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.Whatever", "get_IPropBOpt"); + bgen.AssertPublicMethodCount ("NS.Whatever", 9); // 6 accessors + 2 constructors + ClassHandle getter + + bgen.AssertMethod ("NS.IIProtocol", "get_IPropA"); + bgen.AssertNoMethod ("NS.IIProtocol", "set_IPropA", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.IIProtocol", "set_IPropB", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.IIProtocol", "get_IPropB"); + bgen.AssertPublicMethodCount ("NS.IIProtocol", 2); + + bgen.AssertMethod ("NS.IProtocol_Extensions", "GetIPropAOpt", parameterTypes: "NS.IIProtocol"); + bgen.AssertMethod ("NS.IProtocol_Extensions", "SetIPropBOpt", parameterTypes: new string [] { "NS.IIProtocol", "Foundation.NSObject" }); + bgen.AssertPublicMethodCount ("NS.IProtocol_Extensions", 2); + } + BGenTool BuildFile (Profile profile, params string [] filenames) { return BuildFile (profile, true, false, filenames); diff --git a/tests/generator/BGenTool.cs b/tests/generator/BGenTool.cs index 37698969bd..96574aa0f3 100644 --- a/tests/generator/BGenTool.cs +++ b/tests/generator/BGenTool.cs @@ -304,14 +304,15 @@ namespace Xamarin.Tests { { LoadAssembly (); - var t = assembly.MainModule.Types.FirstOrDefault ((v) => v.FullName == typename); - var actual = t.Methods.Count ((v) => { + var t = assembly.MainModule.Types.First ((v) => v.FullName == typename); + var actual = t.Methods.Where ((v) => { if (v.IsPrivate || v.IsFamily || v.IsFamilyAndAssembly) return false; return true; }); - if (actual != count) - Assert.Fail ($"Expected {count} publicly accessible method(s) in {typename}, found {actual} publicly accessible method(s). {message}"); + if (actual.Count () != count) { + Assert.Fail ($"Expected {count} publicly accessible method(s) in {typename}, found {actual} publicly accessible method(s): {message}\n\t{string.Join ("\n\t", actual.Select (v => v.FullName).OrderBy (v => v))}"); + } } public void AssertType (string fullname, TypeAttributes? attributes = null, string message = null) @@ -326,6 +327,11 @@ namespace Xamarin.Tests { Assert.AreEqual (attributes.Value, t.Attributes, $"Incorrect attributes for type {fullname}."); } + public void AssertMethod (string typename, string method, params string [] parameterTypes) + { + AssertMethod (typename, method, null, null, parameterTypes); + } + public void AssertMethod (string typename, string method, string returnType = null, params string [] parameterTypes) { AssertMethod (typename, method, null, returnType, parameterTypes); @@ -333,9 +339,29 @@ namespace Xamarin.Tests { public void AssertMethod (string typename, string method, MethodAttributes? attributes = null, string returnType = null, params string [] parameterTypes) { - LoadAssembly (); + var m = FindMethod (typename, method, returnType, parameterTypes); + if (m is null) { + Assert.Fail ($"No method '{method}' with signature '{string.Join ("', '", parameterTypes)}' on the type '{typename}' was found."); + return; + } + if (attributes.HasValue) + Assert.AreEqual (attributes.Value, m.Attributes, "Attributes for {0}", m.FullName); + } + + public void AssertNoMethod (string typename, string method, string returnType = null, params string [] parameterTypes) + { + var m = FindMethod (typename, method, returnType, parameterTypes); + if (m is not null) + Assert.Fail ($"Unexpectedly found method '{method}' with signature '{string.Join ("', '", parameterTypes)}' on the type '{typename}'."); + } + + MethodDefinition FindMethod (string typename, string method, string returnType, params string [] parameterTypes) + { + var assembly = LoadAssembly (); + var t = assembly.MainModule.Types.FirstOrDefault ((v) => v.FullName == typename); + if (t is null) + return null; - var t = assembly.MainModule.Types.First ((v) => v.FullName == typename); var m = t.Methods.FirstOrDefault ((v) => { if (v.Name != method) return false; @@ -346,13 +372,10 @@ namespace Xamarin.Tests { return false; return true; }); - if (m == null) - Assert.Fail ($"No method '{method}' with signature '{string.Join ("', '", parameterTypes)}' was found."); - if (attributes.HasValue) - Assert.AreEqual (attributes.Value, m.Attributes, "Attributes for {0}", m.FullName); + return m; } - void LoadAssembly () + AssemblyDefinition LoadAssembly () { if (assembly is null) { var parameters = new ReaderParameters (); @@ -362,6 +385,7 @@ namespace Xamarin.Tests { parameters.AssemblyResolver = resolver; assembly = AssemblyDefinition.ReadAssembly (Out ?? (Path.Combine (TmpDirectory, Path.GetFileNameWithoutExtension (ApiDefinitions [0]).Replace ('-', '_') + ".dll")), parameters); } + return assembly; } void EnsureTempDir () diff --git a/tests/generator/tests/no-availability-for-accessors.cs b/tests/generator/tests/no-availability-for-accessors.cs new file mode 100644 index 0000000000..e827db70fe --- /dev/null +++ b/tests/generator/tests/no-availability-for-accessors.cs @@ -0,0 +1,56 @@ +using System; + +using Foundation; +using ObjCRuntime; + +namespace NS { + [BaseType (typeof (NSObject))] + interface Whatever : IProtocol { + [Export ("propA")] + NSObject PropA { + get; + [NoiOS] + set; + } + + [Export ("propB")] + NSObject PropB { + [NoiOS] + get; + set; + } + } + + [Protocol] + interface IProtocol { + [Abstract] + [Export ("iPropA")] + NSObject IPropA { + get; + [NoiOS] + set; + } + + [Abstract] + [Export ("iPropB")] + NSObject IPropB { + [NoiOS] + get; + set; + } + + [Export ("iPropAOpt")] + NSObject IPropAOpt { + get; + [NoiOS] + set; + } + + [Export ("iPropBOpt")] + NSObject IPropBOpt { + [NoiOS] + get; + set; + } + } +} From dc5d3b2a99d0afe6942009c298ee7677ba59bc2a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Jan 2023 17:09:47 +0100 Subject: [PATCH 26/60] [tests] Hardcode the SupportedOSPlatformVersion for the .NET 6 tests. (#17248) .NET 6 doesn't define the minimum supported OS version property, which means we can't use the existing logic to automatically determine the min OS version to use as the default SupportedOSPlatformVersion in the .NET 6, so hardcode the value. --- tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj | 1 + tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj | 1 + tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj | 1 + tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj | 1 + 4 files changed, 4 insertions(+) diff --git a/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj index ccebf1f778..9e013fe6ea 100644 --- a/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-maccatalyst + 14.0 diff --git a/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj index bbb942faa1..e2ee33af73 100644 --- a/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-ios + 11.0 diff --git a/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj index 56f7fe0d8c..c3586842bb 100644 --- a/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-macos + 10.15 diff --git a/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj index 07832eb3e0..56313acece 100644 --- a/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-tvos + 11.0 From 616c90dd74b2c70eaf7abaa57da2233654e4ab52 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Jan 2023 18:50:18 +0100 Subject: [PATCH 27/60] [WebKit] Merge partial interfaces. (#17265) There's no reason to have multiple partial interfaces in the same code file, so just merge them. --- src/webkit.cs | 56 ++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/src/webkit.cs b/src/webkit.cs index f5fd764801..3cf9ded9c3 100644 --- a/src/webkit.cs +++ b/src/webkit.cs @@ -1705,6 +1705,12 @@ namespace WebKit { [Export ("click")] void Click (); + + [Export ("form", ArgumentSemantic.Retain)] + DomHtmlFormElement Form { get; } + + [Export ("files", ArgumentSemantic.Retain), Mac (10, 9)] + DomFileList Files { get; set; } } [NoiOS, NoTV, NoWatch, NoMacCatalyst] @@ -1754,6 +1760,9 @@ namespace WebKit { [Export ("select")] void Select (); + + [Export ("form", ArgumentSemantic.Retain)] + DomHtmlFormElement Form { get; } } [NoiOS, NoTV, NoWatch, NoMacCatalyst] @@ -2290,6 +2299,21 @@ namespace WebKit { [Export ("webView:unableToImplementPolicyWithError:frame:"), EventArgs ("WebFailureToImplementPolicy")] void UnableToImplementPolicy (WebView webView, NSError error, WebFrame frame); + + [Field ("WebActionNavigationTypeKey")] + NSString WebActionNavigationTypeKey { get; } + + [Field ("WebActionElementKey")] + NSString WebActionElementKey { get; } + + [Field ("WebActionButtonKey")] + NSString WebActionButtonKey { get; } + + [Field ("WebActionModifierFlagsKey")] + NSString WebActionModifierFlagsKey { get; } + + [Field ("WebActionOriginalURLKey")] + NSString WebActionOriginalUrlKey { get; } } [NoiOS, NoTV, NoWatch, NoMacCatalyst] @@ -3029,25 +3053,6 @@ namespace WebKit { void SelectSentence (NSObject sender); } - [NoiOS, NoTV, NoWatch, NoMacCatalyst] - partial interface WebPolicyDelegate { - - [Field ("WebActionNavigationTypeKey")] - NSString WebActionNavigationTypeKey { get; } - - [Field ("WebActionElementKey")] - NSString WebActionElementKey { get; } - - [Field ("WebActionButtonKey")] - NSString WebActionButtonKey { get; } - - [Field ("WebActionModifierFlagsKey")] - NSString WebActionModifierFlagsKey { get; } - - [Field ("WebActionOriginalURLKey")] - NSString WebActionOriginalUrlKey { get; } - } - [NoiOS, NoTV, NoWatch, NoMacCatalyst] [Deprecated (PlatformName.MacOSX, 10, 14, message: "No longer supported.")] [BaseType (typeof (DomObject), Name = "DOMBlob")] @@ -3117,19 +3122,6 @@ namespace WebKit { void Reset (); } - partial interface DomHtmlTextAreaElement { - [Export ("form", ArgumentSemantic.Retain)] - DomHtmlFormElement Form { get; } - } - - partial interface DomHtmlInputElement { - [Export ("form", ArgumentSemantic.Retain)] - DomHtmlFormElement Form { get; } - - [Export ("files", ArgumentSemantic.Retain), Mac (10, 9)] - DomFileList Files { get; set; } - } - [NoiOS, NoTV, NoWatch, NoMacCatalyst] [Deprecated (PlatformName.MacOSX, 10, 14, message: "No longer supported.")] [BaseType (typeof (DomHtmlElement), Name = "DOMHTMLAnchorElement")] From 87f4b91f8d1152418568654ad32f299dd13b2419 Mon Sep 17 00:00:00 2001 From: VS MobileTools Engineering Service 2 Date: Tue, 17 Jan 2023 13:14:36 -0500 Subject: [PATCH 28/60] Localized file check-in by OneLocBuild Task: Build definition ID 17751: Build ID 7198107 (#17246) This is the pull request automatically created by the OneLocBuild task in the build process to check-in localized files generated based upon translation source files (.lcl files) handed-back from the downstream localization pipeline. If there are issues in translations, visit https://aka.ms/ceLocBug and log bugs for fixes. The OneLocBuild wiki is https://aka.ms/onelocbuild and the localization process in general is documented at https://aka.ms/AllAboutLoc. --- tools/mtouch/TranslatedAssemblies/Errors.cs.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.de.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.es.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.fr.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.it.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.ja.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.ko.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.pl.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.ru.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.tr.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx | 2 +- tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/mtouch/TranslatedAssemblies/Errors.cs.resx b/tools/mtouch/TranslatedAssemblies/Errors.cs.resx index 948e49ac96..a5e2a31b18 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.cs.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.cs.resx @@ -1747,7 +1747,7 @@ Nelze vytvořit instanci typu {0}. - An exception occurred while trying to invoke the function {0}: {1} + Při pokusu o vyvolání funkce {0} došlo k výjimce: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.de.resx b/tools/mtouch/TranslatedAssemblies/Errors.de.resx index d3fd283db2..afefd29dd0 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.de.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.de.resx @@ -1747,7 +1747,7 @@ Es kann keine Instanz des Typs {0}erstellt werden. - An exception occurred while trying to invoke the function {0}: {1} + Ausnahme beim Aufrufen der Funktion {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.es.resx b/tools/mtouch/TranslatedAssemblies/Errors.es.resx index e3d027d240..137b6b9801 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.es.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.es.resx @@ -1747,7 +1747,7 @@ No se puede crear una instancia de tipo {0}. - An exception occurred while trying to invoke the function {0}: {1} + Excepción al intentar invocar la función {0}: {1}. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.fr.resx b/tools/mtouch/TranslatedAssemblies/Errors.fr.resx index 69315e6365..c2d4027c31 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.fr.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.fr.resx @@ -1747,7 +1747,7 @@ Impossible de créer une instance du type {0}. - An exception occurred while trying to invoke the function {0}: {1} + Une exception s’est produite lors de la tentative d’appel de la fonction {0} : {1}. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.it.resx b/tools/mtouch/TranslatedAssemblies/Errors.it.resx index 71746a6957..c46ff95efa 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.it.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.it.resx @@ -1747,7 +1747,7 @@ Impossibile creare un'istanza del tipo di {0}. - An exception occurred while trying to invoke the function {0}: {1} + È stata rilevata un'eccezione durante un tentativo di richiamare la funzione {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.ja.resx b/tools/mtouch/TranslatedAssemblies/Errors.ja.resx index b13c0a8f91..5340eeb6cd 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.ja.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.ja.resx @@ -1748,7 +1748,7 @@ 型 {0} のインスタンスを作成できません。 - An exception occurred while trying to invoke the function {0}: {1} + 関数 {0} の呼び出し中に例外が発生しました: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.ko.resx b/tools/mtouch/TranslatedAssemblies/Errors.ko.resx index b10e67af53..17c358f6f4 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.ko.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.ko.resx @@ -1747,7 +1747,7 @@ {0} 형식의 인스턴스를 만들 수 없습니다. - An exception occurred while trying to invoke the function {0}: {1} + 함수 {0}: {1}을(를) 호출하는 동안 예외가 발생했습니다. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.pl.resx b/tools/mtouch/TranslatedAssemblies/Errors.pl.resx index d0b71ba9ba..f89251ca29 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.pl.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.pl.resx @@ -1747,7 +1747,7 @@ Nie można utworzyć wystąpienia typu {0}. - An exception occurred while trying to invoke the function {0}: {1} + Wystąpił wyjątek podczas próby wywołania funkcji {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx b/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx index 624385bb9a..0870e68ae6 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx @@ -1747,7 +1747,7 @@ Não foi possível criar uma instância do tipo {0}. - An exception occurred while trying to invoke the function {0}: {1} + Ocorreu uma exceção ao tentar invocar a função {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.ru.resx b/tools/mtouch/TranslatedAssemblies/Errors.ru.resx index 5f1c57ac02..60b84af388 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.ru.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.ru.resx @@ -1747,7 +1747,7 @@ Невозможно создать экземпляр типа {0}. - An exception occurred while trying to invoke the function {0}: {1} + Возникло исключение при попытке вызвать функцию {0}: {1}. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.tr.resx b/tools/mtouch/TranslatedAssemblies/Errors.tr.resx index fdf30183ec..e822cd6083 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.tr.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.tr.resx @@ -1747,7 +1747,7 @@ {0} türünde örnek oluşturulamıyor. - An exception occurred while trying to invoke the function {0}: {1} + {0} işlevi çağrılmaya çalışılırken özel durum oluştu: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx index 5ca5560deb..aa470ad72a 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx @@ -1747,7 +1747,7 @@ 无法创建类型 {0} 的实例。 - An exception occurred while trying to invoke the function {0}: {1} + 尝试调用函数 {0} 时发生异常: {1}。 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx index e520853a1c..07e9d37ca8 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx @@ -1747,7 +1747,7 @@ 無法建立 {0} 類型的執行個體。 - An exception occurred while trying to invoke the function {0}: {1} + 嘗試叫用函數 {0} 時發生例外狀況: {1} 0: name of function 1: exception info From 1084dcaf4ba2a4204b8b50260c7161ae2a3d2613 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 07:13:35 +0100 Subject: [PATCH 29/60] [ContactsUI] Ensure availability attributes are identical on all platforms. (#17233) Ensure availability attributes are identical on all platforms by not putting them inside conditional compilation. --- src/contactsui.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/contactsui.cs b/src/contactsui.cs index 9cdb3d301e..0c5d982c8d 100644 --- a/src/contactsui.cs +++ b/src/contactsui.cs @@ -121,12 +121,19 @@ namespace ContactsUI { ICNKeyDescriptor DescriptorForRequiredKeys { get; } #if MONOMAC - [NullAllowed, Export ("contact", ArgumentSemantic.Copy)] - CNContact Contact { get; [NoiOS]set; } + [NullAllowed] + [Export ("contact", ArgumentSemantic.Copy)] #else [Export ("contact", ArgumentSemantic.Strong)] - CNContact Contact { get; } #endif + CNContact Contact { + get; + [NoiOS] + [NoTV] + [NoWatch] + [NoMacCatalyst] + set; + } [NoMac] [Static] From 49d13fc0efe5e462a4a5273d26fe4245f19b8389 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 07:13:58 +0100 Subject: [PATCH 30/60] [AppKit] Bind an NSWindow(IntPtr) constructor in the API definition. (#17264) This simplifies our manual bindings a little bit. --- src/AppKit/NSWindow.cs | 6 ++++++ src/appkit.cs | 6 ++++++ tests/cecil-tests/ConstructorTest.cs | 1 + .../xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore | 1 - 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/AppKit/NSWindow.cs b/src/AppKit/NSWindow.cs index 71604a914f..d9be1d2406 100644 --- a/src/AppKit/NSWindow.cs +++ b/src/AppKit/NSWindow.cs @@ -59,6 +59,7 @@ namespace AppKit { } } +#if !NET static IntPtr selInitWithWindowRef = Selector.GetHandle ("initWithWindowRef:"); // Do not actually export because NSObjectFlag is not exportable. @@ -74,10 +75,15 @@ namespace AppKit { } InitializeReleasedWhenClosed (); } +#endif static public NSWindow FromWindowRef (IntPtr windowRef) { +#if NET + return new NSWindow (windowRef); +#else return new NSWindow (windowRef, NSObjectFlag.Empty); +#endif } void InitializeReleasedWhenClosed () diff --git a/src/appkit.cs b/src/appkit.cs index 819c86fa5d..25bc1696bf 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -20649,6 +20649,12 @@ namespace AppKit { [PostSnippet ("InitializeReleasedWhenClosed ();", Optimizable = true)] NativeHandle Constructor (CGRect contentRect, NSWindowStyle aStyle, NSBackingStore bufferingType, bool deferCreation, NSScreen screen); +#if NET + [Export ("initWithWindowRef:")] + [PostSnippet ("InitializeReleasedWhenClosed ();", Optimizable = true)] + NativeHandle Constructor (IntPtr windowRef); +#endif + [Export ("title")] string Title { get; set; } diff --git a/tests/cecil-tests/ConstructorTest.cs b/tests/cecil-tests/ConstructorTest.cs index 10cfb72ac1..e0c27cb0b6 100644 --- a/tests/cecil-tests/ConstructorTest.cs +++ b/tests/cecil-tests/ConstructorTest.cs @@ -255,6 +255,7 @@ namespace Cecil.Tests { case "NSConditionLock": // has a nint (i.e. IntPtr) constructor (condition) - not a mistake case "NSScrubberProportionalLayout": // has a nint (i.e. IntPtr) constructor (numberOfVisibleItems) - not a mistake case "NSIndexSet": // has a nuint (i.e. UIntPtr) constructor (index) - not a mistake + case "NSWindow": // has an actual IntPtr constructor (initWithWindowRef:) - not a mistake continue; } diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore index c44407e73a..f10fa3ed59 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore @@ -1697,7 +1697,6 @@ !missing-selector! NSWindow::handleSaveScriptCommand: not bound !missing-selector! NSWindow::hasCloseBox not bound !missing-selector! NSWindow::hasTitleBar not bound -!missing-selector! NSWindow::initWithWindowRef: not bound !missing-selector! NSWindow::isFloatingPanel not bound !missing-selector! NSWindow::isMiniaturizable not bound !missing-selector! NSWindow::isModalPanel not bound From 4bf97d11d0d37116e0a3132398b7ab7081a0042f Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 07:50:03 +0100 Subject: [PATCH 31/60] [SceneKit] SCNLight.[Get|Set]Attribute do not exist on MacCatalyst, so make it explicit that they aren't. (#17266) --- src/scenekit.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scenekit.cs b/src/scenekit.cs index 96c943526c..31d2c5819e 100644 --- a/src/scenekit.cs +++ b/src/scenekit.cs @@ -1285,6 +1285,7 @@ namespace SceneKit { #endif [NoTV] [Deprecated (PlatformName.MacOSX, 10, 10)] + [NoMacCatalyst] [Export ("attributeForKey:")] [return: NullAllowed] NSObject GetAttribute (NSString lightAttribute); @@ -1296,6 +1297,7 @@ namespace SceneKit { #endif [NoTV] [Deprecated (PlatformName.MacOSX, 10, 10)] + [NoMacCatalyst] [Export ("setAttribute:forKey:")] void SetAttribute ([NullAllowed] NSObject value, NSString attribuetKey); From 74ceecaf3f32ed8cb58bdb7204a7886488579a49 Mon Sep 17 00:00:00 2001 From: Steve Hawley Date: Wed, 18 Jan 2023 10:25:52 -0500 Subject: [PATCH 32/60] [dotnet] last of the strings in pinvokes are gone (#17205) removed strings from pinvokes in ObjCRuntime --- src/ObjCRuntime/Class.cs | 83 +++++++++++++++++++++++--- src/ObjCRuntime/Dlfcn.cs | 16 ++++- src/ObjCRuntime/Protocol.cs | 38 ++++++++++-- src/ObjCRuntime/Runtime.cs | 7 ++- src/ObjCRuntime/Runtime.iOS.cs | 5 +- tests/cecil-tests/BlittablePInvokes.cs | 2 +- 6 files changed, 132 insertions(+), 19 deletions(-) diff --git a/src/ObjCRuntime/Class.cs b/src/ObjCRuntime/Class.cs index 3950ea3721..de5f758447 100644 --- a/src/ObjCRuntime/Class.cs +++ b/src/ObjCRuntime/Class.cs @@ -646,25 +646,56 @@ namespace ObjCRuntime { } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal static extern IntPtr objc_allocateClassPair (IntPtr superclass, string name, IntPtr extraBytes); + static extern IntPtr objc_allocateClassPair (IntPtr superclass, IntPtr name, IntPtr extraBytes); + + internal static IntPtr objc_allocateClassPair (IntPtr superclass, string name, IntPtr extraBytes) + { + using var namePtr = new TransientString (name); + return objc_allocateClassPair (superclass, namePtr, extraBytes); + } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal static extern IntPtr objc_getClass (string name); + static extern IntPtr objc_getClass (IntPtr name); + + internal static IntPtr objc_getClass (string name) + { + using var namePtr = new TransientString (name); + return objc_getClass (namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal static extern void objc_registerClassPair (IntPtr cls); [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] - internal static extern bool class_addIvar (IntPtr cls, string name, IntPtr size, byte alignment, string types); + static extern bool class_addIvar (IntPtr cls, IntPtr name, IntPtr size, byte alignment, IntPtr types); + + internal static bool class_addIvar (IntPtr cls, string name, IntPtr size, byte alignment, string types) + { + using var namePtr = new TransientString (name); + using var typesPtr = new TransientString (types); + return class_addIvar (cls, namePtr, size, alignment, typesPtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] - internal static extern bool class_addMethod (IntPtr cls, IntPtr name, IntPtr imp, string types); + static extern bool class_addMethod (IntPtr cls, IntPtr name, IntPtr imp, IntPtr types); + + internal static bool class_addMethod (IntPtr cls, IntPtr name, IntPtr imp, string types) + { + using var typesPtr = new TransientString (types); + return class_addMethod (cls, name, imp, typesPtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] - internal extern static bool class_addMethod (IntPtr cls, IntPtr name, Delegate imp, string types); + internal extern static bool class_addMethod (IntPtr cls, IntPtr name, Delegate imp, IntPtr types); + + internal static bool class_addMethod (IntPtr cls, IntPtr name, Delegate imp, string types) + { + using var typesPtr = new TransientString (types); + return class_addMethod (cls, name, imp, typesPtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] @@ -683,14 +714,52 @@ namespace ObjCRuntime { internal extern static IntPtr class_getMethodImplementation (IntPtr cls, IntPtr sel); [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static IntPtr class_getInstanceVariable (IntPtr cls, string name); + internal extern static IntPtr class_getInstanceVariable (IntPtr cls, IntPtr name); + + internal static IntPtr class_getInstanceVariable (IntPtr cls, string name) + { + using var namePtr = new TransientString (name); + return class_getInstanceVariable (cls, namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal extern static IntPtr class_getInstanceMethod (IntPtr cls, IntPtr sel); [DllImport (Messaging.LIBOBJC_DYLIB, CharSet = CharSet.Ansi)] [return: MarshalAs (UnmanagedType.U1)] - internal extern static bool class_addProperty (IntPtr cls, string name, objc_attribute_prop [] attributes, int count); + extern unsafe static bool class_addProperty (IntPtr cls, IntPtr name, IntPtr* attributes, int count); + + internal static bool class_addProperty (IntPtr cls, string name, objc_attribute_prop [] attributes, int count) + { + using var namePtr = new TransientString (name, TransientString.Encoding.Ansi); + var ptrs = PropertyStringsToPtrs (attributes); + bool retval = false; + unsafe { + fixed (IntPtr* ptrsPtr = ptrs) { + retval = class_addProperty (cls, namePtr, ptrsPtr, count); + } + } + FreeStringPtrs (ptrs); + return retval; + } + + internal static IntPtr [] PropertyStringsToPtrs (objc_attribute_prop [] props) + { + var ptrs = new IntPtr [props.Length * 2]; + var index = 0; + foreach (var prop in props) { + ptrs [index++] = Marshal.StringToHGlobalAnsi (prop.name); + ptrs [index++] = Marshal.StringToHGlobalAnsi (prop.value); + } + return ptrs; + } + + internal static void FreeStringPtrs (IntPtr [] ptrs) + { + foreach (var ptr in ptrs) { + Marshal.FreeHGlobal (ptr); + } + } [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)] internal struct objc_attribute_prop { diff --git a/src/ObjCRuntime/Dlfcn.cs b/src/ObjCRuntime/Dlfcn.cs index 41f23151cd..eed92987d3 100644 --- a/src/ObjCRuntime/Dlfcn.cs +++ b/src/ObjCRuntime/Dlfcn.cs @@ -109,7 +109,13 @@ namespace ObjCRuntime { public static extern int dlclose (IntPtr handle); [DllImport (Constants.libSystemLibrary, EntryPoint = "dlopen")] - internal static extern IntPtr _dlopen (string? path, Mode mode /* this is int32, not nint */); + static extern IntPtr _dlopen (IntPtr path, Mode mode /* this is int32, not nint */); + + internal static IntPtr _dlopen (string? path, Mode mode /* this is int32, not nint */) + { + using var pathPtr = new TransientString (path); + return _dlopen (pathPtr, mode); + } public static IntPtr dlopen (string? path, int mode) { @@ -148,7 +154,13 @@ namespace ObjCRuntime { } [DllImport (Constants.libSystemLibrary)] - public static extern IntPtr dlsym (IntPtr handle, string symbol); + static extern IntPtr dlsym (IntPtr handle, IntPtr symbol); + + public static IntPtr dlsym (IntPtr handle, string symbol) + { + using var symbolPtr = new TransientString (symbol); + return dlsym (handle, symbolPtr); + } public static IntPtr dlsym (RTLD lookupType, string symbol) { diff --git a/src/ObjCRuntime/Protocol.cs b/src/ObjCRuntime/Protocol.cs index 1033cf981d..913de56a10 100644 --- a/src/ObjCRuntime/Protocol.cs +++ b/src/ObjCRuntime/Protocol.cs @@ -62,19 +62,49 @@ namespace ObjCRuntime { } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static IntPtr objc_getProtocol (string? name); + extern static IntPtr objc_getProtocol (IntPtr name); + + internal static IntPtr objc_getProtocol (string? name) + { + var namePtr = new TransientString (name); + return objc_getProtocol (namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static IntPtr objc_allocateProtocol (string name); + extern static IntPtr objc_allocateProtocol (IntPtr name); + + internal static IntPtr objc_allocateProtocol (string name) + { + using var namePtr = new TransientString (name); + return objc_allocateProtocol (namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal extern static void objc_registerProtocol (IntPtr protocol); [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static void protocol_addProperty (IntPtr protocol, string name, Class.objc_attribute_prop [] attributes, int count, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + extern static unsafe void protocol_addProperty (IntPtr protocol, IntPtr name, IntPtr* attributes, int count, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + + internal static void protocol_addProperty (IntPtr protocol, string name, Class.objc_attribute_prop [] attributes, int count, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance) + { + using var namePtr = new TransientString (name); + var propArr = Class.PropertyStringsToPtrs (attributes); + unsafe { + fixed (IntPtr* propArrPtr = propArr) { + protocol_addProperty (protocol, namePtr, propArrPtr, count, isRequired, isInstance); + } + } + Class.FreeStringPtrs (propArr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static void protocol_addMethodDescription (IntPtr protocol, IntPtr nameSelector, string signature, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + extern static void protocol_addMethodDescription (IntPtr protocol, IntPtr nameSelector, IntPtr signature, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + + internal static void protocol_addMethodDescription (IntPtr protocol, IntPtr nameSelector, string signature, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance) + { + using var signaturePtr = new TransientString (signature); + protocol_addMethodDescription (protocol, nameSelector, signaturePtr, isRequired, isInstance); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal extern static void protocol_addProtocol (IntPtr protocol, IntPtr addition); diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index d289f5ce94..1f62edfd20 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -1855,8 +1855,8 @@ namespace ObjCRuntime { ConnectMethod (method.DeclaringType!, method, selector); } - [DllImport ("__Internal", CharSet = CharSet.Unicode)] - extern static void xamarin_log (string s); + [DllImport ("__Internal")] + extern static void xamarin_log (IntPtr s); [DllImport (Constants.libcLibrary)] extern static nint write (int filedes, byte [] buf, nint nbyte); @@ -1864,7 +1864,8 @@ namespace ObjCRuntime { internal static void NSLog (string value) { try { - xamarin_log (value); + using var valuePtr = new TransientString (value, TransientString.Encoding.Unicode); + xamarin_log (valuePtr); } catch { // Append a newline like NSLog does if (!value.EndsWith ('\n')) diff --git a/src/ObjCRuntime/Runtime.iOS.cs b/src/ObjCRuntime/Runtime.iOS.cs index 247d76d7fe..4e50f4be36 100644 --- a/src/ObjCRuntime/Runtime.iOS.cs +++ b/src/ObjCRuntime/Runtime.iOS.cs @@ -144,7 +144,7 @@ namespace ObjCRuntime { } [DllImport ("__Internal")] - static extern void xamarin_start_wwan (string uri); + static extern void xamarin_start_wwan (IntPtr uri); public static void StartWWAN (Uri uri) { @@ -157,7 +157,8 @@ namespace ObjCRuntime { if (Runtime.Arch == Arch.SIMULATOR) return; - xamarin_start_wwan (uri.ToString ()); + using var uriPtr = new TransientString (uri.ToString ()); + xamarin_start_wwan (uriPtr); } #endif // !TVOS && !WATCH #endif // !COREBUILD diff --git a/tests/cecil-tests/BlittablePInvokes.cs b/tests/cecil-tests/BlittablePInvokes.cs index 749a2c09f7..0e216e72ba 100644 --- a/tests/cecil-tests/BlittablePInvokes.cs +++ b/tests/cecil-tests/BlittablePInvokes.cs @@ -41,7 +41,7 @@ namespace Cecil.Tests { public string Reason; } - [Ignore ("work in progress - there are 100 failures, mostly due to strings")] + [Ignore ("work in progress - there are 40 failures, mostly due to delegates")] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformImplementationAssemblyDefinitions))] public void CheckForNonBlittablePInvokes (AssemblyInfo info) { From 75499e425346768192124fb6a10951667d33efd6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 18:25:01 +0100 Subject: [PATCH 33/60] Update DOWNLOADS.md with new releases. Fixes #16625. (#17271) Fixes https://github.com/xamarin/xamarin-macios/issues/16625. --- DOWNLOADS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DOWNLOADS.md b/DOWNLOADS.md index 8ad7ec547f..5fc055e2df 100644 --- a/DOWNLOADS.md +++ b/DOWNLOADS.md @@ -2,7 +2,8 @@ | Date | Version | Package | Release Notes | |------|---------|---------|---------------| -|2022/09/27|16.0.0.72|[xamarin.ios-16.0.0.72.pkg](https://download.visualstudio.microsoft.com/download/pr/60e4de68-2380-4aa3-b12e-2c65838a0bdb/656877ed7c3b5e5b94f7d2fbeb886655/xamarin.ios-16.0.0.72.pkg)|| +|2022/12/15|16.1.1.27|[xamarin.ios-16.1.1.27.pkg](https://download.visualstudio.microsoft.com/download/pr/c8bc547f-869e-4d64-a271-f8b3a29ee545/3d8cfa414fa3e4005dd5b9b9d3817aa4/xamarin.ios-16.1.1.27.pkg)|| +|2022/10/11|16.0.0.72|[xamarin.ios-16.0.0.72.pkg](https://download.visualstudio.microsoft.com/download/pr/81c41aaa-a3d7-4875-8416-d04b472379b7/21d9f6c5ad3a6bc2479b2ec4b0685b6c/xamarin.ios-16.0.0.72.pkg)|| |2022/08/09|15.12.0.2|[xamarin.ios-15.12.0.2.pkg](https://download.visualstudio.microsoft.com/download/pr/e81e04d3-768a-4310-9c9b-f32e8ba00eaa/0e27caf0877adb5c6fe6d634d26da40a/xamarin.ios-15.12.0.2.pkg)|| |2022/06/14|15.10.0.5|[xamarin.ios-15.10.0.5.pkg](https://download.visualstudio.microsoft.com/download/pr/09e9572f-1c2a-4d79-a1e8-5469de9410e8/3c7be8df7e8249f2c3142e4c10ae5523/xamarin.ios-15.10.0.5.pkg)|| |2022/05/23|15.10.0.1|[xamarin.ios-15.10.0.1.pkg](https://download.visualstudio.microsoft.com/download/pr/afed6f32-67b3-4684-b0a4-e2b74d751bce/efaa7d62658b8285baafc2d6fc8f930a/xamarin.ios-15.10.0.1.pkg)|| @@ -169,6 +170,7 @@ | Date | Version | Package | Release Notes | |------|---------|---------|---------------| +|2022/12/15|9.0.0.27|[xamarin.mac-9.0.0.27.pkg](https://download.visualstudio.microsoft.com/download/pr/c8bc547f-869e-4d64-a271-f8b3a29ee545/4fbfc55453fe36fe5bf4128d6d495911/xamarin.mac-9.0.0.27.pkg)|| |2022/08/09|8.12.0.2|[xamarin.mac-8.12.0.2.pkg](https://download.visualstudio.microsoft.com/download/pr/e81e04d3-768a-4310-9c9b-f32e8ba00eaa/bcff5cca8701bc5871b8892fd32fb3e6/xamarin.mac-8.12.0.2.pkg)|| |2022/06/14|8.10.0.5|[xamarin.mac-8.10.0.5.pkg](https://download.visualstudio.microsoft.com/download/pr/09e9572f-1c2a-4d79-a1e8-5469de9410e8/f4ee484851ac275ccd51fcee70451fb0/xamarin.mac-8.10.0.5.pkg)|| |2022/05/23|8.10.0.1|[xamarin.mac-8.10.0.1.pkg](https://download.visualstudio.microsoft.com/download/pr/afed6f32-67b3-4684-b0a4-e2b74d751bce/7a6059ca429d778d1e1a3525a337eb66/xamarin.mac-8.10.0.1.pkg)|| From 0fa793ee2839da62b3ee6eff9f8ed3f94fe75b8c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 18:32:57 +0100 Subject: [PATCH 34/60] [StoreKit] Add missing setters to several StoreProductParameters properties. Fixes #16838. (#17275) Fixes https://github.com/xamarin/xamarin-macios/issues/16838. --- src/storekit.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/storekit.cs b/src/storekit.cs index 0852fcfa2c..8a52be80fe 100644 --- a/src/storekit.cs +++ b/src/storekit.cs @@ -652,11 +652,11 @@ namespace StoreKit { [iOS (11, 0)] [TV (11, 0)] [Export ("ProductIdentifier")] - string ProductIdentifier { get; } + string ProductIdentifier { get; set; } [iOS (8, 3)] [Export ("ProviderToken")] - string ProviderToken { get; } + string ProviderToken { get; set; } [iOS (11, 3), TV (11, 3), NoMac] [Export ("AdNetworkAttributionSignature")] @@ -680,11 +680,11 @@ namespace StoreKit { [NoWatch, NoMac, TV (14, 0), iOS (14, 0)] [Export ("AdNetworkSourceAppStoreIdentifier")] - string AdNetworkSourceAppStoreIdentifier { get; } + string AdNetworkSourceAppStoreIdentifier { get; set; } [NoWatch, NoMac, TV (14, 0), iOS (14, 0)] [Export ("AdNetworkVersion")] - string AdNetworkVersion { get; } + string AdNetworkVersion { get; set; } } [NoWatch] From f2cbd7657c9f0c127240d850e65a6e18b8a13e0f Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 18:33:16 +0100 Subject: [PATCH 35/60] [fabricbot] Add bot rule to manage 'move-to-vs-feedback' issues (#17270) New workflows: 1. When a `move-to-vs-feedback` label is applied to an issue, tell the user to use the VS Feedback tool instead. 2. If issue is commented on within 3 days, mark as `needs-attention`. 3. If issue is inactive for 3 days, close the issue. This is a shameless copy of https://github.com/dotnet/maui/commit/05c5e202a367b966f1dab542e988f40a07d8eeb1. --- .github/fabricbot.json | 225 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 1 deletion(-) diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 1857296f70..07ab836cb9 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -544,5 +544,228 @@ } ] } - } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "labelAdded", + "parameters": { + "label": "move-to-vs-feedback" + } + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "Ask user to use VS Feedback for VS issues", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "Thanks for the issue report @${issueAuthor}! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.\n\nIf you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.\n\n1. Go to the [Visual Studio for Windows feedback tool](https://docs.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2022) or [Visual Studio for Mac feedback tool](https://learn.microsoft.com/en-us/visualstudio/mac/report-a-problem?view=vsmac-2022) to report the issue\n2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.\n\nThis issue will be automatically closed in 3 days if there are no further comments." + } + } + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "frequency": [ + { + "weekDay": 0, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 1, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 2, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 3, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 4, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 5, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 6, + "hours": [ + 0, + 6, + 12, + 18 + ] + } + ], + "searchTerms": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "move-to-vs-feedback" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 3 + } + } + ], + "taskName": "Close 'move-to-vs-feedback' after 3 days of no activity", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "This issue is being closed due to inactivity. If this issue is still affecting you, please follow the steps above to use the VS Feedback Tool to report the issue." + } + }, + { + "name": "closeIssue", + "parameters": {} + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "isAction", + "parameters": { + "action": "created" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "move-to-vs-feedback" + } + }, + { + "operator": "not", + "operands": [ + { + "name": "noActivitySince", + "parameters": { + "days": 3 + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isCloseAndComment", + "parameters": {} + } + ] + }, + { + "name": "isActivitySender", + "parameters": { + "user": { + "type": "author" + } + } + }, + { + "name": "activitySenderHasPermissions", + "parameters": { + "permissions": "none" + } + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issue_comment" + ], + "taskName": "For issues labeled with 'move-to-vs-feedback' mark as 'need-attention' if there is activity", + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "move-to-vs-feedback" + } + }, + { + "name": "addLabel", + "parameters": { + "label": "need-attention" + } + } + ] + } + } ] From 49c3fd44f5bcdd9313e144206d408df68b98f367 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 18:33:48 +0100 Subject: [PATCH 36/60] [fabricbot] Handle the 'need-repro' label. (#17272) Handle the 'need-repro' label like the 'need-info' label: * Add a comment that we need a repro, and how to get one. * Close the issue if no comments within 7 days. * Add a 'need-attention' label if reporter comments. Also add a document explaining how to create a repro, modeled after (copied) MAUI's document (https://github.com/dotnet/maui/blob/main/.github/repro.md). --- .github/fabricbot.json | 278 ++++++++++++++++++++++++++++++++++++++--- docs/bug-repro.md | 159 +++++++++++++++++++++++ 2 files changed, 423 insertions(+), 14 deletions(-) create mode 100644 docs/bug-repro.md diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 07ab836cb9..6b523c758c 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -32,6 +32,233 @@ ] } }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "labelAdded", + "parameters": { + "label": "need-repro" + } + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "Add comment when 'need-repro' is applied to issue", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "Hi @${issueAuthor}. We have added the \"need-repro\" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/xamarin/xamarin-macios/blob/main/docs/bug-repro.md\n\nThis issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time." + } + } + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "frequency": [ + { + "weekDay": 1, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 2, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 3, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 4, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 5, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + } + ], + "searchTerms": [ + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "isOpen", + "parameters": {} + }, { + "name": "hasLabel", + "parameters": { + "label": "need-info" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 7 + } + } + ], + "taskName": "[Idle Issue Management] Close stale 'need-info' issues", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "Hi @${issueAuthor}. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you." + } + }, + { + "name": "closeIssue", + "parameters": {} + } + ] + } + }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", @@ -199,12 +426,12 @@ "name": "isOpen", "parameters": {} }, - { - "name": "hasLabel", - "parameters": { - "label": "need-info" - } - }, + { + "name": "hasLabel", + "parameters": { + "label": "need-repro" + } + }, { "name": "noActivitySince", "parameters": { @@ -212,7 +439,7 @@ } } ], - "taskName": "[Idle Issue Management] Close stale 'need-info' issues", + "taskName": "[Idle Issue Management] Close stale 'need-repro' issues", "actions": [ { "name": "addReply", @@ -246,12 +473,23 @@ "name": "isOpen", "parameters": {} }, - { - "name": "hasLabel", - "parameters": { - "label": "need-info" - } - }, + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "need-info" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "need-repro" + } + } + ] + }, { "operator": "not", "operands": [ @@ -280,7 +518,7 @@ "eventNames": [ "issue_comment" ], - "taskName": "[Idle Issue Management] Replace 'need-info' with 'need-attention' label when the customer comments on an issue", + "taskName": "[Idle Issue Management] Replace 'need-info' and 'need-repro' with 'need-attention' label when the customer comments on an issue", "actions": [ { "name": "removeLabel", @@ -288,6 +526,12 @@ "label": "need-info" } }, + { + "name": "removeLabel", + "parameters": { + "label": "need-repro" + } + }, { "name": "addLabel", "parameters": { @@ -379,6 +623,12 @@ "label": "need-info" } }, + { + "name": "removeLabel", + "parameters": { + "label": "need-repro" + } + }, { "name": "addLabel", "parameters": { diff --git a/docs/bug-repro.md b/docs/bug-repro.md new file mode 100644 index 0000000000..ec0796b2a5 --- /dev/null +++ b/docs/bug-repro.md @@ -0,0 +1,159 @@ +# Bug Report Reproduction Guide + +First of all, thank you for reporting this potential bug. Nobody likes bugs +and to help us diagnose and resolve your potential issue as effective and +quickly as possible, we would like to give you a bit more information about +why we ask you for a reproducible example of the problem, and how to provide +one. + +## What is a reproduction? + +A reproduction, reproducible example or just repro for short is the most basic +code to demonstrate the issue that you're seeing. It's the simplest way to +reproduce the issue. Ideally, you should be able to reproduce the issue by +just running the code in the project you have provided and see the problem. If +any reproduction steps are needed, either note them in the issue or include +them in the project somehow. + +## Why do we ask for a reproducible example? + +Depending on your project a codebase can be pretty big. The bigger your +project, the more factors that can be of influence on a bug or issue that you +might be seeing. + +In order to be sure that this is something that is happening in the Apple SDKs +for .NET and not something in your code (or a combination of these things), it +is super helpful to have a small sample that reproduces the issue. This way we +can: + +* better pinpoint the source of the issue +* therefore, we can fix the issue faster +* and we can make sure that the issue is not a false positive + +It also acts as a double-edged sword. When you take your code apart +piece-by-piece in a new project, adding things back one by one, it will become +very clear what different factors are at play here and you might discover that +the issue might be something in your code. At the very least you will be able +to provide a very detailed description of what you're seeing. That helps us +get to the cause faster and resolve the issue quicker. + +### I just want to report a bug, why do you want a reproduction? + +We hear this a lot. We understand you're busy, we're all busy! A reproduction +is not just about pleasing us or you doing our work. As already mentioned +above, it will help you get a better understanding of where the issue is +exactly. We've seen lots of cases where people realized, through a +reproduction, that the solution was right within their reach. Regardless of it +being a bug in this .NET SDK or not. + +We like to see this as a team effort. + +#### But I don't have time for this! + +Please help us, help you! This is an open-source project under the MIT +license. We care about our project and therefore by extension also about your +project. But realize that when you come onto our repo, maybe frustrated +because things are not working and you just drop a one-liner, no reproduction, +mentioning that you don't have the time, that's also not very motivating for +us. On the other end of these GitHub issues are still people. People that are +doing their best to move this project forward, people that do not enjoying +seeing you being blocked. + +Also consider how that comes across. If you don't have the time to report in +detail what is going on, then really how important is the issue? If this is +really important and blocking you, it would seem to make sense to prioritize +getting us all the details to help resolve this faster. We are all here to +help you. But remember that we don't know your project and we don't know any +details, please help us understand and be nice. + +## How to provide a reproduction project? + +With a reproduction we want to rule out a couple of things: + +* The issue is not in your code, but in the iOS/tvOS/macOS/Mac Catalyst SDKs for .NET. +* The issue has not been already resolved in the latest version of the SDK. + +Therefore we would like to propose the following steps to create a reproduction sample: + +* Check if you are using the latest version of the .NET workloads and you can + still reproduce the issue. +* If yes, please check any available preview versions and see if you can + reproduce the issue. +* If you still can, please check to see if there are is an issue already + opened on the repository for it: + * If there is, see if you can add any more detail about your specific case, + that might help to resolve it quicker. If you don't have any additional + information, add an emoji to the first post of the issue so we know how + many people are impacted by this. + * When in doubt, always file a new issue. It's much easier to mark an issue + as a duplicate of another, than it is to split an issue into two (or more) + isssues after an extensive conversation in the issue that effectively + derailed the original issue because it turned out to be something + unrelated. +* If there is no issue for it yet, please open one and provide detailed + answers to everything in the New Issue form. + +At this point we would love for you to include the reproduction. + +* Start with a File > New .NET iOS / tvOS / macOS / Mac Catalyst project, in + other words, a clean, new project. Make sure that you are using the last + version of the .NET workloads. +* Start extracting the code from your project, piece-by-piece, until you have + reached the issue. +* Try to remove some code or make small changes to see how that influences the + issue you're seeing. Remove any code that is not needed to reproduce the + issue. This is noise and will interfere with getting to a cause and + solution. +* Put the code on a GitHub repository and include that link in the issue that + you're opening. +* Get a [binary build log][1] and attach that to the issue as well. + +> **Warning** +> +> **We can't accept any zip files attached to the issue.** If we need the code +> in a zip, we can get that from the GitHub repository. This will also make it +> easier to collaborate. If we think we spot something that doesn't look +> right, we can open a PR on your repro repo (😬) and you can easily see the +> differences. + +## Why can't you just download my zip file reproduction?! + +While we've never had problems with this, it is still a potential attack +vector for hackers and other malicious people. Even unzipping a zip file could +execute code, let alone load code into Visual Studio that we could not +(easily) look at before opening it. Because we value your safety and privacy +as well as our own, we want to make sure that none of this can happen. + +Also, by putting it in a GitHub repo it's easier to potentially collaborate. +We (and our amazing community!) can comment on a piece of code right then and +there and help you further. It can even serve as a nice example for other +people! + +If you don't like to have a lot of repos, you could opt for a repo where on +the `main` branch you put a File > New Project, and from there create branches +for different issues. + +## Big don'ts! + +- Never put any sensitive information in your code. No API keys, credentials, + personal information, etc. +- Never put any propriatary code in your reproduction. We are contractually + not allowed to look at code that you do not own without big legal hassles + and NDA's, that's not fun for anyone. +- Never submit binaries (mostly covered by putting it on a GitHub repo) +- Do not reference external data-sources, this should rarely be needed. +- Always refer to concrete version numbers. Avoid saying "this happens in the + latest version". We don't know if you're using a preview version or maybe + you _think_ you're using the latest version but actually aren't. To avoid + any confusion, always refer to exact version numbers. + +# That's it! + +The first time might take you a bit longer to go through all this, but once +you've done it you'll see it isn't that much more work and it will benefit the +process a lot. + +Thank you so much for taking some of your valuable time to make .NET MAUI the +best version it can be! We really appreciate it. + +[1]: https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#binary-build-logs From b1957c91ce5a11de1ff5591b5c0bdd5af0092315 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 18:54:15 +0100 Subject: [PATCH 37/60] [generator] Fix an issue with regards to attributes from inlined protocols. Fixes #17268. (#17269) In the following scenario: * Type T is not available on a platform (say tvOS). * Protocol P is available on said platform. * A member M of P has its own availability attribute for said platform (for instance if P is available on tvOS 11.0, and the member is available on tvOS 12.0). * The protocol P is inlined into the type T. We'd include the SupportedOSPlatform attribute from the inlined member on generated code on other platforms (so the iOS assembly would say that the inlined member M in T is available on tvOS). Fixes https://github.com/xamarin/xamarin-macios/issues/17268. --- src/generator.cs | 23 +++++++- tests/common/Configuration.cs | 7 +++ tests/common/Profile.cs | 21 +++++++ tests/generator/BGenTests.cs | 57 +++++++++++++++++++ tests/generator/BGenTool.cs | 4 ++ .../attributes-from-inlined-protocols.cs | 32 +++++++++++ 6 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 tests/generator/tests/attributes-from-inlined-protocols.cs diff --git a/src/generator.cs b/src/generator.cs index eb6d11941c..62f3576609 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -3699,8 +3699,12 @@ public partial class Generator : IMemberGatherer { List availabilityToConsider = new List (); if (inlinedTypeAvailability != null) { availabilityToConsider.AddRange (inlinedTypeAvailability); + // Don't copy parent attributes if the conflict with the type we're inlining members into + // Example: don't copy Introduced on top of Unavailable. + CopyValidAttributes (availabilityToConsider, parentContextAvailability); + } else { + availabilityToConsider.AddRange (parentContextAvailability); } - availabilityToConsider.AddRange (parentContextAvailability); // We do not support Watch, so strip from both our input sources before any processing memberAvailability = memberAvailability.Where (x => x.Platform != PlatformName.WatchOS).ToList (); @@ -3712,6 +3716,23 @@ public partial class Generator : IMemberGatherer { // Copy down any unavailable from the parent before expanding, since a [NoMacCatalyst] on the type trumps [iOS] on a member CopyValidAttributes (memberAvailability, availabilityToConsider.Where (attr => attr.AvailabilityKind != AvailabilityKind.Introduced)); + if (inlinedType is not null && inlinedType != mi.DeclaringType && memberAvailability.Count > 1) { + // We might have gotten conflicting availability attributes for inlined members, where the inlined member + // might be available on a platform the target type isn't. The target type's unavailability will come + // later in the list, which means that if we have an unavailable attribute after an introduced attribute, + // then we need to remove the introduced attribute. + for (var i = memberAvailability.Count - 1; i >= 0; i--) { + if (memberAvailability [i].AvailabilityKind != AvailabilityKind.Unavailable) + continue; + for (var k = i - 1; k >= 0; k--) { + if (memberAvailability [k].AvailabilityKind == AvailabilityKind.Introduced && memberAvailability [k].Platform == memberAvailability [i].Platform) { + memberAvailability.RemoveAt (k); + i--; + } + } + } + } + // Add implied catalyst\TVOS from [iOS] _before_ copying down from parent if no catalyst\TVOS attributes // As those take precedent. We will do this a second time later in a moment.. AddImpliedPlatforms (memberAvailability); diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index d971d819e1..7c96e256cf 100644 --- a/tests/common/Configuration.cs +++ b/tests/common/Configuration.cs @@ -715,6 +715,13 @@ namespace Xamarin.Tests { } } + public static string GetBaseLibrary (ApplePlatform platform, bool isDotNet) + { + if (isDotNet) + return Path.Combine (GetRefDirectory (platform), GetBaseLibraryName (platform, isDotNet)); + return GetBaseLibrary (platform.AsProfile ()); + } + static string GetBaseLibraryName (TargetFramework targetFramework) { return GetBaseLibraryName (targetFramework.Platform, targetFramework.IsDotNet); diff --git a/tests/common/Profile.cs b/tests/common/Profile.cs index eab8253de1..f7513f3203 100644 --- a/tests/common/Profile.cs +++ b/tests/common/Profile.cs @@ -11,6 +11,7 @@ namespace Xamarin.Tests { macOSMobile, macOSFull, macOSSystem, + MacCatalyst, } public static class ProfileExtensions { @@ -33,5 +34,25 @@ namespace Xamarin.Tests { throw new NotImplementedException (profile.ToString ()); } } + + public static Profile AsProfile (this ApplePlatform platform) + { + switch (platform) { + case ApplePlatform.iOS: + return Profile.iOS; + case ApplePlatform.MacCatalyst: + return Profile.MacCatalyst; + case ApplePlatform.MacOSX: + return Profile.macOSMobile; + case ApplePlatform.None: + return Profile.None; + case ApplePlatform.TVOS: + return Profile.tvOS; + case ApplePlatform.WatchOS: + return Profile.watchOS; + default: + throw new NotImplementedException (platform.ToString ()); + } + } } } diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index 6f41c1a491..e8816fe1e2 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -1009,6 +1009,63 @@ namespace GeneratorTests { BuildFile (Profile.iOS, "tests/csharp10syntax.cs"); } + [Test] + [TestCase (Profile.iOS)] +#if !NET + [Ignore ("This only applies to .NET")] +#endif + public void AttributesFromInlinedProtocols (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + + var bgen = new BGenTool (); + bgen.Profile = profile; + bgen.AddTestApiDefinition ("tests/attributes-from-inlined-protocols.cs"); + bgen.CreateTemporaryBinding (); + bgen.AssertExecute ("build"); + + var type = bgen.ApiAssembly.MainModule.GetType ("NS", "TypeA"); + var someMethod1 = type.Methods.Single (v => v.Name == "SomeMethod1"); + var someMethod2 = type.Methods.Single (v => v.Name == "SomeMethod2"); + var someMethod3 = type.Methods.Single (v => v.Name == "SomeMethod3"); + var someMethod4 = type.Methods.Single (v => v.Name == "SomeMethod4"); + + var renderedSomeMethod1 = string.Join ("\n", someMethod1.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + var renderedSomeMethod2 = string.Join ("\n", someMethod2.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + var renderedSomeMethod3 = string.Join ("\n", someMethod3.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + var renderedSomeMethod4 = string.Join ("\n", someMethod4.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + + const string expectedAttributes1 = +@"[BindingImpl(3)] +[Export(""someMethod1:"")] +[SupportedOSPlatform(""ios12.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + const string expectedAttributes2 = +@"[BindingImpl(3)] +[Export(""someMethod2:"")] +[SupportedOSPlatform(""ios12.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + const string expectedAttributes3 = +@"[BindingImpl(3)] +[Export(""someMethod3:"")] +[SupportedOSPlatform(""ios11.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + const string expectedAttributes4 = +@"[BindingImpl(3)] +[Export(""someMethod4:"")] +[SupportedOSPlatform(""ios11.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + + Assert.AreEqual (expectedAttributes1, renderedSomeMethod1, "SomeMethod1"); + Assert.AreEqual (expectedAttributes2, renderedSomeMethod2, "SomeMethod2"); + Assert.AreEqual (expectedAttributes3, renderedSomeMethod3, "SomeMethod3"); + Assert.AreEqual (expectedAttributes4, renderedSomeMethod4, "SomeMethod4"); + } + [Test] public void NFloatType () { diff --git a/tests/generator/BGenTool.cs b/tests/generator/BGenTool.cs index 96574aa0f3..548559748e 100644 --- a/tests/generator/BGenTool.cs +++ b/tests/generator/BGenTool.cs @@ -380,7 +380,11 @@ namespace Xamarin.Tests { if (assembly is null) { var parameters = new ReaderParameters (); var resolver = new DefaultAssemblyResolver (); +#if NET + var searchdir = Path.GetDirectoryName (Configuration.GetBaseLibrary (Profile.AsPlatform (), true)); +#else var searchdir = Path.GetDirectoryName (Configuration.GetBaseLibrary (Profile)); +#endif resolver.AddSearchDirectory (searchdir); parameters.AssemblyResolver = resolver; assembly = AssemblyDefinition.ReadAssembly (Out ?? (Path.Combine (TmpDirectory, Path.GetFileNameWithoutExtension (ApiDefinitions [0]).Replace ('-', '_') + ".dll")), parameters); diff --git a/tests/generator/tests/attributes-from-inlined-protocols.cs b/tests/generator/tests/attributes-from-inlined-protocols.cs new file mode 100644 index 0000000000..e886aa580a --- /dev/null +++ b/tests/generator/tests/attributes-from-inlined-protocols.cs @@ -0,0 +1,32 @@ +using System; + +using Foundation; +using ObjCRuntime; + +namespace NS { + [NoTV] + [BaseType (typeof (NSObject))] + interface TypeA : ProtocolA { + } + + [Introduced (PlatformName.iOS, 11, 0)] + [Introduced (PlatformName.TvOS, 11, 0)] + [Protocol] + interface ProtocolA { + [Introduced (PlatformName.iOS, 12, 0)] + [Introduced (PlatformName.TvOS, 12, 0)] + [Export ("someMethod1:")] + void SomeMethod1 (nint row); + + [Introduced (PlatformName.iOS, 12, 0)] + [Export ("someMethod2:")] + void SomeMethod2 (nint row); + + [Introduced (PlatformName.TvOS, 12, 0)] + [Export ("someMethod3:")] + void SomeMethod3 (nint row); + + [Export ("someMethod4:")] + void SomeMethod4 (nint row); + } +} From ddda284da50c65eaec0f854ff146e329e10efbc8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Jan 2023 18:55:04 +0100 Subject: [PATCH 38/60] [tools] Enable the PushToTalk framework in the simulator. (#17274) Apple provides the headers to target PushToTalk (so using PushToTalk in code builds just fine for the simulator in Xcode), but it doesn't work at runtime. I believe it's better to allow the same thing in our bindings, for two reasons: * Apple prints out a helpful error message at runtime, instead of our rather incomprehensible build error. * Apple might implement simulator support in the future, in which case we won't need to do anything else. --- tools/common/Frameworks.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index aa1472fee1..b73f532068 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -454,7 +454,7 @@ public class Frameworks : Dictionary { { "AVRouting", "AVRouting", 16,0}, { "BackgroundAssets", "BackgroundAssets", 16,0}, - { "PushToTalk", "PushToTalk", new Version (16,0), NotAvailableInSimulator}, + { "PushToTalk", "PushToTalk", new Version (16,0), new Version (16, 2) /* available to build with, although it's unusable */}, { "SharedWithYou", "SharedWithYou", 16, 0 }, { "SharedWithYouCore", "SharedWithYouCore", 16, 0 }, From 4a1cfc3adf5c0ed06aea249ee17116334a7eeffa Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 20:16:48 +0100 Subject: [PATCH 39/60] [main] Update dependencies from dotnet/installer (#17277) This pull request updates the following dependencies ## From https://github.com/dotnet/installer - **Subscription**: 50c9492e-4671-4d1d-7920-08dabd1031a2 - **Build**: 20230117.22 - **Date Produced**: January 18, 2023 2:09:01 AM UTC - **Commit**: 33d44bcd2251c000f797df6cab241d0e8581e08d - **Branch**: refs/heads/release/7.0.1xx - **Updates**: - **Microsoft.Dotnet.Sdk.Internal**: [from 7.0.103-servicing.23063.7 to 7.0.103-servicing.23067.22][1] [1]: https://github.com/dotnet/installer/compare/4a2d55e...33d44bc --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c6a315191c..bbcdbd0bdd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/installer - 4a2d55e922b2b72664b3081e57120eae5a3af86e + 33d44bcd2251c000f797df6cab241d0e8581e08d https://github.com/dotnet/linker diff --git a/eng/Versions.props b/eng/Versions.props index 54b8d29c50..5ac793b313 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 7.0.103-servicing.23063.7 + 7.0.103-servicing.23067.22 7.0.100-1.22579.2 6.0.0-beta.21212.6 6.0.0-rc.2.21468.3 diff --git a/global.json b/global.json index 2a36cbbf49..96d7f49a45 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "7.0.103-servicing.23063.7" + "version": "7.0.103-servicing.23067.22" } } From 10d4bb251eea94a742fd5891c0117867c0f6db57 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 21:38:56 +0100 Subject: [PATCH 40/60] [main] Update dependencies from dotnet/runtime (#17280) This pull request updates the following dependencies ## From https://github.com/dotnet/runtime - **Subscription**: 38d2313f-22d5-4062-c8e1-08dabd6d8c77 - **Build**: 20230117.6 - **Date Produced**: January 18, 2023 12:56:45 AM UTC - **Commit**: 7db1c3333302d4d5ac97a5cfb28e88e5c2cde968 - **Branch**: refs/heads/release/7.0 - **Updates**: - **Microsoft.NETCore.App.Ref**: [from 7.0.3 to 7.0.3][1] [1]: https://github.com/dotnet/runtime/compare/c8a73af...7db1c33 --- NuGet.config | 2 +- eng/Version.Details.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index 3c0946e96a..e935dba3d0 100644 --- a/NuGet.config +++ b/NuGet.config @@ -15,7 +15,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bbcdbd0bdd..a7c903aeef 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -10,7 +10,7 @@ https://github.com/dotnet/runtime - c8a73afdf24cd1182b19c8b7ead209a798edf893 + 7db1c3333302d4d5ac97a5cfb28e88e5c2cde968 From 30cab5a5ae955df6af54a7a0a680ff3ae2ea6c43 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 07:39:45 +0100 Subject: [PATCH 41/60] [PushToTalk] Add missing Model attribute to the PTChannelManagerDelegate and PTChannelRestorationDelegate declarations. Fixes #16792. (#17273) Fixes https://github.com/xamarin/xamarin-macios/issues/16792. --- src/PushToTalk/Compat.cs | 23 +++++++++++++++++++++++ src/frameworks.sources | 4 ++++ src/generator.cs | 5 +++-- src/pushtotalk.cs | 16 ++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/PushToTalk/Compat.cs diff --git a/src/PushToTalk/Compat.cs b/src/PushToTalk/Compat.cs new file mode 100644 index 0000000000..7af47680f4 --- /dev/null +++ b/src/PushToTalk/Compat.cs @@ -0,0 +1,23 @@ +#nullable enable + +#if !XAMCORE_5_0 + +using System; +using Foundation; +using ObjCRuntime; + +#if !NET +using NativeHandle = System.IntPtr; +#endif + +namespace PushToTalk { + public partial class PTChannelManagerDelegate { + public override NativeHandle ClassHandle { get => base.ClassHandle; } + } + + public partial class PTChannelRestorationDelegate { + public override NativeHandle ClassHandle { get => base.ClassHandle; } + } +} + +#endif // !XAMCORE_5_0 diff --git a/src/frameworks.sources b/src/frameworks.sources index b9eeb09bef..f623dbfaba 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -1471,6 +1471,10 @@ PHOTOSUI_API_SOURCES = \ PRINTCORE_SOURCES = \ PrintCore/Defs.cs \ PrintCore/PrintCore.cs + +# PushToTalk +PUSHTOTALK_SOURCES = \ + PushToTalk/Compat.cs \ # QTKit diff --git a/src/generator.cs b/src/generator.cs index 62f3576609..a820c7423b 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -7157,7 +7157,8 @@ public partial class Generator : IMemberGatherer { if (default_ctor_visibility != null) { switch (default_ctor_visibility.Visibility) { case Visibility.Public: - break; // default + ctor_visibility = "public"; + break; case Visibility.Internal: ctor_visibility = "internal"; break; @@ -7179,7 +7180,7 @@ public partial class Generator : IMemberGatherer { if (TypeName != "NSObject") { var initSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"init\")" : "Selector.Init"; var initWithCoderSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"initWithCoder:\")" : "Selector.InitWithCoder"; - string v = class_mod == "abstract " ? "protected" : ctor_visibility; + string v = (class_mod == "abstract " && default_ctor_visibility is null) ? "protected" : ctor_visibility; var is32BitNotSupported = Is64BitiOSOnly (type); if (external) { if (!disable_default_ctor) { diff --git a/src/pushtotalk.cs b/src/pushtotalk.cs index 8da0168965..5c00ef52b8 100644 --- a/src/pushtotalk.cs +++ b/src/pushtotalk.cs @@ -137,6 +137,14 @@ namespace PushToTalk { [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] [Protocol] +#if NET + [Model] +#if !XAMCORE_5_0 + [DefaultCtorVisibility (Visibility.Public)] +#endif +#else + [Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface PTChannelManagerDelegate { [Abstract] @@ -190,6 +198,14 @@ namespace PushToTalk { [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] [Protocol] +#if NET + [Model] +#if !XAMCORE_5_0 + [DefaultCtorVisibility (Visibility.Public)] +#endif +#else + [Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface PTChannelRestorationDelegate { [Abstract] From 3e8381091078cac387623d6b28a82085c3052b43 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 07:40:27 +0100 Subject: [PATCH 42/60] [AudioUnit] Cleanup ifdefs in AUEnums. (#17267) The ifdefs here were confusing, so I cleaned them up a bit. Note that No* attributes in enum members won't prevent the enum members from being generated, they'll just get an unavailable attribute, so adding No* attributes to an enum member is not a breaking change (which allows for some of this cleanup). Contributes towards #14802. --- src/AudioUnit/AUEnums.cs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/AudioUnit/AUEnums.cs b/src/AudioUnit/AUEnums.cs index 4340ed9dd6..62584f384e 100644 --- a/src/AudioUnit/AUEnums.cs +++ b/src/AudioUnit/AUEnums.cs @@ -172,7 +172,11 @@ namespace AudioUnit { System = 0, } -#if !XAMCORE_3_0 || MONOMAC || __MACCATALYST__ + [MacCatalyst (13, 1)] + [NoTV, NoWatch] +#if NET + [NoiOS] +#endif public enum AudioObjectPropertySelector : uint { PropertyDevices = 1684370979, // 'dev#' Devices = 1684370979, // 'dev#' @@ -189,20 +193,16 @@ namespace AudioUnit { TranslateUIDToBox = 1969841250, // 'uidb' ClockDeviceList = 1668049699, //'clk#' TranslateUidToClockDevice = 1969841251, // 'uidc', -#if XAMCORE_3_0 - [NoiOS][NoTV] -#endif +#if !XAMCORE_5_0 [MacCatalyst (13, 1)] // This is required for .NET, because otherwise the generator thinks it's not available because it's not available on iOS. [Deprecated (PlatformName.iOS, 15, 0, message: "Use the 'ProcessIsMain' element instead.")] + [Deprecated (PlatformName.TvOS, 15, 0, message: "Use the 'ProcessIsMain' element instead.")] [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use the 'ProcessIsMain' element instead.")] [Deprecated (PlatformName.MacOSX, 12, 0, message: "Use the 'ProcessIsMain' element instead.")] [Obsolete ("Use the 'ProcessIsMain' element instead.")] ProcessIsMaster = 1835103092, // 'mast' -#if !XAMCORE_3_0 - [iOS (15, 0)] -#else +#endif // !XAMCORE_5_0 [NoiOS] -#endif [MacCatalyst (15, 0), Mac (12, 0), NoTV, NoWatch] ProcessIsMain = 1835100526, // 'main' IsInitingOrExiting = 1768845172, // 'inot' @@ -217,15 +217,16 @@ namespace AudioUnit { ActualSampleRate = 1634955892,// 'asrt', ClockDevice = 1634755428, // 'apcd', IOThreadOSWorkgroup = 1869838183, // 'oswg' -#if !XAMCORE_3_0 - [iOS (15, 0)] -#else [NoiOS] -#endif [MacCatalyst (15, 0), Mac (12, 0), NoTV, NoWatch] ProcessMute = 1634758765, // 'appm' } + [MacCatalyst (13, 1)] + [NoTV, NoWatch] +#if NET + [NoiOS] +#endif public enum AudioObjectPropertyScope : uint { Global = 1735159650, // 'glob' Input = 1768845428, // 'inpt' @@ -233,6 +234,11 @@ namespace AudioUnit { PlayThrough = 1886679669, // 'ptru' } + [MacCatalyst (13, 1)] + [NoTV, NoWatch] +#if NET + [NoiOS] +#endif public enum AudioObjectPropertyElement : uint { #if !NET [Obsolete ("Use the 'Main' element instead.")] @@ -240,7 +246,6 @@ namespace AudioUnit { #endif Main = 0, // 0 } -#endif // !XAMCORE_3_0 || MONOMAC #if XAMCORE_3_0 [Internal] From ec9db0e76932293fc2357c2656ab48cf01a75257 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 15:45:05 +0100 Subject: [PATCH 43/60] [AVFoundation/Intents/QuickLook] Don't add introduced attributes for a platform when the type itself isn't available on that platform. (#17293) --- src/avfoundation.cs | 12 ++++++------ src/intents.cs | 5 ++++- src/quicklook.cs | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 2d4a742fe7..2091a18149 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -7441,17 +7441,17 @@ namespace AVFoundation { AVMovieTrack [] GetTracks (AVMediaCharacteristics mediaCharacteristic); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTrackWithTrackID:completionHandler:")] void LoadTrack (int trackId, Action completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaType:completionHandler:")] void LoadTracksWithMediaType (string mediaType, Action, NSError> completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaCharacteristic:completionHandler:")] void LoadTracksWithMediaCharacteristic (string mediaCharacteristic, Action, NSError> completionHandler); } @@ -7516,17 +7516,17 @@ namespace AVFoundation { CMTime InterleavingPeriod { get; set; } [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTrackWithTrackID:completionHandler:")] void LoadTrack (int trackId, Action completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaType:completionHandler:")] void LoadTracksWithMediaType (string mediaType, Action, NSError> completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaCharacteristic:completionHandler:")] void LoadTracksWithMediaCharacteristic (string mediaCharacteristic, Action, NSError> completionHandler); } diff --git a/src/intents.cs b/src/intents.cs index 44dea44d43..23a511098f 100644 --- a/src/intents.cs +++ b/src/intents.cs @@ -7324,7 +7324,10 @@ namespace Intents { #endif (INStartAudioCallIntent intent, Action completion); - [Watch (4, 0), Mac (10, 13), iOS (11, 0)] +#if !NET + [Mac (10, 13)] +#endif + [Watch (4, 0), iOS (11, 0)] [Export ("resolveDestinationTypeForStartAudioCall:withCompletion:")] void ResolveDestinationType (INStartAudioCallIntent intent, Action completion); diff --git a/src/quicklook.cs b/src/quicklook.cs index 73aa1f4014..2785c0f852 100644 --- a/src/quicklook.cs +++ b/src/quicklook.cs @@ -277,7 +277,7 @@ namespace QuickLook { [Export ("preparePreviewOfFileAtURL:completionHandler:")] void PreparePreviewOfFile (NSUrl url, Action handler); - [iOS (15, 0), Mac (12, 0), MacCatalyst (15, 0)] + [iOS (15, 0), MacCatalyst (15, 0)] [Export ("providePreviewForFileRequest:completionHandler:")] void ProvidePreview (QLFilePreviewRequest request, Action handler); } From 10accc2cd7f0eb77a7f9d96f462a97143d8c0534 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 16:01:34 +0100 Subject: [PATCH 44/60] [dotnet/msbuild] Only compile entitlements once for universal builds. Fixes #15632. (#17096) Fixes https://github.com/xamarin/xamarin-macios/issues/15632. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 7 ++-- .../Xamarin.Mac.Common.targets | 1 - msbuild/Xamarin.Shared/Xamarin.Shared.props | 2 + msbuild/Xamarin.Shared/Xamarin.Shared.targets | 9 ++++- .../Xamarin.iOS.Common.targets | 1 - tests/common/BinLog.cs | 37 +++++++++++++++++++ tests/common/shared-dotnet.csproj | 2 +- tests/dotnet/UnitTests/Extensions.cs | 16 ++++++++ tests/dotnet/UnitTests/ProjectTest.cs | 19 ++++++++++ tests/dotnet/UnitTests/TestBaseClass.cs | 8 ++-- 10 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 tests/dotnet/UnitTests/Extensions.cs diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index fd5c70e02e..a5bd7ecd52 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -198,7 +198,6 @@ _CollectBundleResources; _RunRidSpecificBuild; - _CompileEntitlements; _DetectAppManifest; _ReadAppManifest; _WriteAppManifest; @@ -221,7 +220,6 @@ _CreatePkgInfo; _SmeltMetal; _TemperMetal; - _CompileEntitlements; _DetectAppManifest; _ReadAppManifest; _WriteAppManifest; @@ -248,13 +246,13 @@ _CreateDebugSettings; _CreateDebugConfiguration; + _CompileEntitlements; $(CreateAppBundleDependsOn); $(CreateAppBundleDependsOn); - _CompileEntitlements; _CreateMergedAppBundle; _PostProcessAppBundle; @@ -330,6 +328,7 @@ _ProcessedColladaAssetsPath=$(_ProcessedColladaAssetsPath); _ProcessedTextureAtlasesPath=$(_ProcessedTextureAtlasesPath); _ProcessedCoreMLModelsPath=$(_ProcessedCoreMLModelsPath); + _CompiledEntitlementsPath=$(_CompiledEntitlementsPath); @@ -1579,7 +1578,7 @@ <_CreateDumpExecutableToSign Include="@(_CreateDumpExecutable -> '$(_DylibPublishDir)%(RelativePath)')" KeepMetadata="false"> $(_CodesignAllocate) true - $(IntermediateOutputPath)Entitlements.xcent + $(_CompiledEntitlementsPath) $(CodesignExtraArgs) $(CodesignKeychain) $(_PreparedResourceRules) diff --git a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets index b89871f6f5..86bdc40fef 100644 --- a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets +++ b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets @@ -27,7 +27,6 @@ Copyright (C) 2014 Xamarin. All rights reserved. <_PreparedResourceRules> - <_AppBundleName>$(AssemblyName) diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.props b/msbuild/Xamarin.Shared/Xamarin.Shared.props index e4bf312178..10f0530f89 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.props +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.props @@ -307,6 +307,8 @@ Copyright (C) 2020 Microsoft. All rights reserved. all + + <_AppBundleName>$(AssemblyName) diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.targets index 0baffa42b0..b50f783288 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.targets @@ -644,7 +644,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. + Outputs="$(_CompiledEntitlementsPath)"> @@ -658,7 +658,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. BundleIdentifier="$(_BundleIdentifier)" CustomEntitlements="@(CustomEntitlements)" Entitlements="$(CodesignEntitlements)" - CompiledEntitlements="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent" + CompiledEntitlements="$(_CompiledEntitlementsPath)" IsAppExtension="$(IsAppExtension)" ProvisioningProfile="$(_ProvisioningProfile)" SdkIsSimulator="$(_SdkIsSimulator)" @@ -685,6 +685,10 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + + + @@ -1132,6 +1136,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. <_ProcessedColladaAssetsPath Condition="'$(_ProcessedColladaAssetsPath)' == ''">$(DeviceSpecificIntermediateOutputPath)collada\_ProcessedColladaAssetsPath.items <_ProcessedTextureAtlasesPath Condition="'$(_ProcessedTextureAtlasesPath)' == ''">$(DeviceSpecificIntermediateOutputPath)atlas\_ProcessedTextureAtlasesPath.items <_ProcessedCoreMLModelsPath Condition="'$(_ProcessedCoreMLModelsPath)' == ''">$(DeviceSpecificIntermediateOutputPath)coremlc\_ProcessedCoreMLModelsPath.items + <_CompiledEntitlementsPath Condition="'$(_CompiledEntitlementsPath)' == ''">$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent <_SaveProcessedItems Condition="'$(RuntimeIdentifiers)' != '' And '$(UsingAppleNETSdk)' == 'true'">true diff --git a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets index af563fb3d8..abf710a05d 100644 --- a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets @@ -27,7 +27,6 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. <_CanDeployToDeviceOrSimulator Condition="('$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true') And '$(IsWatchApp)' == 'false'">True <_PreparedResourceRules> - <_AppBundleName>$(AssemblyName) diff --git a/tests/common/BinLog.cs b/tests/common/BinLog.cs index d17cef328a..43a5d42e0b 100644 --- a/tests/common/BinLog.cs +++ b/tests/common/BinLog.cs @@ -24,6 +24,43 @@ namespace Xamarin.Tests { public string? File; public string? ProjectFile; public string? Message; + + public override string ToString () + { + var rv = new StringBuilder (); + + if (!string.IsNullOrEmpty (File)) { + rv.Append (File); + if (LineNumber > 0) { + rv.Append ('('); + rv.Append (LineNumber.ToString ()); + if (EndLineNumber > 0) { + rv.Append (','); + rv.Append (EndLineNumber.ToString ()); + } + rv.Append ("): "); + } + } + switch (Type) { + case BuildLogEventType.Error: + rv.Append ("error"); + break; + case BuildLogEventType.Warning: + rv.Append ("warning"); + break; + case BuildLogEventType.Message: + rv.Append ("message"); + break; + } + if (!string.IsNullOrEmpty (Code)) { + rv.Append (' '); + rv.Append (Code); + } + rv.Append (": "); + if (!string.IsNullOrEmpty (Message)) + rv.Append (Message); + return rv.ToString (); + } } public enum BuildLogEventType { diff --git a/tests/common/shared-dotnet.csproj b/tests/common/shared-dotnet.csproj index 1eaeec24f0..60f9b5f4f4 100644 --- a/tests/common/shared-dotnet.csproj +++ b/tests/common/shared-dotnet.csproj @@ -66,7 +66,7 @@ - + diff --git a/tests/dotnet/UnitTests/Extensions.cs b/tests/dotnet/UnitTests/Extensions.cs new file mode 100644 index 0000000000..5bca6fbd29 --- /dev/null +++ b/tests/dotnet/UnitTests/Extensions.cs @@ -0,0 +1,16 @@ +using System; + +#nullable enable + +namespace Xamarin.Tests { + public static class Extensions { + public static void AssertNoWarnings (this ExecutionResult result) + { + var warnings = BinLog.GetBuildLogWarnings (result.BinLogPath).ToArray (); + if (!warnings.Any ()) + return; + + Assert.Fail ($"No warnings expected, but got:\n\t{string.Join ("\n\t", warnings.Select (v => v.ToString ()))}"); + } + } +} diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index db2b29478b..d8a29f1bc6 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -1181,6 +1181,25 @@ namespace Xamarin.Tests { } } + // [TestCase (ApplePlatform.MacCatalyst, null, "Release")] + [TestCase (ApplePlatform.MacOSX, null, "Release")] + public void NoWarnCodesign (ApplePlatform platform, string runtimeIdentifiers, string configuration) + { + var project = "Entitlements"; + Configuration.IgnoreIfIgnoredPlatform (platform); + + var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath, configuration: configuration); + Clean (project_path); + + var properties = GetDefaultProperties (runtimeIdentifiers); + properties ["Configuration"] = configuration; + properties ["EnableCodeSigning"] = "true"; + properties ["ExcludeNUnitLiteReference"] = "true"; + properties ["ExcludeTouchUnitReference"] = "true"; + var rv = DotNet.AssertBuild (project_path, properties); + rv.AssertNoWarnings (); + } + [Test] [TestCase (ApplePlatform.MacOSX, "osx-x64")] public void BuildAndExecuteAppWithNativeDynamicLibrariesInPackageReference (ApplePlatform platform, string runtimeIdentifier) diff --git a/tests/dotnet/UnitTests/TestBaseClass.cs b/tests/dotnet/UnitTests/TestBaseClass.cs index 53770f3878..4cdcbcf8ea 100644 --- a/tests/dotnet/UnitTests/TestBaseClass.cs +++ b/tests/dotnet/UnitTests/TestBaseClass.cs @@ -66,12 +66,12 @@ namespace Xamarin.Tests { { var rv = GetProjectPath (project, subdir, platform); if (string.IsNullOrEmpty (runtimeIdentifiers)) - runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform); + runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform, configuration); var appPathRuntimeIdentifier = runtimeIdentifiers.IndexOf (';') >= 0 ? "" : runtimeIdentifiers; return Path.Combine (Path.GetDirectoryName (rv)!, "bin", configuration, platform.ToFramework (netVersion), appPathRuntimeIdentifier); } - protected string GetDefaultRuntimeIdentifier (ApplePlatform platform) + protected string GetDefaultRuntimeIdentifier (ApplePlatform platform, string configuration = "Debug") { switch (platform) { case ApplePlatform.iOS: @@ -79,9 +79,9 @@ namespace Xamarin.Tests { case ApplePlatform.TVOS: return "tvossimulator-x64"; case ApplePlatform.MacOSX: - return "osx-x64"; + return "Release".Equals (configuration, StringComparison.OrdinalIgnoreCase) ? "osx-x64;osx-arm64" : "osx-x64"; case ApplePlatform.MacCatalyst: - return "maccatalyst-x64"; + return "Release".Equals (configuration, StringComparison.OrdinalIgnoreCase) ? "maccatalyst-x64;maccatalyst-arm64" : "maccatalyst-x64"; default: throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); } From 49ceaba587d55da72c73b6e97540480f92c5df77 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 10:32:09 -0500 Subject: [PATCH 45/60] [Localization] Pulling New Localization Translations $GITHUB_RUN_ID (#17304) Automated PR. Bring new translated changes in the lcl files for OneLocBuild to create translated resx files. Co-authored-by: CSIGS --- .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ .../localize/templatestrings.json.lcl | 62 +++++++++++++++++++ 26 files changed, 1612 insertions(+) create mode 100644 Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl create mode 100644 Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl diff --git a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..6ad577efeb --- /dev/null +++ b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..99f0b91c2c --- /dev/null +++ b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..80a4b84571 --- /dev/null +++ b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..fbb3ab6bb9 --- /dev/null +++ b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..0e19cb5264 --- /dev/null +++ b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..57bd2c2075 --- /dev/null +++ b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..b6a86481d8 --- /dev/null +++ b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..e54b154eb9 --- /dev/null +++ b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..dbee143cfb --- /dev/null +++ b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..c94d975791 --- /dev/null +++ b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..70ecb26b0a --- /dev/null +++ b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..65d066fdda --- /dev/null +++ b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..2b3b0658b8 --- /dev/null +++ b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..282874b0ac --- /dev/null +++ b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..e2444d0fa9 --- /dev/null +++ b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..476f7eed32 --- /dev/null +++ b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..88b7febd98 --- /dev/null +++ b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..6f82450952 --- /dev/null +++ b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..7a9335848b --- /dev/null +++ b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..72a6d459b1 --- /dev/null +++ b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..d4b7dfdf12 --- /dev/null +++ b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..f2a3a3c851 --- /dev/null +++ b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..106b21e0e7 --- /dev/null +++ b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..0376e988c7 --- /dev/null +++ b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..8d80f367aa --- /dev/null +++ b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..e99874596d --- /dev/null +++ b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From eae346af698d83601962bb700a3b50695f76f6e1 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 16:40:20 +0100 Subject: [PATCH 46/60] [Foundation] Hide NSTask.LaunchFromPath from intellisense for Mac Catalyst. (#17297) Since it doesn't work anyway, there's no reason to show it. --- src/foundation.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/foundation.cs b/src/foundation.cs index b6e27e43e0..cb7d813492 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -15466,6 +15466,7 @@ namespace Foundation { #else #if MACCATALYST [Obsolete ("Do not use; this method is not available on Mac Catalyst.")] + [EditorBrowsable (EditorBrowsableState.Never)] #endif // MACCATALYST #endif // XAMCORE_5_0 [Export ("launchedTaskWithLaunchPath:arguments:")] From 137c6a49f18977e362f76b3d08210d2a3f60d600 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 16:40:42 +0100 Subject: [PATCH 47/60] [tests] Add makefile to run the generator tests in .NET mode. (#17296) --- tests/bgen/Makefile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/bgen/Makefile diff --git a/tests/bgen/Makefile b/tests/bgen/Makefile new file mode 100644 index 0000000000..e1cca50ff1 --- /dev/null +++ b/tests/bgen/Makefile @@ -0,0 +1,5 @@ +TOP=../.. +include $(TOP)/Make.config + +run-tests: + $(DOTNET) test From 6095fb3d0f07a447b876fd2827a3a40aec934558 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 07:48:26 +0100 Subject: [PATCH 48/60] [AudioUnit] Adjust availability attributes according to conditional compilation directives. (#17309) According to the compilation compilation directives, these two APIs are only available on macOS, so update the availability attributes accordingly. --- src/AudioUnit/AudioComponent.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AudioUnit/AudioComponent.cs b/src/AudioUnit/AudioComponent.cs index 572e46fc8a..12d8128f9f 100644 --- a/src/AudioUnit/AudioComponent.cs +++ b/src/AudioUnit/AudioComponent.cs @@ -460,9 +460,9 @@ namespace AudioUnit { // extern NSImage * __nullable AudioComponentGetIcon (AudioComponent __nonnull comp) __attribute__((availability(macosx, introduced=10.11))); #if NET [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("ios")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("macos11.0")] #else [Mac (10,11)] @@ -473,10 +473,10 @@ namespace AudioUnit { #if NET [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] - [ObsoletedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("ios")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("macos")] #else [Mac (10,11)] [Deprecated (PlatformName.MacOSX, 11, 0)] From 9016b2273f5b5c293ed47d5f34ab2188d4e3e15e Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 07:52:20 +0100 Subject: [PATCH 49/60] [MetricKit] Add availability attributes to MXMetaData.DictionaryRepresentation. (#17294) --- src/MetricKit/MXMetaData.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/MetricKit/MXMetaData.cs b/src/MetricKit/MXMetaData.cs index 962717a179..22c833ab49 100644 --- a/src/MetricKit/MXMetaData.cs +++ b/src/MetricKit/MXMetaData.cs @@ -1,4 +1,4 @@ -#if IOS +#if IOS || __MACCATALYST__ #nullable enable @@ -12,6 +12,15 @@ namespace MetricKit { public partial class MXMetaData { +#if NET + [SupportedOSPlatform ("ios14.0")] + [SupportedOSPlatform ("maccatalyst14.0")] + [SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("tvos")] +#else + [Introduced (PlatformName.iOS, 14, 0)] + [Introduced (PlatformName.MacOSX, 12, 0)] +#endif public virtual NSDictionary DictionaryRepresentation { get { if (SystemVersion.CheckiOS (14,0)) From 4b7d672f6c98e8f1de6bdefb23a8886364c745c3 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 07:53:47 +0100 Subject: [PATCH 50/60] [Foundation] NSItemProvider is available on all platforms. (#17295) --- src/Foundation/NSItemProvider.cs | 46 ++++++++++++++------------------ 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/Foundation/NSItemProvider.cs b/src/Foundation/NSItemProvider.cs index e278b497cb..f5c9791b1f 100644 --- a/src/Foundation/NSItemProvider.cs +++ b/src/Foundation/NSItemProvider.cs @@ -4,9 +4,7 @@ using CloudKit; using ObjCRuntime; namespace Foundation { -#if MONOMAC || IOS - public partial class NSItemProvider - { + public partial class NSItemProvider { #if !NET && MONOMAC [Obsolete ("Use RegisterCloudKitShare (CloudKitRegistrationPreparationAction) instead.")] public virtual void RegisterCloudKitShare (Action preparationHandler) @@ -15,7 +13,7 @@ namespace Foundation { RegisterCloudKitShare (action); } #endif - + #if MONOMAC public virtual Task RegisterCloudKitShareAsync () { @@ -34,15 +32,14 @@ namespace Foundation { [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] #else - [Watch (4,0)] - [TV (11,0)] - [Mac (10,13)] - [iOS (11,0)] + [Watch (4, 0)] + [TV (11, 0)] + [Mac (10, 13)] + [iOS (11, 0)] #endif - public NSProgress LoadObject (Action completionHandler) where T: NSObject, INSItemProviderReading + public NSProgress LoadObject (Action completionHandler) where T : NSObject, INSItemProviderReading { - return LoadObject (new Class (typeof (T)), (rv, err) => - { + return LoadObject (new Class (typeof (T)), (rv, err) => { var obj = rv as T; if (obj == null && rv != null) obj = Runtime.ConstructNSObject (rv.Handle); @@ -56,16 +53,15 @@ namespace Foundation { [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] #else - [Watch (4,0)] - [TV (11,0)] - [Mac (10,13)] - [iOS (11,0)] + [Watch (4, 0)] + [TV (11, 0)] + [Mac (10, 13)] + [iOS (11, 0)] #endif - public Task LoadObjectAsync () where T: NSObject, INSItemProviderReading + public Task LoadObjectAsync () where T : NSObject, INSItemProviderReading { var rv = LoadObjectAsync (new Class (typeof (T))); - return rv.ContinueWith ((v) => - { + return rv.ContinueWith ((v) => { var obj = v.Result as T; if (obj == null && v.Result != null) obj = Runtime.ConstructNSObject (v.Result.Handle); @@ -79,16 +75,15 @@ namespace Foundation { [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] #else - [Watch (4,0)] - [TV (11,0)] - [Mac (10,13)] - [iOS (11,0)] + [Watch (4, 0)] + [TV (11, 0)] + [Mac (10, 13)] + [iOS (11, 0)] #endif - public Task LoadObjectAsync (out NSProgress result) where T: NSObject, INSItemProviderReading + public Task LoadObjectAsync (out NSProgress result) where T : NSObject, INSItemProviderReading { var rv = LoadObjectAsync (new Class (typeof (T)), out result); - return rv.ContinueWith ((v) => - { + return rv.ContinueWith ((v) => { var obj = v.Result as T; if (obj == null && v.Result != null) obj = Runtime.ConstructNSObject (v.Result.Handle); @@ -96,5 +91,4 @@ namespace Foundation { }); } } -#endif // MONOMAC || IOS } From 91ac625192e7d20301a11d4dfca0ba6963952d7d Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 08:09:34 +0100 Subject: [PATCH 51/60] [GameKit] Move availability attributes out of conditional code. (#17301) So that all platforms know which other platforms the API is available on. --- src/gamekit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gamekit.cs b/src/gamekit.cs index 4a70708a1a..967276a7cb 100644 --- a/src/gamekit.cs +++ b/src/gamekit.cs @@ -818,12 +818,12 @@ namespace GameKit { [NullAllowed] // by default this property is null [Export ("authenticateHandler", ArgumentSemantic.Copy)] + [Mac (10, 9)] #if WATCH Action AuthenticateHandler { get; set; } #elif !MONOMAC Action AuthenticateHandler { get; set; } #else - [Mac (10,9)] Action AuthenticateHandler { get; set; } #endif From 41ae9626ee144e68c2461bc3b80bda74564e3811 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 08:51:03 +0100 Subject: [PATCH 52/60] [Foundation] There's no reason to conditionally exclude code for macOS when the member has a NoMac attribute. (#17299) This ensures that all platform assemblies know that the member doesn't exist on macOS. --- src/foundation.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/foundation.cs b/src/foundation.cs index cb7d813492..1d293c0e98 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -10980,10 +10980,8 @@ namespace Foundation { [Export ("preferredPresentationSize")] CGSize PreferredPresentationSize { get; -#if !MONOMAC [NoMac] set; -#endif } [NoiOS, NoTV, NoWatch, NoMacCatalyst] From 3cbd86aba219a26034e12cf4bc22883fe68fc8d2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 09:49:58 +0100 Subject: [PATCH 53/60] [AVFoundation] Adjust availability attributes according to conditional compilation directives. (#17311) According to the compilation compilation directives, these APIs are not available on tvOS nor macOS, so update the availability attributes accordingly. --- src/AVFoundation/Events.cs | 35 ++++++++++++++---------- tests/cecil-tests/ApiAvailabilityTest.cs | 7 ----- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/AVFoundation/Events.cs b/src/AVFoundation/Events.cs index 4804cb674d..0b1f85719f 100644 --- a/src/AVFoundation/Events.cs +++ b/src/AVFoundation/Events.cs @@ -361,11 +361,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #endif @@ -380,11 +381,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #endif @@ -399,11 +401,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -418,11 +421,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -437,11 +441,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -457,11 +462,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -477,11 +483,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif diff --git a/tests/cecil-tests/ApiAvailabilityTest.cs b/tests/cecil-tests/ApiAvailabilityTest.cs index 938978a5c1..9802be083d 100644 --- a/tests/cecil-tests/ApiAvailabilityTest.cs +++ b/tests/cecil-tests/ApiAvailabilityTest.cs @@ -315,13 +315,6 @@ namespace Cecil.Tests { "System.Boolean Security.SecRecord::UseNoAuthenticationUI()", "System.Double Speech.SFTranscription::AveragePauseDuration()", "System.Double Speech.SFTranscription::SpeakingRate()", - "System.EventHandler AVFoundation.AVAudioSession::BeginInterruption (event)", - "System.EventHandler AVFoundation.AVAudioSession::EndInterruption (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::CategoryChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::InputChannelsChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::OutputChannelsChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::SampleRateChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::InputAvailabilityChanged (event)", "System.String PassKit.PKAddShareablePassConfiguration::ProvisioningPolicyIdentifier()", "System.String PassKit.PKShareablePassMetadata::LocalizedDescription()", "System.String PassKit.PKShareablePassMetadata::OwnerDisplayName()", From 9c57a3fab36c16d5276414b3e2dcece50524ded1 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 10:49:07 +0100 Subject: [PATCH 54/60] [MediaPlayer] Adjust availability attributes for MPMediaItem/MPMediaEntity. (#17305) The API for MPMediaItem/MPMediaEntity varies wildly between platforms (for historical reasons), so move availability attributes around a bit so that they match reality a bit better: MPMediaEntity is not available on macOS, only MPMediaItem is. --- src/mediaplayer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mediaplayer.cs b/src/mediaplayer.cs index 8dd3c8c263..abd0d04b1d 100644 --- a/src/mediaplayer.cs +++ b/src/mediaplayer.cs @@ -42,7 +42,6 @@ using NativeHandle = System.IntPtr; #endif namespace MediaPlayer { - [Mac (10, 12, 2)] // type exists only to expose fields [BaseType (typeof (NSObject))] #if !MONOMAC #if NET @@ -54,8 +53,9 @@ namespace MediaPlayer { [TV (14, 0)] interface MPMediaEntity : NSSecureCoding { #else + [Mac (10, 12, 2)] // type exists only to expose fields interface MPMediaItem : NSSecureCoding { -#endif +#endif // !MONOMAC [Static] [Export ("canFilterByProperty:")] bool CanFilterByProperty (NSString property); From bd158d916276e84f3289154fff3a696ed45323e8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Jan 2023 10:52:57 +0100 Subject: [PATCH 55/60] [NearbyInteraction] Remove NISession.SetARSession from Mac Catalyst. (#17300) ARKit is in a weird spot on Mac Catalyst: it exists, but it doesn't do anything. Since it doesn't actually work, we don't have bindings for ARKit. This means that while the method '[NISession setARSession:]' technically exists on Mac Catalyst, we can't bind it properly, since the type of the parameter (ARSession) isn't available in our bindings for Mac Catalyst. Due to how we hack around the lack of ARSession in our source code, we ended up binding the method with an NSObject argument instead. This is still wrong, so here I'm removing that method from the API. But of course, removing that API is a breaking change, so until then the method is obsoleted and hidden, and only removed in XAMCORE_5_0. Also hide a few other obsoleted API in NISession, and remove those as well in XAMCORE_5_0. --- src/NearbyInteraction/NICompat.cs | 21 +++++++++++++++------ src/nearbyinteraction.cs | 3 ++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/NearbyInteraction/NICompat.cs b/src/NearbyInteraction/NICompat.cs index fc7dfaa4eb..1c2b96e17c 100644 --- a/src/NearbyInteraction/NICompat.cs +++ b/src/NearbyInteraction/NICompat.cs @@ -4,6 +4,8 @@ // Copyright (C) Microsoft Corporation. All rights reserved. // +#if !XAMCORE_5_0 + using System; using System.ComponentModel; using System.Threading.Tasks; @@ -29,19 +31,26 @@ using MatrixFloat4x4 = global::OpenTK.NMatrix4; #nullable enable namespace NearbyInteraction { -#if WATCH +#if !__MACOS__ && !__TVOS__ public partial class NISession { -#if !NET +#if WATCH [Obsolete ("This method was removed and will always throw a InvalidOperationException.")] -#endif + [EditorBrowsable (EditorBrowsableState.Never)] public virtual void SetARSession (ARSession session) => throw new InvalidOperationException (Constants.ApiRemovedGeneral); -#if !NET [Obsolete ("This method was removed and will always throw a InvalidOperationException.")] -#endif + [EditorBrowsable (EditorBrowsableState.Never)] public virtual MatrixFloat4x4 GetWorldTransform (NINearbyObject @object) => throw new InvalidOperationException (Constants.ApiRemovedGeneral); +#endif // WATCH - } +#if __MACCATALYST__ + [Obsolete ("This method was removed and will always throw a InvalidOperationException.")] + [EditorBrowsable (EditorBrowsableState.Never)] + public virtual void SetARSession (NSObject session) => throw new InvalidOperationException (Constants.ApiRemovedGeneral); #endif + } +#endif // !__MACOS__ && !__TVOS__ } + +#endif // !XAMCORE_5_0 diff --git a/src/nearbyinteraction.cs b/src/nearbyinteraction.cs index 0d30159912..eca62ea086 100644 --- a/src/nearbyinteraction.cs +++ b/src/nearbyinteraction.cs @@ -125,7 +125,8 @@ namespace NearbyInteraction { [Export ("invalidate")] void Invalidate (); - [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] + [NoMacCatalyst] // We don't have ARKit bindings for Mac Catalyst (because ARKit doesn't work on Mac Catalyst), so we can't bind this method. + [NoWatch, NoTV, NoMac, iOS (16, 0)] [Export ("setARSession:")] void SetARSession (ARSession session); From 9c0bfd4e425230d689db95425f22c7763297c6cb Mon Sep 17 00:00:00 2001 From: dustin-wojciechowski Date: Fri, 20 Jan 2023 10:05:44 -0800 Subject: [PATCH 56/60] [src] Added manual binding to prevent issue of AVAudioPlayer FromData() and FromUrl() throwing exceptions. (#17073) Provided manual binding of AVAudioPlayer::initWithContentsOfURL:error: and AVAudioPlayer::initWithData:error: to prevent an issue where AVAudioPlayer::FromData() and FromUrl() do not throw exceptions when returning null. Fixes #16229 Co-authored-by: GitHub Actions Autoformatter --- src/AVFoundation/AVAudioPlayer.cs | 60 ++++++++----------- src/avfoundation.cs | 7 --- .../AVFoundation/AudioPlayerTest.cs | 38 +++++++++++- .../iOS-AVFoundation.ignore | 5 ++ .../macOS-AVFoundation.ignore | 5 ++ .../tvOS-AVFoundation.ignore | 5 ++ tests/xtro-sharpie/iOS-AVFoundation.ignore | 7 +++ tests/xtro-sharpie/macOS-AVFoundation.ignore | 7 +++ tests/xtro-sharpie/tvOS-AVFoundation.ignore | 5 ++ .../xtro-sharpie/watchOS-AVFoundation.ignore | 5 ++ 10 files changed, 99 insertions(+), 45 deletions(-) diff --git a/src/AVFoundation/AVAudioPlayer.cs b/src/AVFoundation/AVAudioPlayer.cs index c1111dfbea..c24c47f09f 100644 --- a/src/AVFoundation/AVAudioPlayer.cs +++ b/src/AVFoundation/AVAudioPlayer.cs @@ -23,8 +23,8 @@ // using Foundation; using ObjCRuntime; -using AudioToolbox; using System; +using System.Runtime.InteropServices; #nullable enable @@ -32,58 +32,48 @@ namespace AVFoundation { #if !WATCH public partial class AVAudioPlayer { + [DllImport (Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")] + unsafe static extern IntPtr objc_msgSend (IntPtr receiver, IntPtr selector, IntPtr arg1, IntPtr* arg2); + public static AVAudioPlayer? FromUrl (NSUrl url, out NSError? error) { + error = null; + IntPtr url__handle__ = url!.GetNonNullHandle (nameof (url)); + IntPtr handle = Messaging.IntPtr_objc_msgSend (class_ptr, Selector.GetHandle ("alloc")); + IntPtr errorptr = IntPtr.Zero; + if (handle == IntPtr.Zero) + return null; unsafe { - IntPtr errhandle; - IntPtr ptrtohandle = (IntPtr) (&errhandle); - - var ap = new AVAudioPlayer (url, ptrtohandle); - if (ap.Handle == IntPtr.Zero) { - error = Runtime.GetNSObject (errhandle); - return null; - } else - error = null; - return ap; + handle = objc_msgSend (handle, Selector.GetHandle ("initWithContentsOfURL:error:"), url__handle__, &errorptr); } + error = Runtime.GetNSObject (errorptr); + return Runtime.GetNSObject (handle, owns: true); } public static AVAudioPlayer? FromUrl (NSUrl url) { - unsafe { - var ap = new AVAudioPlayer (url, IntPtr.Zero); - if (ap.Handle == IntPtr.Zero) - return null; - - return ap; - } + return FromUrl (url, out _); } public static AVAudioPlayer? FromData (NSData data, out NSError? error) { - unsafe { - IntPtr errhandle; - IntPtr ptrtohandle = (IntPtr) (&errhandle); + error = null; + IntPtr data__handle__ = data!.GetNonNullHandle (nameof (data)); + IntPtr errorptr = IntPtr.Zero; + IntPtr handle = Messaging.IntPtr_objc_msgSend (class_ptr, Selector.GetHandle ("alloc")); - var ap = new AVAudioPlayer (data, ptrtohandle); - if (ap.Handle == IntPtr.Zero) { - error = Runtime.GetNSObject (errhandle); - return null; - } else - error = null; - return ap; + if (handle == IntPtr.Zero) + return null; + unsafe { + handle = objc_msgSend (handle, Selector.GetHandle ("initWithData:error:"), data__handle__, &errorptr); } + error = Runtime.GetNSObject (errorptr); + return Runtime.GetNSObject (handle, owns: true); } public static AVAudioPlayer? FromData (NSData data) { - unsafe { - var ap = new AVAudioPlayer (data, IntPtr.Zero); - if (ap.Handle == IntPtr.Zero) - return null; - - return ap; - } + return FromData (data, out _); } } #endif // !WATCH diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 2091a18149..d9679779dc 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -1589,13 +1589,6 @@ namespace AVFoundation { [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface AVAudioPlayer { - [Export ("initWithContentsOfURL:error:")] - [Internal] - NativeHandle Constructor (NSUrl url, IntPtr outError); - - [Export ("initWithData:error:")] - [Internal] - NativeHandle Constructor (NSData data, IntPtr outError); [Export ("prepareToPlay")] bool PrepareToPlay (); diff --git a/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs b/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs index a08a5cdb2a..e37cfd1c8f 100644 --- a/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs +++ b/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs @@ -13,6 +13,7 @@ using System.IO; using Foundation; using AVFoundation; using NUnit.Framework; +using System; namespace MonoTouchFixtures.AVFoundation { @@ -25,13 +26,44 @@ namespace MonoTouchFixtures.AVFoundation { { string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "Hand.wav"); Assert.True (File.Exists (file), file); - NSError error; - using (var url = new NSUrl (file, false)) - using (var ap = AVAudioPlayer.FromUrl (url, out error)) { + using (NSUrl url = new (file, false)) + using (AVAudioPlayer ap = AVAudioPlayer.FromUrl (url, out NSError error)) { Assert.NotNull (ap, "AVAudioPlayer"); Assert.Null (error, "NSError"); } } + + [Test] + public void FromUrlWithInvalidUrl () + { + Assert.DoesNotThrow (() => { + using (AVAudioPlayer player = AVAudioPlayer.FromUrl (NSUrl.FromString ("sdf"), out NSError error)) { + Assert.Null (player, "AVAudioPlayer"); + Assert.NotNull (error, "NSError"); + } + }); + } + + [Test] + public void FromData () + { + using (NSData data = NSData.FromFile (NSBundle.MainBundle.PathForResource ("Hand", "wav"))) + using (AVAudioPlayer player = AVAudioPlayer.FromData (data, out NSError error)) { + Assert.NotNull (player, "AVAudioPlayer"); + Assert.Null (error, "NSError"); + } + } + + [Test] + public void FromDataWithNullData () + { + Assert.Throws (() => { + using (var player = AVAudioPlayer.FromData (null, out NSError error)) { + Assert.Null (player, "AVAudioPlayer"); + Assert.NotNull (error, "NSError"); + } + }); + } } } diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore index 74e15e6946..a10ca55f52 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore @@ -12,3 +12,8 @@ ### deprecated in iOS8 !missing-protocol-member! AVAudioPlayerDelegate::audioPlayerEndInterruption:withFlags: not found + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore index 065f8e7d96..6427e4c916 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore @@ -43,3 +43,8 @@ # not used on macOS !missing-enum! AVAudioSessionInterruptionReason not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore index b01b308c8f..66de0b4a1e 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore @@ -9,3 +9,8 @@ ### deprecated in iOS8 !missing-protocol-member! AVAudioPlayerDelegate::audioPlayerEndInterruption:withFlags: not found + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/iOS-AVFoundation.ignore b/tests/xtro-sharpie/iOS-AVFoundation.ignore index f3bb8993b1..bf09307248 100644 --- a/tests/xtro-sharpie/iOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/iOS-AVFoundation.ignore @@ -29,3 +29,10 @@ !incorrect-protocol-member! AVAudio3DMixing::sourceMode is REQUIRED and should be abstract !extra-null-allowed! 'Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()' has a extraneous [NullAllowed] on return type !missing-field! AVPlayerItemTimeJumpedOriginatingParticipantKey not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound + + diff --git a/tests/xtro-sharpie/macOS-AVFoundation.ignore b/tests/xtro-sharpie/macOS-AVFoundation.ignore index 8c83f2062b..56e7081c32 100644 --- a/tests/xtro-sharpie/macOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/macOS-AVFoundation.ignore @@ -61,3 +61,10 @@ !incorrect-protocol-member! AVAudio3DMixing::sourceMode is REQUIRED and should be abstract !extra-null-allowed! 'Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()' has a extraneous [NullAllowed] on return type !missing-field! AVPlayerItemTimeJumpedOriginatingParticipantKey not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound + + diff --git a/tests/xtro-sharpie/tvOS-AVFoundation.ignore b/tests/xtro-sharpie/tvOS-AVFoundation.ignore index 8e0c60da5e..c6d83fb7ba 100644 --- a/tests/xtro-sharpie/tvOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/tvOS-AVFoundation.ignore @@ -24,3 +24,8 @@ !incorrect-protocol-member! AVAudio3DMixing::sourceMode is REQUIRED and should be abstract !extra-null-allowed! 'Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()' has a extraneous [NullAllowed] on return type !missing-field! AVPlayerItemTimeJumpedOriginatingParticipantKey not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/watchOS-AVFoundation.ignore b/tests/xtro-sharpie/watchOS-AVFoundation.ignore index 2583e96ade..a4251c18bc 100644 --- a/tests/xtro-sharpie/watchOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/watchOS-AVFoundation.ignore @@ -31,3 +31,8 @@ !unknown-native-enum! AVAudioSessionFlags bound !missing-protocol-member! AVAudioPlayerDelegate::audioPlayerEndInterruption:withFlags: not found !missing-protocol-member! AVAudioRecorderDelegate::audioRecorderEndInterruption:withOptions: not found + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound From 86ee42a39d796614a20a736419ae3fe743e31022 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 23 Jan 2023 11:44:48 +0100 Subject: [PATCH 57/60] [tests] Bump the timeout to 10min for monotouch-test/xammac_tests on older macOS bots. (#17317) I've started seeing more random network delays on these tests recently - which the tests themselves handle, but the test run ends up taking much longer, and we need to give the test run more time to finish. --- tests/packaged-macos-tests.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/packaged-macos-tests.mk b/tests/packaged-macos-tests.mk index f49dec576c..5e9730d7c6 100644 --- a/tests/packaged-macos-tests.mk +++ b/tests/packaged-macos-tests.mk @@ -26,7 +26,7 @@ LAUNCH_ARGUMENTS=--autostart --autoexit # Time test runs out after 5 minutes (300 seconds) RUN_WITH_TIMEOUT=./run-with-timeout.csharp 300 -# Some tests need a bit more time... (introspection) +# Some tests need a bit more time... (introspection, monotouch-test/xammac_tests) RUN_WITH_TIMEOUT_LONGER=./run-with-timeout.csharp 600 .stamp-configure-projects-mac: Makefile xharness/xharness.exe @@ -94,7 +94,7 @@ build-mac-modern-xammac_tests: xammac_tests/xammac_tests.csproj .stamp-nuget-res exec-mac-modern-xammac_tests: @echo "ℹ️ Executing the 'xammac' test for Xamarin.Mac (Modern profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT) xammac_tests/bin/x86/$(CONFIG)/xammac_tests.app/Contents/MacOS/xammac_tests + $(Q) $(RUN_WITH_TIMEOUT_LONGER) xammac_tests/bin/x86/$(CONFIG)/xammac_tests.app/Contents/MacOS/xammac_tests # # link all @@ -221,7 +221,7 @@ endif $$(Q) if test -e ".$$@-failure.stamp"; then cat ".$$@-failure.stamp"; rm ".$$@-failure.stamp"; exit 1; fi endef -$(eval $(call DotNetNormalTest,monotouch-test,monotouchtest)) +$(eval $(call DotNetNormalTest,monotouch-test,monotouchtest,_LONGER)) $(eval $(call DotNetNormalTest,introspection,introspection,_LONGER)) ### .NET linker tests From 9f0955be9c7d109459144e9ff252a5732b899c4c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 23 Jan 2023 11:47:31 +0100 Subject: [PATCH 58/60] [HealthKit] Remove HKSeriesBuilder compliance of NSSecureCoding. (#17302) There's no trace of this in the headers, so I assume it's something that happened in a beta and then got removed, and we didn't notice to update our bindings. --- src/healthkit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/healthkit.cs b/src/healthkit.cs index ee4a34f907..7464d5591e 100644 --- a/src/healthkit.cs +++ b/src/healthkit.cs @@ -3501,7 +3501,7 @@ namespace HealthKit { [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface HKSeriesBuilder -#if !MONOMAC +#if !MONOMAC && !XAMCORE_5_0 : NSSecureCoding #endif { From 8514c71596633b42c34af8e8c1d59c96d3cb0881 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 17:10:42 -0500 Subject: [PATCH 59/60] [Localization] Pulling New Localization Translations $GITHUB_RUN_ID (#17342) Automated PR. Bring new translated changes in the lcl files for OneLocBuild to create translated resx files. Co-authored-by: Alex Hsu Co-authored-by: CSIGS --- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- .../localize/templatestrings.json.lcl | 29 +++++++++++++++++-- 26 files changed, 702 insertions(+), 52 deletions(-) diff --git a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 6ad577efeb..3215885075 100644 --- a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 99f0b91c2c..42140c1ba9 100644 --- a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 80a4b84571..081899164f 100644 --- a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index fbb3ab6bb9..b55adfa227 100644 --- a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 0e19cb5264..a0c6486fa5 100644 --- a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 57bd2c2075..25badf1c14 100644 --- a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index b6a86481d8..ad53bd30e3 100644 --- a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index e54b154eb9..1f4f47b1d6 100644 --- a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index dbee143cfb..91b11ed76a 100644 --- a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index c94d975791..7dfa3fc178 100644 --- a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 70ecb26b0a..9ac5a0742a 100644 --- a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 65d066fdda..ba8d0b1081 100644 --- a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 2b3b0658b8..5fc63f6d7a 100644 --- a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 282874b0ac..7ab158983f 100644 --- a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index e2444d0fa9..0c68f0df46 100644 --- a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 476f7eed32..7c170f79b1 100644 --- a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 88b7febd98..5e2b0616f6 100644 --- a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 6f82450952..d5a39daf4b 100644 --- a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 7a9335848b..d32131a85f 100644 --- a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 72a6d459b1..39b67d8628 100644 --- a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index d4b7dfdf12..586f7a51ff 100644 --- a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index f2a3a3c851..5392194bc6 100644 --- a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 106b21e0e7..5f085aef3b 100644 --- a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index 0376e988c7..a90bac6529 100644 --- a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl index 8d80f367aa..c23fbfa3ad 100644 --- a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl index e99874596d..b80576c389 100644 --- a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl +++ b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -1,10 +1,11 @@  - + + @@ -12,51 +13,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + \ No newline at end of file From 608765e2c9e474c494958844a94354f90fa42f36 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 24 Jan 2023 08:05:32 +0100 Subject: [PATCH 60/60] [Metal] Adjust conditional compilation directives to make sure some MTLRenderCommandEncoder API is available on the correct platforms. (#17307) --- src/Metal/MTLRenderCommandEncoder.cs | 64 +++++++++++++++------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/src/Metal/MTLRenderCommandEncoder.cs b/src/Metal/MTLRenderCommandEncoder.cs index ed6bd16c8d..716c5fd4c4 100644 --- a/src/Metal/MTLRenderCommandEncoder.cs +++ b/src/Metal/MTLRenderCommandEncoder.cs @@ -15,79 +15,83 @@ namespace Metal { [SupportedOSPlatform ("tvos")] #endif public static class IMTLRenderCommandEncoder_Extensions { -#if MONOMAC +#if !WATCH #if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios")] - [UnsupportedOSPlatform ("tvos")] + [SupportedOSPlatform ("ios12.0")] + [SupportedOSPlatform ("tvos14.5")] #else - [Mac (10,13)] - [NoiOS] - [NoTV] + [Mac (10, 13)] + [iOS (12, 0)] + [TV (14, 5)] [NoWatch] #endif public unsafe static void SetViewports (this IMTLRenderCommandEncoder This, MTLViewport [] viewports) { fixed (void* handle = viewports) - This.SetViewports ((IntPtr)handle, (nuint)(viewports?.Length ?? 0)); + This.SetViewports ((IntPtr) handle, (nuint) (viewports?.Length ?? 0)); } +#endif // !WATCH +#if !WATCH #if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios")] - [UnsupportedOSPlatform ("tvos")] + [SupportedOSPlatform ("ios12.0")] + [SupportedOSPlatform ("tvos14.5")] #else - [Mac (10,13)] - [NoiOS] - [NoTV] + [Mac (10, 13)] + [iOS (12, 0)] + [TV (14, 5)] [NoWatch] #endif public unsafe static void SetScissorRects (this IMTLRenderCommandEncoder This, MTLScissorRect [] scissorRects) { fixed (void* handle = scissorRects) - This.SetScissorRects ((IntPtr)handle, (nuint)(scissorRects?.Length ?? 0)); + This.SetScissorRects ((IntPtr) handle, (nuint) (scissorRects?.Length ?? 0)); } -#endif +#endif // !WATCH -#if IOS +#if !WATCH #if NET [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("tvos")] - [UnsupportedOSPlatform ("macos")] + [SupportedOSPlatform ("tvos14.5")] + [SupportedOSPlatform ("macos11.0")] #else - [iOS (11,0)] - [NoTV] - [NoMac] + [iOS (11, 0)] + [TV (14, 5)] + [Mac (11, 0)] [NoWatch] #endif - public unsafe static void SetTileBuffers (this IMTLRenderCommandEncoder This, IMTLBuffer[] buffers, nuint[] offsets, NSRange range) + public unsafe static void SetTileBuffers (this IMTLRenderCommandEncoder This, IMTLBuffer [] buffers, nuint [] offsets, NSRange range) { fixed (void* handle = offsets) - This.SetTileBuffers (buffers, (IntPtr)handle, range); + This.SetTileBuffers (buffers, (IntPtr) handle, range); } +#endif // !WATCH +#if !WATCH #if NET [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("tvos")] - [UnsupportedOSPlatform ("macos")] + [SupportedOSPlatform ("tvos14.5")] + [SupportedOSPlatform ("macos11.0")] #else - [iOS (11,0)] - [NoTV] - [NoMac] + [iOS (11, 0)] + [TV (14, 5)] + [Mac (11, 0)] [NoWatch] #endif - public unsafe static void SetTileSamplerStates (this IMTLRenderCommandEncoder This, IMTLSamplerState[] samplers, float[] lodMinClamps, float[] lodMaxClamps, NSRange range) + public unsafe static void SetTileSamplerStates (this IMTLRenderCommandEncoder This, IMTLSamplerState [] samplers, float [] lodMinClamps, float [] lodMaxClamps, NSRange range) { fixed (void* minHandle = lodMinClamps) { fixed (void* maxHandle = lodMaxClamps) { - This.SetTileSamplerStates (samplers, (IntPtr)minHandle, (IntPtr)maxHandle, range); + This.SetTileSamplerStates (samplers, (IntPtr) minHandle, (IntPtr) maxHandle, range); } } } -#endif +#endif // !WATCH } }