From c7cbd7b78ff4e619acf11e872e50790c16cc0d54 Mon Sep 17 00:00:00 2001 From: Matt Sylvia Date: Thu, 5 Sep 2024 10:11:27 -0400 Subject: [PATCH] Merge dev/mandel/dotnot-export-text-matrix-ci --- Make.config | 20 +- NuGet.config | 64 +--- dotnet/Makefile | 6 +- dotnet/VERSIONS.md | 15 +- dotnet/package/Icon.png | Bin 0 -> 2140 bytes dotnet/package/common.csproj | 7 +- eng/Version.Details.xml | 30 +- eng/Versions.props | 8 +- global.json | 2 +- mk/quiet.mk | 2 +- src/CoreVideo/CVPixelFormatDescription.cs | 291 +++++++++++++----- src/CoreVideo/CoreVideo.cs | 29 ++ src/Foundation/NSUrlSessionHandler.cs | 5 +- src/Network/NWConnection.cs | 13 + src/ObjCRuntime/Dlfcn.cs | 108 +++++++ src/avfoundation.cs | 6 +- src/bgen/AttributeManager.cs | 37 +++ src/bgen/Enums.cs | 42 ++- src/bgen/Filters.cs | 2 +- src/bgen/Generator.cs | 158 ++++++---- src/bgen/Models/AsyncMethodInfo.cs | 2 +- src/bgen/TypeManager.cs | 44 +-- src/corevideo.cs | 200 ++++++++++++ system-dependencies.sh | 75 +---- .../Documentation.KnownFailures.txt | 253 +++++---------- tests/common/shared-dotnet.mk | 34 +- tests/generator/BGenTests.cs | 101 +++++- .../generator/ExpectedXmlDocs.MacCatalyst.xml | 8 + .../generator/ExpectedXmlDocs.iOS.legacy.xml | 8 + tests/generator/ExpectedXmlDocs.iOS.xml | 8 + .../ExpectedXmlDocs.macOS.legacy.xml | 8 + tests/generator/ExpectedXmlDocs.macOS.xml | 8 + .../generator/ExpectedXmlDocs.tvOS.legacy.xml | 8 + tests/generator/ExpectedXmlDocs.tvOS.xml | 8 + .../tests/delegate-nullable-return.cs | 16 + tests/generator/tests/delegate-types.cs | 15 + tests/generator/tests/editor-browsable.cs | 19 ++ .../generator/tests/nscopying-nullability.cs | 9 + tests/generator/tests/underlyingfieldtype.cs | 40 +++ tests/linker/ios/link sdk/AotBugs.cs | 5 + .../CoreVideo/PixelFormatDescriptionTest.cs | 52 ++++ tests/monotouch-test/ObjCRuntime/DlfcnTest.cs | 78 +++++ .../ObjCRuntime/RegistrarTest.cs | 32 ++ tests/monotouch-test/dotnet/shared.csproj | 1 + tests/test-dependencies.sh | 2 +- tests/test-libraries/libtest.h | 2 + tests/test-libraries/rename.h | 2 + .../common-CoreVideo.ignore | 33 -- .../iOS-CoreVideo.ignore | 1 - .../tvOS-CoreVideo.ignore | 1 - tests/xtro-sharpie/common-CoreVideo.ignore | 33 -- tests/xtro-sharpie/iOS-CoreVideo.ignore | 1 - tests/xtro-sharpie/tvOS-CoreVideo.ignore | 1 - tools/common/Make.common | 10 +- tools/devops/automation/build-pipeline.yml | 2 + tools/devops/automation/run-ci-api-diff.yml | 2 + tools/devops/automation/scripts/VSTS.psm1 | 238 +++++++++----- .../build/api-diff-build-and-detect.yml | 2 +- .../build/api-diff-process-results.yml | 4 +- .../automation/templates/common/configure.yml | 1 - .../templates/common/load_configuration.yml | 106 +++++++ .../devops/automation/templates/mac/build.yml | 2 +- .../automation/templates/tests-stage.yml | 2 +- tools/devops/provision-brew-packages.csx | 3 - .../Steps/CollectUnmarkedMembers.cs | 6 + .../dotnet-linker/Steps/PreMarkDispatcher.cs | 1 + .../Steps/SetBeforeFieldInitStep.cs | 55 ++++ tools/linker/CoreOptimizeGeneratedCode.cs | 77 +++++ tools/mtouch/Errors.designer.cs | 18 ++ tools/mtouch/Errors.resx | 7 + 70 files changed, 1809 insertions(+), 680 deletions(-) create mode 100644 dotnet/package/Icon.png create mode 100644 tests/generator/tests/delegate-nullable-return.cs create mode 100644 tests/generator/tests/delegate-types.cs create mode 100644 tests/generator/tests/editor-browsable.cs create mode 100644 tests/generator/tests/nscopying-nullability.cs create mode 100644 tests/generator/tests/underlyingfieldtype.cs create mode 100644 tools/devops/automation/templates/common/load_configuration.yml create mode 100644 tools/dotnet-linker/Steps/SetBeforeFieldInitStep.cs diff --git a/Make.config b/Make.config index f5d4662e5214..16db1b068da7 100644 --- a/Make.config +++ b/Make.config @@ -56,7 +56,11 @@ PACKAGE_HEAD_REV=$(shell git rev-parse HEAD) # This is done in Make.versions, not here. # -ifeq ($(BRANCH_NAME),) +ifneq ($(BUILD_SOURCEBRANCH),) +# BUILD_SOURCEBRANCH is set in Azure DevOps, so use that value if it exists +# it seems to always start with refs/heads/, so strip off that first. +CURRENT_BRANCH:=$(subst refs/heads/,,${BUILD_SOURCEBRANCH}) +else ifeq ($(BRANCH_NAME),) # BRANCH_NAME is set in Jenkins, so this is for local builds. CURRENT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD) else @@ -161,7 +165,7 @@ else NUGET_PRERELEASE_IDENTIFIER=-ci.$(CURRENT_BRANCH_ALPHANUMERIC) endif -NUGET_BUILD_METADATA=sha.$(CURRENT_HASH) +NUGET_BUILD_METADATA= IOS_PRODUCT=Xamarin.iOS IOS_PACKAGE_NAME=Xamarin.iOS @@ -178,7 +182,7 @@ IOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(IOS_NUGET_VERSION))) IOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(IOS_NUGET_VERSION))) IOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(IOS_NUGET_VERSION))) IOS_NUGET_VERSION_NO_METADATA=$(IOS_NUGET_VERSION)$(NUGET_PRERELEASE_IDENTIFIER) -IOS_NUGET_VERSION_FULL=$(IOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA) +IOS_NUGET_VERSION_FULL=$(IOS_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) IOS_WINDOWS_NUGET=Microsoft.iOS.Windows IOS_WINDOWS_NUGET_VERSION_MAJOR=$(IOS_NUGET_VERSION_MAJOR) @@ -193,7 +197,7 @@ TVOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(TVOS_NUGET_VERSION))) TVOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(TVOS_NUGET_VERSION))) TVOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(TVOS_NUGET_VERSION))) TVOS_NUGET_VERSION_NO_METADATA=$(TVOS_NUGET_VERSION)$(NUGET_PRERELEASE_IDENTIFIER) -TVOS_NUGET_VERSION_FULL=$(TVOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA) +TVOS_NUGET_VERSION_FULL=$(TVOS_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) WATCHOS_NUGET=Microsoft.watchOS WATCHOS_NUGET_VERSION=$(WATCHOS_NUGET_OS_VERSION).$(WATCHOS_NUGET_COMMIT_DISTANCE) @@ -201,7 +205,7 @@ WATCHOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(WATCHOS_NUGET_VERSION))) WATCHOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(WATCHOS_NUGET_VERSION))) WATCHOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(WATCHOS_NUGET_VERSION))) WATCHOS_NUGET_VERSION_NO_METADATA=$(WATCHOS_NUGET_VERSION)$(NUGET_PRERELEASE_IDENTIFIER) -WATCHOS_NUGET_VERSION_FULL=$(WATCHOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA) +WATCHOS_NUGET_VERSION_FULL=$(WATCHOS_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) MACCATALYST_NUGET=Microsoft.MacCatalyst MACCATALYST_NUGET_VERSION=$(MACCATALYST_NUGET_OS_VERSION).$(MACCATALYST_NUGET_COMMIT_DISTANCE) @@ -209,7 +213,7 @@ MACCATALYST_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(MACCATALYST_NUGET_VERSIO MACCATALYST_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(MACCATALYST_NUGET_VERSION))) MACCATALYST_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(MACCATALYST_NUGET_VERSION))) MACCATALYST_NUGET_VERSION_NO_METADATA=$(MACCATALYST_NUGET_VERSION)$(NUGET_PRERELEASE_IDENTIFIER) -MACCATALYST_NUGET_VERSION_FULL=$(MACCATALYST_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA) +MACCATALYST_NUGET_VERSION_FULL=$(MACCATALYST_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) # Xcode version should have both a major and a minor version (even if the minor version is 0) XCODE_VERSION=15.4 @@ -315,7 +319,7 @@ INCLUDE_TVOS=1 INCLUDE_MACCATALYST=1 INCLUDE_DEVICE=1 INCLUDE_DOTNET_WATCHOS= -INCLUDE_XAMARIN_LEGACY=1 +INCLUDE_XAMARIN_LEGACY= INCLUDE_HOTRESTART=1 ENABLE_DOTNET=1 @@ -581,7 +585,7 @@ MACOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(MACOS_NUGET_VERSION))) MACOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(MACOS_NUGET_VERSION))) MACOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(MACOS_NUGET_VERSION))) MACOS_NUGET_VERSION_NO_METADATA=$(MACOS_NUGET_VERSION)$(NUGET_PRERELEASE_IDENTIFIER) -MACOS_NUGET_VERSION_FULL=$(MACOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA) +MACOS_NUGET_VERSION_FULL=$(MACOS_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) ifneq ($(TESTS_USE_SYSTEM),) MAC_DESTDIR ?= / diff --git a/NuGet.config b/NuGet.config index 2ffc56d68bba..8eaa26dc735b 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,32 +10,28 @@ - - - - - + + + + + + + + + + - - - - - + + - - - - - + - - @@ -43,27 +39,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -71,18 +46,11 @@ - - - - - + - - - - - + + diff --git a/dotnet/Makefile b/dotnet/Makefile index aba5ffcf5db0..24c2192d4db2 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -362,7 +362,7 @@ $(TMP_PKG_DIR)/Microsoft.$1.Templates.$2.pkg: $(TEMPLATE_PACKS_$(4)) | $(TMP_PKG $$(Q) rm -f $$@ $$(Q) rm -rf tmpdir/Microsoft.$1.Templates.$2/ $$(Q) mkdir -p tmpdir/Microsoft.$1.Templates.$2/usr/local/share/dotnet/template-packs/ - $$(Q) $$(CP) $(TEMPLATE_PACKS_$(4)) tmpdir/Microsoft.$1.Templates.$2/usr/local/share/dotnet/template-packs/$(subst +$(NUGET_BUILD_METADATA),,$(notdir $(TEMPLATE_PACKS_$(4)))) + $$(Q) $$(CP) $(TEMPLATE_PACKS_$(4)) tmpdir/Microsoft.$1.Templates.$2/usr/local/share/dotnet/template-packs/$(subst $(NUGET_BUILD_METADATA),,$(notdir $(TEMPLATE_PACKS_$(4)))) $$(Q_GEN) pkgbuild --quiet --version '$2' --root tmpdir/Microsoft.$1.Templates.$2 --component-plist PackageInfo.plist --install-location / --identifier com.microsoft.net.$3.template.pkg $$@.tmp $$(Q) mv $$@.tmp $$@ @@ -395,7 +395,7 @@ $(TMP_PKG_DIR)/Microsoft.$1.Bundle.$2.zip: $($(1)_NUGET_TARGETS) $(WORKLOAD_TARG $$(Q) $(CP) -r Workloads/Microsoft.NET.Sdk.$1 $$@.tmpdir/dotnet/sdk-manifests/$(MACIOS_MANIFEST_VERSION_BAND)/microsoft.net.sdk.$3 $$(Q) $(CP) -r $(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME) $$@.tmpdir/dotnet/packs/$($(1)_NUGET_SDK_NAME)/$2 $$(Q) $(CP) -r $(DOTNET_DESTDIR)/$($(1)_NUGET_REF_NAME) $$@.tmpdir/dotnet/packs/$($(1)_NUGET_REF_NAME)/$2 - $$(Q) $(CP) $(TEMPLATE_PACKS_$(4)) $$@.tmpdir/dotnet/template-packs/$(subst +$(NUGET_BUILD_METADATA),,$(notdir $(TEMPLATE_PACKS_$(4)))) + $$(Q) $(CP) $(TEMPLATE_PACKS_$(4)) $$@.tmpdir/dotnet/template-packs/$(subst $(NUGET_BUILD_METADATA),,$(notdir $(TEMPLATE_PACKS_$(4)))) $$(Q_GEN) cd $$@.tmpdir && zip -9rq $$(abspath $$@.tmp) . $$(Q) mv $$@.tmp $$@ $$(Q) echo Created $$@ @@ -423,7 +423,7 @@ $(TMP_PKG_DIR)/Microsoft.$1.Windows.Bundle.$2.zip: $($(1)_NUGET_TARGETS) $($(1)_ $$(Q) $(CP) -r $(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME) $$@.tmpdir/dotnet/packs/$($(1)_NUGET_SDK_NAME)/$2 $$(Q) $(CP) -r $(DOTNET_DESTDIR)/$($(1)_NUGET_WINDOWS_SDK_NAME) $$@.tmpdir/dotnet/packs/$($(1)_NUGET_WINDOWS_SDK_NAME)/$2 $$(Q) $(CP) -r $(DOTNET_DESTDIR)/$($(1)_NUGET_REF_NAME) $$@.tmpdir/dotnet/packs/$($(1)_NUGET_REF_NAME)/$2 - $$(Q) $(CP) $(TEMPLATE_PACKS_$(4)) $$@.tmpdir/dotnet/template-packs/$(subst +$(NUGET_BUILD_METADATA),,$(notdir $(TEMPLATE_PACKS_$(4)))) + $$(Q) $(CP) $(TEMPLATE_PACKS_$(4)) $$@.tmpdir/dotnet/template-packs/$(subst $(NUGET_BUILD_METADATA),,$(notdir $(TEMPLATE_PACKS_$(4)))) $$(Q_GEN) cd $$@.tmpdir && zip -9rq $$(abspath $$@.tmp) . $$(Q) mv $$@.tmp $$@ $$(Q) echo Created $$@ diff --git a/dotnet/VERSIONS.md b/dotnet/VERSIONS.md index 092f4d32ae06..a55bb91c8ff6 100644 --- a/dotnet/VERSIONS.md +++ b/dotnet/VERSIONS.md @@ -4,7 +4,7 @@ Our NuGet packages are versioned using [Semver 2.0.0][2]. -This is the scheme: `OsMajor.OsMinor.InternalRelease[-prereleaseX]+sha.1b2c3d4`. +This is the scheme: `OsMajor.OsMinor.InternalRelease[-prereleaseX]`. * Major: The major OS version. * Minor: The minor OS version. @@ -36,24 +36,13 @@ This is the scheme: `OsMajor.OsMinor.InternalRelease[-prereleaseX]+sha.1b2c3d4`. * Example: `iOS 15.1.123-rt` (and nothing else). This makes these versions exactly 3 characters longer than the release version, which is hopefully enough to avoid MAX_PATH issues on Windows. -* Build metadata: Required Hash +* Build metadata: Optional Hash * This is `sha.` + the short commit hash. * Use the short hash because the long hash is quite long and cumbersome. This leaves the complete version open for duplication, but this is extremely unlikely. * Example: `iOS 14.0.123+sha.1a2b3c` * Example (CI build): `iOS 15.0.123-ci.main+sha.1a2b3c` - * Since the build metadata is required for all builds, we're able to - recognize incomplete version numbers and determine if a particular - version string refers to a stable version or not. - * Example: `iOS 15.0.123`: incomplete version - * Example: `iOS 15.0.123+sha.1a2b3c`: stable - * Example: `iOS 15.0.123-ci.d17-0+sha.1a2b3c`: CI build - * Example: `iOS 15.0.123-xcode13-1.beta+sha.1a2b3c`: official - preview - * Technically it's possible to remove the prerelease part, but - we’d still be able to figure out it’s not a stable version by - using the commit hash. [1]: https://github.com/dotnet/designs/blob/master/accepted/2018/sdk-version-scheme.md [2]: https://semver.org diff --git a/dotnet/package/Icon.png b/dotnet/package/Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..fb00ecf91e4b78804c636194bb323bf3710fa1c6 GIT binary patch literal 2140 zcmeHIX;4#F6iz}QBp3(*v25~!F*qzP0ojoU1Wja7KpD}12oa>Xrfece2to*M4{<@1 zP%%ms&>BGn2e5_86S0m&0z?*tFd77$B7y>vzNa&tPJedV>7UNLH{U(qJ@=gNJNL&G zZwy{XCYg~i7z~-iW`$xfSQ!0vwGifWRzWuc0UHB1`G?p&M?Q^4^TQdnylqlFJQMHV zlMy}8cyoMm;xpH^t5o#5@y2-k+Mdkle$k#mS^4OrhKW<@s@vsbjW^%%!+QI>rn#<) z{_bgV=B_HFEH)`LIBec*h>(fF5SlnFpG|4X(PvmP2D6~~`@Sai?5+nm4-!M>!#e`& z78+VFVXe(SMlq!^eg7xWd6boUvM4P&8=5T0wgi! zp<$6Qus?iG)+d;(0n8C!5))oCLL24Oym*Gn(Wz_qt3FCV776EaQ0@8?Z;*X?j^|Sm zn!Z?CE$ZK^Bel^@7%D^$=pOWDB0`L52FJhnR;@@*4VX&YV4t-$6D&!6S(50;t4kpO zSu@uc7lG;JP{4;;gTKszM|=8RA1W@lCalj952n{cQ<2H{5Ho%XwCWD_{Z4eMJK>$z zk!wqDgEouoAc>PS^6@?wtqyq}w+)qQ-k}&oy@>2Jq0>$(&(2yz!kQ$B-aeP1JVAwi zLdDN$6HyHca*;h+GLwCO>;wmB&|!(*}Njk+((AJ3{PGOdx_ow6Z(=O$zl0DfhA9qWN%*0384ZX-%PdlCVsU;^WuLWS6 zFXEf8|L9P?|BxkhKeqYq++65zuqrIXB_=k7X0>One(W+8@jAr|KOqE zA{8rpb%xTK*LyH?wH7r3VwmvsXBR83fP-{+TLwEzY04n+9E2=$_+^Svj1xydpdM_| zOAWL@lsIQ|g;s%d*cN6$i7RV!TL3t`Nippk%z?;2>&ui}v9{Qry++zPRCad)IAFrl zVrN|@85!_xg;Kwn%BW~--xx!>Wk=-d&Bet~zEI_-Jkz#l_a=BNo+EN{T-sGgLK>2R zTl1?679M`Te?VAqflxs-Xlp(?+z^mfcBjCASoPc0Eo+$1Ukv);wnZsCeH&`cr6V+- zlv98Q2P&n*!Bn0NQC5WS;Rxq;oYdzbZwp4})3$-jUb&QY)+bmNVpr+``XIZdFn@{R z-y&lERCUNMmld3Uk>W<<`>Kw>#6lx$oBxuCIFtk;kF{VWJb!KMr(kW0zjXo2SiFoH kLN8~t3iGWE|8=58=$f)MBl>~e*<^I~9RFa}4c}$(CurrentHash) Microsoft © Microsoft Corporation. All rights reserved. - https://github.com/xamarin/xamarin-macios + https://dot.net + microsoft,dotnetframework LICENSE + Icon.png + true + true false false @@ -39,6 +43,7 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8cceb4523f65..e4bf748b48dd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,30 +1,30 @@ - + https://github.com/dotnet/installer - dc7a330f651df44966b2630e039ba67ac74f6482 + 6e9002c2efcfc09687feca31864ebc987c3c9ec8 https://github.com/dotnet/runtime 59edaad404d1b8e47080015ae8d0787f94c970df - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 2aade6beb02ea367fd97c4070a4198802fe61c03 + 08338fcaa5c9b9a8190abb99222fed12aaba956c - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 2aade6beb02ea367fd97c4070a4198802fe61c03 + 08338fcaa5c9b9a8190abb99222fed12aaba956c - + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore - 2f1db20456007c9515068a35a65afdf99af70bc6 + 954f61dd38b33caa2b736c73530bd5a294174437 - + https://github.com/dotnet/emsdk - a64772f521c578bc9925578b1384d3a08a02d31d + e92f92efe5854b6fe013787830b59166cb9b4ed9 https://github.com/dotnet/cecil @@ -70,7 +70,11 @@ - + + https://github.com/dotnet/arcade + 51321b7e150a2f426cb9e1334687bdfab68ec323 + + https://github.com/dotnet/arcade 60ae233c3d77f11c5fdb53e570b64d503b13ba59 @@ -78,9 +82,9 @@ https://github.com/dotnet/templating - + https://github.com/dotnet/xharness - 9794254fa909ff5adc46326e9b54009793f61dcd + 69f15217657bc3a7f0102911aa967525529fdfdb diff --git a/eng/Versions.props b/eng/Versions.props index bd4352fb0e1e..88ded3a987ac 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -3,16 +3,16 @@ 0.11.4-alpha.23509.2 - 8.0.109-servicing.24407.6 - 8.0.7 + 8.0.109-servicing.24419.10 + 8.0.8 8.0.0-rtm.23524.7 9.0.0-beta.24408.2 8.0.0-beta.24413.2 - 8.0.7 + 8.0.8 8.0.0-rtm.23511.3 8.0.0 7.0.100-alpha.1.21601.1 - 9.0.0-prerelease.24405.1 + 9.0.0-prerelease.24420.3 $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) diff --git a/global.json b/global.json index 20f82c05529e..cafd9183b631 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.109-servicing.24407.6" + "version": "8.0.109-servicing.24419.10" } } diff --git a/mk/quiet.mk b/mk/quiet.mk index 31d535dc992b..33becd20356b 100644 --- a/mk/quiet.mk +++ b/mk/quiet.mk @@ -84,7 +84,7 @@ MMP_VERBOSITY=-vvvv MTOUCH_VERBOSITY=-vvvv DOTNET_PACK_VERBOSITY= DOTNET_BUILD_VERBOSITY= -DOTNET_WORKLOAD_VERBOSITY= +DOTNET_WORKLOAD_VERBOSITY=--verbosity diagnostic NUGET_VERBOSITY= INSTALLER_VERBOSITY= ZIP_VERBOSITY= diff --git a/src/CoreVideo/CVPixelFormatDescription.cs b/src/CoreVideo/CVPixelFormatDescription.cs index 29547de4fce5..ae3b58290b2a 100644 --- a/src/CoreVideo/CVPixelFormatDescription.cs +++ b/src/CoreVideo/CVPixelFormatDescription.cs @@ -26,94 +26,136 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; +using System.ComponentModel; using System.Runtime.InteropServices; using CoreFoundation; using ObjCRuntime; using Foundation; +#if XAMCORE_5_0 +using CVFillExtendedPixelsCallBackDataStruct = CoreVideo.CVFillExtendedPixelsCallBackData; +#endif + #nullable enable namespace CoreVideo { - -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("tvos")] -#endif - public static class CVPixelFormatDescription { + public partial class CVPixelFormatDescription { #if !COREBUILD +#if !XAMCORE_5_0 + [Obsolete ("Use 'CVPixelFormatKeys.Name' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString NameKey; + + [Obsolete ("Use 'CVPixelFormatKeys.Constant' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString ConstantKey; + + [Obsolete ("Use 'CVPixelFormatKeys.CodecType' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString CodecTypeKey; + + [Obsolete ("Use 'CVPixelFormatKeys.FourCCKey' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString FourCCKey; + + [Obsolete ("Use 'CVPixelFormatKeys.Planes' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString PlanesKey; + + [Obsolete ("Use 'CVPixelFormatKeys.BlockWidth' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString BlockWidthKey; + + [Obsolete ("Use 'CVPixelFormatKeys.BlockHeight' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString BlockHeightKey; + + [Obsolete ("Use 'CVPixelFormatKeys.BitsPerBlock' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString BitsPerBlockKey; + + [Obsolete ("Use 'CVPixelFormatKeys.BlockHorizontalAlignment' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString BlockHorizontalAlignmentKey; + + [Obsolete ("Use 'CVPixelFormatKeys.BlockVerticalAlignment' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString BlockVerticalAlignmentKey; + + [Obsolete ("Use 'CVPixelFormatKeys.BlackBlock' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString BlackBlockKey; + + [Obsolete ("Use 'CVPixelFormatKeys.HorizontalSubsampling' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString HorizontalSubsamplingKey; + + [Obsolete ("Use 'CVPixelFormatKeys.VerticalSubsampling' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString VerticalSubsamplingKey; + [Obsolete ("Use 'CVPixelFormatKeys.OpenGLFormat' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString OpenGLFormatKey; + + [Obsolete ("Use 'CVPixelFormatKeys.OpenGLType' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString OpenGLTypeKey; + + [Obsolete ("Use 'CVPixelFormatKeys.OpenGLInternalFormat' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString OpenGLInternalFormatKey; + [Obsolete ("Use 'CVPixelFormatKeys.CGBitmapInfo' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString CGBitmapInfoKey; + [Obsolete ("Use 'CVPixelFormatKeys.QDCompatibility' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString QDCompatibilityKey; + + [Obsolete ("Use 'CVPixelFormatKeys.CGBitmapContextCompatibility' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString CGBitmapContextCompatibilityKey; + + [Obsolete ("Use 'CVPixelFormatKeys.CGImageCompatibility' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString CGImageCompatibilityKey; + + [Obsolete ("Use 'CVPixelFormatKeys.OpenGLCompatibility' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString OpenGLCompatibilityKey; + [Obsolete ("Use 'CVPixelFormatKeys.FillExtendedPixelsCallback' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString FillExtendedPixelsCallbackKey; -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] -#endif + [Obsolete ("Use 'CVPixelFormatKeys.ContainsRgb' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString ContainsRgb; -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] -#endif + + [Obsolete ("Use 'CVPixelFormatKeys.ContainsYCbCr' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString ContainsYCbCr; -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] -#endif + [Obsolete ("Use 'CVPixelFormatKeys.ComponentRange' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString ComponentRangeKey; -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] -#endif + + [Obsolete ("Use 'CVPixelFormatComponentRangeKeys.FullRange' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString ComponentRangeFullRangeKey; -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] -#endif + + [Obsolete ("Use 'CVPixelFormatComponentRangeKeys.VideoRange' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString ComponentRangeVideoRangeKey; -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] -#endif + + [Obsolete ("Use 'CVPixelFormatComponentRangeKeys.WideRange' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] public static readonly NSString ComponentRangeWideRangeKey; + [Obsolete ("Use 'CVPixelFormatKeys.ContainsGrayscale' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] #if NET [SupportedOSPlatform ("ios12.0")] [SupportedOSPlatform ("tvos12.0")] @@ -126,6 +168,8 @@ public static class CVPixelFormatDescription { #endif public static readonly NSString ContainsGrayscaleKey; + [Obsolete ("Use 'CVPixelFormatKeys.ContainsSenselArray' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] #if NET [SupportedOSPlatform ("ios16.0")] [SupportedOSPlatform ("maccatalyst16.0")] @@ -135,61 +179,75 @@ public static class CVPixelFormatDescription { [Mac (13, 0), iOS (16, 0), TV (16, 0), MacCatalyst (16, 0)] #endif public static readonly NSString ContainsSenselArray; +#endif // !XAMCORE_5_0 +#if !XAMCORE_5_0 static CVPixelFormatDescription () { - var handle = Libraries.CoreVideo.Handle; - NameKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatName")!; - ConstantKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatConstant")!; - CodecTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCodecType")!; - FourCCKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFourCC")!; - PlanesKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatPlanes")!; - BlockWidthKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockWidth")!; - BlockHeightKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHeight")!; - BitsPerBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBitsPerBlock")!; - BlockHorizontalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHorizontalAlignment")!; - BlockVerticalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockVerticalAlignment")!; - BlackBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlackBlock")!; - HorizontalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatHorizontalSubsampling")!; - VerticalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatVerticalSubsampling")!; - OpenGLFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLFormat")!; - OpenGLTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLType")!; - OpenGLInternalFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLInternalFormat")!; - CGBitmapInfoKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapInfo")!; - QDCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatQDCompatibility")!; - CGBitmapContextCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapContextCompatibility")!; - CGImageCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGImageCompatibility")!; - OpenGLCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLCompatibility")!; - FillExtendedPixelsCallbackKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFillExtendedPixelsCallback")!; + NameKey = CVPixelFormatKeys.Name; + ConstantKey = CVPixelFormatKeys.Constant; + CodecTypeKey = CVPixelFormatKeys.CodecType; + FourCCKey = CVPixelFormatKeys.FourCC; + PlanesKey = CVPixelFormatKeys.Planes; + BlockWidthKey = CVPixelFormatKeys.BlockWidth; + BlockHeightKey = CVPixelFormatKeys.BlockHeight; + BitsPerBlockKey = CVPixelFormatKeys.BitsPerBlock; + BlockHorizontalAlignmentKey = CVPixelFormatKeys.BlockHorizontalAlignment; + BlockVerticalAlignmentKey = CVPixelFormatKeys.BlockVerticalAlignment; + BlackBlockKey = CVPixelFormatKeys.BlackBlock; + HorizontalSubsamplingKey = CVPixelFormatKeys.HorizontalSubsampling; + VerticalSubsamplingKey = CVPixelFormatKeys.VerticalSubsampling; + OpenGLFormatKey = CVPixelFormatKeys.OpenGLFormat; + OpenGLTypeKey = CVPixelFormatKeys.OpenGLType; + OpenGLInternalFormatKey = CVPixelFormatKeys.OpenGLInternalFormat; + CGBitmapInfoKey = CVPixelFormatKeys.CGBitmapInfo; + QDCompatibilityKey = CVPixelFormatKeys.QDCompatibility; + CGBitmapContextCompatibilityKey = CVPixelFormatKeys.CGBitmapContextCompatibility; + CGImageCompatibilityKey = CVPixelFormatKeys.CGImageCompatibility; + OpenGLCompatibilityKey = CVPixelFormatKeys.OpenGLCompatibility; + FillExtendedPixelsCallbackKey = CVPixelFormatKeys.FillExtendedPixelsCallback; //iOS8 only - ContainsRgb = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsRGB")!; - ContainsYCbCr = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsYCbCr")!; + ContainsRgb = CVPixelFormatKeys.ContainsRgb; + ContainsYCbCr = CVPixelFormatKeys.ContainsYCbCr; //iOS9 only - ComponentRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange")!; - ComponentRangeFullRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_FullRange")!; - ComponentRangeVideoRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_VideoRange")!; - ComponentRangeWideRangeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatComponentRange_WideRange")!; + ComponentRangeKey = CVPixelFormatKeys.ComponentRange; + ComponentRangeFullRangeKey = CVPixelFormatComponentRangeKeys.FullRange; + ComponentRangeVideoRangeKey = CVPixelFormatComponentRangeKeys.VideoRange; + ComponentRangeWideRangeKey = CVPixelFormatComponentRangeKeys.WideRange; // Xcode 10 - ContainsGrayscaleKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsGrayscale")!; + ContainsGrayscaleKey = CVPixelFormatKeys.ContainsGrayscale; // Xcode 14 - ContainsSenselArray = Dlfcn.GetStringConstant (handle, "kCVPixelFormatContainsSenselArray")!; + ContainsSenselArray = CVPixelFormatKeys.ContainsSenselArray; } +#endif // note: bad documentation, ref: https://bugzilla.xamarin.com/show_bug.cgi?id=13917 [DllImport (Constants.CoreVideoLibrary)] extern static/* CFArrayRef __nullable */ IntPtr CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes ( /* CFAllocatorRef __nullable */ IntPtr allocator); + /// Get all the known pixel format types. public static NSNumber [] AllTypes { get { return NSArray.ArrayFromHandle (CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes (IntPtr.Zero)); } } + /// Get all the known pixel format types. + public static CVPixelFormatType [] AllPixelFormatTypes { + get { + var all = AllTypes; + var rv = new CVPixelFormatType [all.Length]; + for (var i = 0; i < rv.Length; i++) + rv [i] = (CVPixelFormatType) all [i].Int32Value; + return rv; + } + } + [DllImport (Constants.CoreVideoLibrary)] extern static /* CFDictionaryRef __nullable */ IntPtr CVPixelFormatDescriptionCreateWithPixelFormatType ( /* CFAllocatorRef __nullable */ IntPtr allocator, int /* OSType = int32_t */ pixelFormat); @@ -201,11 +259,23 @@ public static NSNumber [] AllTypes { } #endif + /// Create a description of the specified pixel format. + /// The pixel format to create a description of. public static NSDictionary? Create (CVPixelFormatType pixelFormat) { return Runtime.GetNSObject (CVPixelFormatDescriptionCreateWithPixelFormatType (IntPtr.Zero, (int) pixelFormat)); } + /// Create a description of the specified pixel format. + /// The pixel format to create a description of. + public static CVPixelFormatDescription? CreatePixelFormat (CVPixelFormatType pixelFormat) + { + var dict = Create (pixelFormat); + if (dict is null) + return null; + return new CVPixelFormatDescription (dict); + } + [DllImport (Constants.CoreVideoLibrary)] extern static void CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType ( /* CFDictionaryRef __nonnull */ IntPtr description, int /* OSType = int32_t */ pixelFormat); @@ -220,6 +290,9 @@ public static void Register (NSDictionary description, int pixelFormat) } #endif + /// Register a new pixel format with CoreVideo. + /// The pixel format description for the pixel format to register. + /// The pixel format to register. public static void Register (NSDictionary description, CVPixelFormatType pixelFormat) { if (description is null) @@ -227,6 +300,74 @@ public static void Register (NSDictionary description, CVPixelFormatType pixelFo CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType (description.Handle, (int) pixelFormat); } + + /// Register a new pixel format with CoreVideo. + /// The pixel format description for the pixel format to register. + /// The pixel format to register. + public static void Register (CVPixelFormatDescription description, CVPixelFormatType pixelFormat) + { + Register (description?.Dictionary!, pixelFormat); + } + +#if NET + [SupportedOSPlatform ("macos12.0")] + [SupportedOSPlatform ("tvos15.0")] + [SupportedOSPlatform ("ios15.0")] + [SupportedOSPlatform ("maccatalyst15.0")] +#else + [iOS (15, 0), MacCatalyst (15, 0), TV (15, 0), Mac (12, 0), Watch (8, 0)] +#endif + [DllImport (Constants.CoreVideoLibrary)] + extern static byte CVIsCompressedPixelFormatAvailable (int /* OSType = int32_t */ pixelFormat); + + /// Check if the specified pixel format is supported on this platform. + /// The pixel format to check. + /// Whether the specified pixel format is supported or not. +#if NET + [SupportedOSPlatform ("macos12.0")] + [SupportedOSPlatform ("tvos15.0")] + [SupportedOSPlatform ("ios15.0")] + [SupportedOSPlatform ("maccatalyst15.0")] +#else + [iOS (15, 0), MacCatalyst (15, 0), TV (15, 0), Mac (12, 0), Watch (8, 0)] +#endif + public static bool IsPixelFormatAvailable (CVPixelFormatType pixelFormat) + { + return CVIsCompressedPixelFormatAvailable ((int) pixelFormat) != 0; + } + +#if NET + [SupportedOSPlatform ("ios")] + [SupportedOSPlatform ("maccatalyst")] + [SupportedOSPlatform ("macos")] + [SupportedOSPlatform ("tvos")] + public CVFillExtendedPixelsCallBackDataStruct? FillExtendedPixelsCallbackStruct { + get { + var data = FillExtendedPixelsCallback; + if (data is null) + return null; + var bytes = data.ToArray (); + unsafe { + if (bytes.Length < sizeof (CVFillExtendedPixelsCallBackDataStruct)) + throw new InvalidOperationException ($"The size of the callback data structure is smaller than expected (got {bytes.Length} bytes, expected at least {sizeof (CVFillExtendedPixelsCallBackDataStruct)} bytes)"); + fixed (byte *ptr = bytes) + return Marshal.PtrToStructure ((IntPtr) ptr); + } + } + set { + if (value is null) { + FillExtendedPixelsCallback = null; + return; + } + NSData data; + CVFillExtendedPixelsCallBackDataStruct v = value.Value; + unsafe { + data = NSData.FromBytes ((IntPtr) (&v), (nuint) sizeof (CVFillExtendedPixelsCallBackDataStruct)); + } + FillExtendedPixelsCallback = data; + } + } +#endif #endif // !COREBUILD } } diff --git a/src/CoreVideo/CoreVideo.cs b/src/CoreVideo/CoreVideo.cs index 9080389ab975..d3e34b6d80e1 100644 --- a/src/CoreVideo/CoreVideo.cs +++ b/src/CoreVideo/CoreVideo.cs @@ -118,6 +118,7 @@ public struct CVSMPTETime { public Int16 Frames; } +#if !XAMCORE_5_0 #if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] @@ -131,4 +132,32 @@ public struct CVFillExtendedPixelsCallBackData { } public delegate bool CVFillExtendedPixelsCallBack (IntPtr pixelBuffer, IntPtr refCon); +#endif // !XAMCORE_5_0 + +#if NET + [SupportedOSPlatform ("ios")] + [SupportedOSPlatform ("maccatalyst")] + [SupportedOSPlatform ("macos")] + [SupportedOSPlatform ("tvos")] +#if XAMCORE_5_0 + public unsafe struct CVFillExtendedPixelsCallBackData { +#else + [NativeName ("CVFillExtendedPixelsCallBackData")] + public unsafe struct CVFillExtendedPixelsCallBackDataStruct { +#endif + public nint /* CFIndex */ Version; + public delegate* unmanaged FillCallBack; + public IntPtr UserInfo; +#if !COREBUILD + public unsafe bool CallFillCallback (CVPixelBuffer buffer) + { + if (FillCallBack is null) + throw new InvalidOperationException ($"The callback is null."); + var rv = FillCallBack (buffer.GetCheckedHandle (), UserInfo); + return rv != 0; + } +#endif + } +#endif + } diff --git a/src/Foundation/NSUrlSessionHandler.cs b/src/Foundation/NSUrlSessionHandler.cs index 638211139a35..a2029e14a34d 100644 --- a/src/Foundation/NSUrlSessionHandler.cs +++ b/src/Foundation/NSUrlSessionHandler.cs @@ -651,7 +651,10 @@ public bool PreAuthenticate { [EditorBrowsable (EditorBrowsableState.Never)] public IWebProxy? Proxy { get => null; - set => throw new PlatformNotSupportedException (); + set { + if (value is not null) + throw new PlatformNotSupportedException (); + } } // There doesn't seem to be a trivial way to specify the protocols to accept (or not) diff --git a/src/Network/NWConnection.cs b/src/Network/NWConnection.cs index ed153271bb9a..f68baf330bb2 100644 --- a/src/Network/NWConnection.cs +++ b/src/Network/NWConnection.cs @@ -9,6 +9,7 @@ #nullable enable using System; +using System.ComponentModel; using System.Runtime.InteropServices; using ObjCRuntime; using Foundation; @@ -157,8 +158,20 @@ static void TrampolineBooleanChangeHandler (IntPtr block, byte value) [DllImport (Constants.NetworkLibrary)] static extern unsafe void nw_connection_set_viability_changed_handler (IntPtr handle, void* callback); +#if !XAMCORE_5_0 + [Obsolete ("Use 'SetViabilityChangeHandler' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] [BindingImpl (BindingImplOptions.Optimizable)] public unsafe void SetBooleanChangeHandler (Action callback) + { + SetViabilityChangeHandler (callback); + } +#endif // !XAMCORE_5_0 + + /// Set a handler that is called when data can be sent or received. + /// The callback to call when data can be sent or received. + [BindingImpl (BindingImplOptions.Optimizable)] + public unsafe void SetViabilityChangeHandler (Action callback) { if (callback is null) { nw_connection_set_viability_changed_handler (GetCheckedHandle (), null); diff --git a/src/ObjCRuntime/Dlfcn.cs b/src/ObjCRuntime/Dlfcn.cs index 1aa8a74c4f09..541ce35ec247 100644 --- a/src/ObjCRuntime/Dlfcn.cs +++ b/src/ObjCRuntime/Dlfcn.cs @@ -203,6 +203,114 @@ public static IntPtr GetIndirect (IntPtr handle, string symbol) return Runtime.GetNSObject (actual); } + /// Gets the signed byte value exposed with the given symbol from the dynamic library. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value from the library, or zero on failure. + /// If this routine fails, it will return zero. + public static sbyte GetSByte (IntPtr handle, string symbol) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return 0; + unchecked { + return (sbyte) Marshal.ReadByte (indirect); + } + } + + /// Sets the specified symbol in the library handle to the specified signed byte value. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value to set. + public static void SetSByte (IntPtr handle, string symbol, sbyte value) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return; + unsafe { + Marshal.WriteByte (indirect, (byte) value); + } + } + + /// Gets the byte value exposed with the given symbol from the dynamic library. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value from the library, or zero on failure. + /// If this routine fails, it will return zero. + public static byte GetByte (IntPtr handle, string symbol) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return 0; + return Marshal.ReadByte (indirect); + } + + /// Sets the specified symbol in the library handle to the specified byte value. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value to set. + public static void SetByte (IntPtr handle, string symbol, byte value) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return; + Marshal.WriteByte (indirect, value); + } + + /// Gets the short value exposed with the given symbol from the dynamic library. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value from the library, or zero on failure. + /// If this routine fails, it will return zero. + public static short GetInt16 (IntPtr handle, string symbol) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return 0; + return Marshal.ReadInt16 (indirect); + } + + /// Sets the specified symbol in the library handle to the specified short value. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value to set. + public static void SetInt16 (IntPtr handle, string symbol, short value) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return; + Marshal.WriteInt16 (indirect, value); + } + + /// Gets the ushort value exposed with the given symbol from the dynamic library. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value from the library, or zero on failure. + /// If this routine fails, it will return zero. + public static ushort GetUInt16 (IntPtr handle, string symbol) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return 0; + unchecked { + return (ushort) Marshal.ReadInt16 (indirect); + } + } + + /// Sets the specified symbol in the library handle to the specified ushort value. + /// Handle to the dynamic library previously opened with or . + /// Name of the public symbol in the dynamic library to look up. + /// The value to set. + public static void SetUInt16 (IntPtr handle, string symbol, ushort value) + { + var indirect = dlsym (handle, symbol); + if (indirect == IntPtr.Zero) + return; + unchecked { + Marshal.WriteInt16 (indirect, (short) value); + } + } + public static int GetInt32 (IntPtr handle, string symbol) { var indirect = dlsym (handle, symbol); diff --git a/src/avfoundation.cs b/src/avfoundation.cs index db56fa143107..12ad3bd5eb6c 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -221,7 +221,7 @@ enum AVMediaTypes { } #if !NET - [Obsolete ("Use AVMediaTypes enum values")] + [Obsolete ("Use AVMediaTypes enum values.")] [NoWatch] [BaseType (typeof (NSObject))] [Static] @@ -420,7 +420,7 @@ enum AVMediaCharacteristics { #if !NET [NoWatch] - [Obsolete ("Use AVMediaCharacteristics enum values")] + [Obsolete ("Use AVMediaCharacteristics enum values.")] [BaseType (typeof (NSObject))] [Static] interface AVMediaCharacteristic { @@ -598,7 +598,7 @@ enum AVFileTypes { [NoWatch] [BaseType (typeof (NSObject))] [Static] - [Obsolete ("Use AVFileTypes enum values")] + [Obsolete ("Use AVFileTypes enum values.")] interface AVFileType { [Field ("AVFileTypeQuickTimeMovie")] NSString QuickTimeMovie { get; } diff --git a/src/bgen/AttributeManager.cs b/src/bgen/AttributeManager.cs index 66b5bd9a271d..c82d1fdeb770 100644 --- a/src/bgen/AttributeManager.cs +++ b/src/bgen/AttributeManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Reflection; #if !NET @@ -672,4 +673,40 @@ public bool IsStatic (ICustomAttributeProvider provider) } return false; } + + public bool IsNullable (ICustomAttributeProvider provider) + { + var attributes = GetAttributes (provider); + if (attributes is null) + return false; + + // first check if any of the attributes are [NullAllowed] + foreach (var attrib in attributes) { + var attribType = attrib.GetAttributeType (); + if (attribType.Name == "NullAllowedAttribute") + return true; + } + + // then check for [Nullable] + foreach (var attrib in attributes) { + var attribType = attrib.GetAttributeType (); + if (attribType.Name == "NullableAttribute") { + // https://codeblog.jonskeet.uk/2019/02/10/nullableattribute-and-c-8/ + if (attrib.ConstructorArguments.Count == 1) { + var argType = attrib.ConstructorArguments [0].ArgumentType; + if (argType.Namespace == "System" && argType.Name == "Byte") + return ((byte) attrib.ConstructorArguments [0].Value) == 2; + if (argType.IsArray && argType.GetElementType ().Namespace == "System" && argType.GetElementType ().Name == "Byte") { + var valueCollection = (ReadOnlyCollection) attrib.ConstructorArguments [0].Value; + // Getting complex nullability right means we'll have to completely rework how we render types. + // So don't do that for now, just look at the outermost type (the first number in the array), + // and return nullability depending on that value. + return ((byte) valueCollection [0].Value) == 2; + } + } + } + } + + return false; + } } diff --git a/src/bgen/Enums.cs b/src/bgen/Enums.cs index 52a48eb80b49..48e9652e06a8 100644 --- a/src/bgen/Enums.cs +++ b/src/bgen/Enums.cs @@ -82,7 +82,6 @@ void GenerateEnum (Type type) sb.Append ("]"); print (sb.ToString ()); } - PrintObsoleteAttributes (type); CopyNativeName (type); var unique_constants = new HashSet (); @@ -301,6 +300,47 @@ void GenerateEnum (Type type) indent--; print ("}"); + if (BindingTouch.SupportsXmlDocumentation) { + print ($"/// Converts an array of enum values into an array of their corresponding constants."); + print ($"/// The array of enum values to convert."); + } + print ($"internal static {backingFieldTypeName}?[]? ToConstantArray (this {type.Name}[]? values)"); + print ("{"); + indent++; + print ("if (values is null)"); + print ("\treturn null;"); + print ($"var rv = new global::System.Collections.Generic.List<{backingFieldTypeName}?> ();"); + print ("for (var i = 0; i < values.Length; i++) {"); + indent++; + print ("var value = values [i];"); + print ("rv.Add (value.GetConstant ());"); + indent--; + print ("}"); + print ("return rv.ToArray ();"); + indent--; + print ("}"); + print (""); + if (BindingTouch.SupportsXmlDocumentation) { + print ($"/// Converts an array of values into an array of their corresponding enum values."); + print ($"/// The array if values to convert."); + } + print ($"internal static {type.Name}[]? ToEnumArray (this {backingFieldTypeName}[]? values)"); + print ("{"); + indent++; + print ("if (values is null)"); + print ("\treturn null;"); + print ($"var rv = new global::System.Collections.Generic.List<{type.Name}> ();"); + print ("for (var i = 0; i < values.Length; i++) {"); + indent++; + print ("var value = values [i];"); + print ("rv.Add (GetValue (value));"); + indent--; + print ("}"); + print ("return rv.ToArray ();"); + indent--; + print ("}"); + print (""); + if (isFlagsEnum) { if (BindingTouch.SupportsXmlDocumentation) { print ($"/// Retrieves all the constants named by the flags ."); diff --git a/src/bgen/Filters.cs b/src/bgen/Filters.cs index bf8fb6721bca..822d20968d1b 100644 --- a/src/bgen/Filters.cs +++ b/src/bgen/Filters.cs @@ -200,7 +200,7 @@ void GenerateProperties (Type type, Type? originalType = null, bool fromProtocol nullable = true; break; } - if (AttributeManager.HasAttribute (p)) + if (AttributeManager.IsNullable (p)) nullable = true; print ("public {0}{1} {2} {{", ptype, nullable ? "?" : "", p.Name); indent++; diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 8c060449bce5..8c97f6c1fcf5 100644 --- a/src/bgen/Generator.cs +++ b/src/bgen/Generator.cs @@ -718,6 +718,14 @@ public TrampolineInfo MakeTrampoline (Type t) } } + if (pi.ParameterType.IsPointer && pi.ParameterType.GetElementType ().IsValueType) { + // Technically we should only allow blittable types here, but the C# compiler shows an error later on if any non-blittable types + // are used, because this ends up in the signature of a UnmanagedCallersOnly method. + pars.Add (new TrampolineParameterInfo (TypeManager.FormatType (null, pi.ParameterType), safe_name)); + invoke.Append (safe_name); + continue; + } + if (pi.ParameterType.IsSubclassOf (TypeCache.System_Delegate)) { if (!delegate_types.ContainsKey (pi.ParameterType.Name)) { delegate_types [pi.ParameterType.FullName] = pi.ParameterType.GetMethod ("Invoke"); @@ -807,7 +815,7 @@ public string MarshalParameter (MethodInfo mi, ParameterInfo pi, bool null_allow if (mai.PlainString) return safe_name; else { - bool allow_null = null_allowed_override || AttributeManager.HasAttribute (pi); + bool allow_null = null_allowed_override || AttributeManager.IsNullable (pi); if (mai.ZeroCopyStringMarshal) { if (allow_null) @@ -828,7 +836,7 @@ public string MarshalParameter (MethodInfo mi, ParameterInfo pi, bool null_allow MarshalType mt; if (marshalTypes.TryGetMarshalType (pi.ParameterType, out mt)) { - if (null_allowed_override || AttributeManager.HasAttribute (pi)) + if (null_allowed_override || AttributeManager.IsNullable (pi)) return safe_name + "__handle__"; return String.Format (mt.ParameterMarshal, safe_name); } @@ -836,7 +844,7 @@ public string MarshalParameter (MethodInfo mi, ParameterInfo pi, bool null_allow if (pi.ParameterType.IsArray) { //Type etype = pi.ParameterType.GetElementType (); - if (null_allowed_override || AttributeManager.HasAttribute (pi)) + if (null_allowed_override || AttributeManager.IsNullable (pi)) return String.Format ("nsa_{0}.GetHandle ()", pi.Name); return "nsa_" + pi.Name + ".Handle"; } @@ -875,13 +883,13 @@ public string MarshalParameter (MethodInfo mi, ParameterInfo pi, bool null_allow } if (TypeManager.IsDictionaryContainerType (pi.ParameterType)) { - if (null_allowed_override || AttributeManager.HasAttribute (pi)) + if (null_allowed_override || AttributeManager.IsNullable (pi)) return String.Format ("{0} is null ? NativeHandle.Zero : {0}.Dictionary.Handle", safe_name); return safe_name + ".Dictionary.Handle"; } if (pi.ParameterType.IsGenericParameter) { - if (null_allowed_override || AttributeManager.HasAttribute (pi)) + if (null_allowed_override || AttributeManager.IsNullable (pi)) return string.Format ("{0}.GetHandle ()", safe_name); return safe_name + ".Handle"; } @@ -895,14 +903,14 @@ public bool ParameterNeedsNullCheck (ParameterInfo pi, MethodInfo mi, PropertyIn if (pi.ParameterType.IsByRef) return false; - if (AttributeManager.HasAttribute (pi)) + if (AttributeManager.IsNullable (pi)) return false; if (IsSetter (mi)) { - if (AttributeManager.HasAttribute (mi)) { + if (AttributeManager.IsNullable (mi)) { return false; } - if ((propInfo is not null) && AttributeManager.HasAttribute (propInfo)) { + if ((propInfo is not null) && AttributeManager.IsNullable (propInfo)) { return false; } } @@ -1628,7 +1636,7 @@ void GenerateTrampolinesForQueue (TrampolineInfo [] queue) } else { if (ti.Convert.Length > 0) print (ti.Convert); - print ("{0} retval = del ({1});", ti.DelegateReturnType, ti.Invoke); + print ("var retval = del ({1});", ti.DelegateReturnType, ti.Invoke); if (ti.PostConvert.Length > 0) print (ti.PostConvert); print (ti.ReturnFormat, "retval"); @@ -2022,7 +2030,7 @@ void GenerateEventArgsFile () var is_internal = prop.IsInternal (this); var export = attrs [0]; var use_export_as_string_constant = export.ArgumentSemantic != ArgumentSemantic.None; - var null_allowed = AttributeManager.HasAttribute (prop); + var null_allowed = AttributeManager.IsNullable (prop); var nullable_type = prop.PropertyType.IsValueType && null_allowed; var propertyType = prop.PropertyType; var propNamespace = prop.DeclaringType.Namespace; @@ -2716,12 +2724,12 @@ public string MakeSignature (MemberInformation minfo, bool is_async, ParameterIn var bindAsAttrib = GetBindAsAttribute (minfo.mi); sb.Append (prefix + TypeManager.FormatType (bindAsAttrib.Type.DeclaringType, bindAsAttrib.Type)); - if (!bindAsAttrib.Type.IsValueType && AttributeManager.HasAttribute (mi.ReturnParameter)) + if (!bindAsAttrib.Type.IsValueType && AttributeManager.IsNullable (mi.ReturnParameter)) sb.Append ('?'); } else { sb.Append (prefix); sb.Append (TypeManager.FormatType (minfo.type, mi.ReturnType)); - if (!mi.ReturnType.IsValueType && AttributeManager.HasAttribute (mi.ReturnParameter)) + if (!mi.ReturnType.IsValueType && AttributeManager.IsNullable (mi.ReturnParameter)) sb.Append ('?'); } @@ -2815,18 +2823,18 @@ public void MakeSignatureFromParameterInfo (bool comma, StringBuilder sb, Member PrintBindAsAttribute (pi, sb); var bt = bindAsAtt.Type; sb.Append (TypeManager.FormatType (bt.DeclaringType, bt)); - if (!bt.IsValueType && AttributeManager.HasAttribute (pi)) + if (!bt.IsValueType && AttributeManager.IsNullable (pi)) sb.Append ('?'); } else { sb.Append (TypeManager.FormatType (declaringType, parType)); // some `IntPtr` are decorated with `[NullAttribute]` if (!parType.IsValueType) { - if (AttributeManager.HasAttribute (pi)) { + if (AttributeManager.IsNullable (pi)) { sb.Append ('?'); } else if (pi.Position == 0 && mi is MethodInfo minfo) { // only need to check for setter, since we wouldn't get here for a getter. var propertyInfo = GetProperty (minfo, getter: false, setter: true); - if (AttributeManager.HasAttribute (propertyInfo)) + if (AttributeManager.IsNullable (propertyInfo)) sb.Append ('?'); } } @@ -3288,7 +3296,7 @@ void GenerateTypeLowering (MethodInfo mi, bool null_allowed_override, out String // Construct conversions if (mai.Type == TypeCache.System_String && !mai.PlainString) { - bool probe_null = null_allowed_override || AttributeManager.HasAttribute (pi); + bool probe_null = null_allowed_override || AttributeManager.IsNullable (pi); convs.AppendFormat (GenerateMarshalString (probe_null, !mai.ZeroCopyStringMarshal), pi.Name, pi.Name.GetSafeParamName ()); disposes.AppendFormat (GenerateDisposeString (probe_null, !mai.ZeroCopyStringMarshal), pi.Name); @@ -3300,7 +3308,7 @@ void GenerateTypeLowering (MethodInfo mi, bool null_allowed_override, out String } else if (HasBindAsAttribute (propInfo)) { disposes.AppendFormat ("\nnsb_{0}?.Dispose ();", propInfo.Name); } else if (etype == TypeCache.System_String) { - if (null_allowed_override || AttributeManager.HasAttribute (pi)) { + if (null_allowed_override || AttributeManager.IsNullable (pi)) { convs.AppendFormat ("var nsa_{0} = {1} is null ? null : NSArray.FromStrings ({1});\n", pi.Name, pi.Name.GetSafeParamName ()); disposes.AppendFormat ("if (nsa_{0} is not null)\n\tnsa_{0}.Dispose ();\n", pi.Name); } else { @@ -3310,7 +3318,7 @@ void GenerateTypeLowering (MethodInfo mi, bool null_allowed_override, out String } else if (etype == TypeCache.Selector) { exceptions.Add (ErrorHelper.CreateError (1065, mai.Type.FullName, string.IsNullOrEmpty (pi.Name) ? $"#{pi.Position}" : pi.Name, mi.DeclaringType.FullName, mi.Name)); } else { - if (null_allowed_override || AttributeManager.HasAttribute (pi)) { + if (null_allowed_override || AttributeManager.IsNullable (pi)) { convs.AppendFormat ("var nsa_{0} = {1} is null ? null : NSArray.FromNSObjects ({1});\n", pi.Name, pi.Name.GetSafeParamName ()); disposes.AppendFormat ("if (nsa_{0} is not null)\n\tnsa_{0}.Dispose ();\n", pi.Name); } else { @@ -3320,11 +3328,11 @@ void GenerateTypeLowering (MethodInfo mi, bool null_allowed_override, out String } } else if (mai.Type.IsSubclassOf (TypeCache.System_Delegate)) { string trampoline_name = MakeTrampoline (pi.ParameterType).StaticName; - bool null_allowed = AttributeManager.HasAttribute (pi); + bool null_allowed = AttributeManager.IsNullable (pi); if (!null_allowed) { var property = GetProperty (mi); if (property is not null) - null_allowed = AttributeManager.HasAttribute (property); + null_allowed = AttributeManager.IsNullable (property); } var createBlockMethod = null_allowed ? "CreateNullableBlock" : "CreateBlock"; convs.AppendFormat ("using var block_{0} = Trampolines.{1}.{3} ({2});\n", pi.Name, trampoline_name, safe_name, createBlockMethod); @@ -3427,7 +3435,7 @@ void GenerateTypeLowering (MethodInfo mi, bool null_allowed_override, out String void GenerateArgumentChecks (MethodInfo mi, bool null_allowed_override, PropertyInfo propInfo = null) { - if (AttributeManager.HasAttribute (mi)) + if (AttributeManager.IsNullable (mi)) ErrorHelper.Show (new BindingException (1118, false, mi)); foreach (var pi in mi.GetParameters ()) { @@ -3866,7 +3874,7 @@ bool DoesPropertyNeedDirtyCheck (PropertyInfo pi, ExportAttribute ea) } } - void PrintObsoleteAttributes (ICustomAttributeProvider provider, bool already_has_editor_browsable_attribute = false) + void PrintObsoleteAttributes (ICustomAttributeProvider provider) { var obsoleteAttributes = AttributeManager.GetCustomAttributes (provider); @@ -3874,10 +3882,39 @@ void PrintObsoleteAttributes (ICustomAttributeProvider provider, bool already_ha print ("[Obsolete (\"{0}\", {1})]", oa.Message, oa.IsError ? "true" : "false"); } - if (!already_has_editor_browsable_attribute && obsoleteAttributes.Any ()) + var printEditorBrowsableAttribute = TryGetPrintEditorBrowsableAttribute (provider, out var editorBrowsableAttribute); + if (!printEditorBrowsableAttribute && obsoleteAttributes.Any ()) { + printEditorBrowsableAttribute = true; + editorBrowsableAttribute = "[EditorBrowsable (EditorBrowsableState.Never)]"; + } + if (printEditorBrowsableAttribute) print ("[EditorBrowsable (EditorBrowsableState.Never)]"); } + bool TryGetPrintEditorBrowsableAttribute (ICustomAttributeProvider provider, out string attribute) + { + attribute = string.Empty; + foreach (var ea in AttributeManager.GetCustomAttributes (provider)) { + switch (ea.State) { + case EditorBrowsableState.Always: + attribute = "[EditorBrowsable (EditorBrowsableState.Always)]"; + break; + case EditorBrowsableState.Never: + attribute = "[EditorBrowsable (EditorBrowsableState.Never)]"; + break; + case EditorBrowsableState.Advanced: + attribute = "[EditorBrowsable (EditorBrowsableState.Advanced)]"; + break; + default: + attribute = $"[EditorBrowsable (EditorBrowsableState.{ea.State})]"; + break; + } + return true; + } + + return false; + } + void PrintPropertyAttributes (PropertyInfo pi, Type type, bool skipTypeInjection = false) { var minfo = new MemberInformation (this, this, pi, type); @@ -3926,9 +3963,9 @@ void PrintProtocolMemberAttributes (MemberInformation minfo) #if NET if (minfo.is_protocol_member_required.Value) { - print ("[RequiredMember]"); + print ("[global::Foundation.RequiredMember]"); } else { - print ("[OptionalMember]"); + print ("[global::Foundation.OptionalMember]"); } #endif } @@ -3945,7 +3982,7 @@ void GenerateProperty (Type type, PropertyInfo pi, List instance_fields_ Type inlinedType = pi.DeclaringType == type ? null : type; GetAccessorInfo (pi, out var getter, out var setter, out var generate_getter, out var generate_setter); - var nullable = !pi.PropertyType.IsValueType && AttributeManager.HasAttribute (pi); + var nullable = !pi.PropertyType.IsValueType && AttributeManager.IsNullable (pi); // So we don't hide the get or set of a parent property with the same name, we need to see if we have a parent declaring the same property PropertyInfo parentBaseType = TypeManager.GetParentTypeWithSameNamedProperty (ReflectionExtensions.GetBaseTypeAttribute (type, this), pi.Name); @@ -4066,7 +4103,7 @@ void GenerateProperty (Type type, PropertyInfo pi, List instance_fields_ var bindAsAttrib = GetBindAsAttribute (minfo.mi); propertyTypeName = TypeManager.FormatType (bindAsAttrib.Type.DeclaringType, bindAsAttrib.Type); // it remains nullable only if the BindAs type can be null (i.e. a reference type) - nullable = !bindAsAttrib.Type.IsValueType && AttributeManager.HasAttribute (pi); + nullable = !bindAsAttrib.Type.IsValueType && AttributeManager.IsNullable (pi); } else { propertyTypeName = TypeManager.FormatType (minfo.type, pi.PropertyType); } @@ -4178,10 +4215,10 @@ void GenerateProperty (Type type, PropertyInfo pi, List instance_fields_ } if (generate_setter) { var ba = GetBindAttribute (setter); - bool null_allowed = AttributeManager.HasAttribute (setter); + bool null_allowed = AttributeManager.IsNullable (setter); if (null_allowed) ErrorHelper.Show (new BindingException (1118, false, setter)); - null_allowed |= AttributeManager.HasAttribute (pi); + null_allowed |= AttributeManager.IsNullable (pi); var not_implemented_attr = AttributeManager.GetCustomAttribute (setter); string sel; @@ -4418,21 +4455,11 @@ void GenerateAsyncMethod (MemberInformation original_minfo, AsyncMethodKind asyn void PrintMethodAttributes (MemberInformation minfo) { MethodInfo mi = minfo.Method; - var editor_browsable_attribute = false; foreach (var sa in AttributeManager.GetCustomAttributes (mi)) print (sa.Safe ? "[ThreadSafe]" : "[ThreadSafe (false)]"); - foreach (var ea in AttributeManager.GetCustomAttributes (mi)) { - if (ea.State == EditorBrowsableState.Always) { - print ("[EditorBrowsable]"); - } else { - print ("[EditorBrowsable (EditorBrowsableState.{0})]", ea.State); - } - editor_browsable_attribute = true; - } - - PrintObsoleteAttributes (mi, editor_browsable_attribute); + PrintObsoleteAttributes (mi); if (minfo.is_return_release) print ("[return: ReleaseAttribute ()]"); @@ -4536,8 +4563,8 @@ void GenerateMethod (MemberInformation minfo) argCount++; } if (minfo.Method.GetParameters ().Length != argCount) { - ErrorHelper.Warning (1105, - minfo.selector, argCount, minfo.Method, minfo.Method.GetParameters ().Length); + exceptions.Add (ErrorHelper.CreateWarning (1105, + minfo.selector, argCount, minfo.Method, minfo.Method.GetParameters ().Length)); } } @@ -4639,7 +4666,7 @@ void GenerateMethod (MemberInformation minfo) // we do not need the information if it's a getter (it won't change generated code) pinfo = GetProperty (method, getter: false, setter: true); if (pinfo is not null) - null_allowed = AttributeManager.HasAttribute (pinfo); + null_allowed = AttributeManager.IsNullable (pinfo); } GenerateMethodBody (minfo, minfo.Method, minfo.selector, null_allowed, null, BodyOption.None, pinfo); if (minfo.is_autorelease) { @@ -4712,11 +4739,13 @@ group fullname by ns into g print ("[MonoNativeFunctionWrapper]\n"); var accessibility = mi.DeclaringType.IsInternal (this) ? "internal" : "public"; - print ("{3} delegate {0} {1} ({2});", + var isUnsafe = mi.GetParameters ().Any ((v => v.ParameterType.IsPointer)) || mi.ReturnType.IsPointer; + print ("{3}{4} delegate {0} {1} ({2});", TypeManager.RenderType (mi.ReturnType, mi.ReturnTypeCustomAttributes), shortName, RenderParameterDecl (mi.GetParameters ()), - accessibility); + accessibility, + isUnsafe ? " unsafe" : string.Empty); } if (group.Namespace is not null) { @@ -5055,6 +5084,7 @@ void GenerateProtocolTypes (Type type, string class_visibility, string TypeName, foreach (var docId in docIds) { print ($"[DynamicDependencyAttribute (\"{docId}\")]"); } + print ("[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]"); print ($"static I{TypeName} ()"); print ("{"); print ("\tGC.KeepAlive (null);"); // need to do _something_ (doesn't seem to matter what), otherwise the static cctor (and the DynamicDependency attributes) are trimmed away. @@ -5130,7 +5160,7 @@ void GenerateProtocolTypes (Type type, string class_visibility, string TypeName, if (minfo.is_unsafe) mod = "unsafe "; // IsValueType check needed for `IntPtr` signatures (which can't become `IntPtr?`) - var nullable = !pi.PropertyType.IsValueType && AttributeManager.HasAttribute (pi) ? "?" : String.Empty; + var nullable = !pi.PropertyType.IsValueType && AttributeManager.IsNullable (pi) ? "?" : String.Empty; GetAccessorInfo (pi, out var getMethod, out var setMethod, out var generate_getter, out var generate_setter); print ("{0}{1}{2} {3} {{", mod, TypeManager.FormatType (type, pi.PropertyType), nullable, pi.Name, generate_getter ? "get;" : string.Empty, generate_setter ? "set;" : string.Empty); indent++; @@ -5507,7 +5537,7 @@ public void PrintBindAsAttribute (ICustomAttributeProvider mi, StringBuilder sb // Not adding the experimental attribute is bad (it would mean that an API // we meant to be experimental ended up being released as stable), so it's // opt-out instead of opt-in. - public void PrintAttributes (ICustomAttributeProvider mi, bool platform = false, bool preserve = false, bool advice = false, bool notImplemented = false, bool bindAs = false, bool requiresSuper = false, Type inlinedType = null, bool experimental = true) + public void PrintAttributes (ICustomAttributeProvider mi, bool platform = false, bool preserve = false, bool advice = false, bool notImplemented = false, bool bindAs = false, bool requiresSuper = false, Type inlinedType = null, bool experimental = true, bool obsolete = false) { if (platform) PrintPlatformAttributes (mi as MemberInfo, inlinedType); @@ -5523,6 +5553,8 @@ public void PrintAttributes (ICustomAttributeProvider mi, bool platform = false, PrintRequiresSuperAttribute (mi); if (experimental) PrintExperimentalAttribute (mi); + if (obsolete) + PrintObsoleteAttributes (mi); } public void PrintExperimentalAttribute (ICustomAttributeProvider mi) @@ -5754,7 +5786,7 @@ public void Generate (Type type) print ("[Model]"); } - PrintAttributes (type, platform: true, preserve: true, advice: true); + PrintAttributes (type, platform: true, preserve: true, advice: true, obsolete: true); if (type.IsEnum) { GenerateEnum (type); @@ -6251,8 +6283,8 @@ public void Generate (Type type) throw new BindingException (1037, true, pi.Name, type.Name); } - if (AttributeManager.HasAttribute (pi)) { - var nonNullableProperty = protocolsThatHaveThisProp.SingleOrDefault (v => !AttributeManager.HasAttribute (v)); + if (AttributeManager.IsNullable (pi)) { + var nonNullableProperty = protocolsThatHaveThisProp.SingleOrDefault (v => !AttributeManager.IsNullable (v)); if (nonNullableProperty is not null) { // We're getting the same property from multiple interfaces, and the nullability attributes don't match. // This results in a warning (which turn into an error because we've turned on warnaserror): @@ -6339,6 +6371,14 @@ public void Generate (Type type) print ("_{0} = Runtime.GetNSObject (Dlfcn.GetIntPtr (Libraries.{2}.Handle, \"{1}\"))!;", field_pi.Name, fieldAttr.SymbolName, library_name); indent--; print ("return _{0};", field_pi.Name); + } else if (field_pi.PropertyType == TypeCache.System_Byte) { + print ("return Dlfcn.GetByte (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_SByte) { + print ("return Dlfcn.GetSByte (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_Int16) { + print ("return Dlfcn.GetInt16 (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_UInt16) { + print ("return Dlfcn.GetUInt16 (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_Int32) { print ("return Dlfcn.GetInt32 (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_UInt32) { @@ -6349,6 +6389,8 @@ public void Generate (Type type) print ("return Dlfcn.GetFloat (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_IntPtr) { print ("return Dlfcn.GetIntPtr (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_UIntPtr) { + print ("return Dlfcn.GetUIntPtr (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType.FullName == "System.Drawing.SizeF") { print ("return Dlfcn.GetSizeF (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_Int64) { @@ -6419,10 +6461,20 @@ public void Generate (Type type) print ("Dlfcn.SetUInt32 (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_Double) { print ("Dlfcn.SetDouble (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_Byte) { + print ("Dlfcn.SetByte (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_SByte) { + print ("Dlfcn.SetSByte (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_Int16) { + print ("Dlfcn.SetInt16 (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_UInt16) { + print ("Dlfcn.SetUInt16 (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_Float) { print ("Dlfcn.SetFloat (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_IntPtr) { print ("Dlfcn.SetIntPtr (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); + } else if (field_pi.PropertyType == TypeCache.System_UIntPtr) { + print ("Dlfcn.SetUIntPtr (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType.FullName == "System.Drawing.SizeF") { print ("Dlfcn.SetSizeF (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_Int64) { @@ -6645,7 +6697,7 @@ public void Generate (Type type) if (isProtocolEventBacked) print ("[Export (\"{0}\")]", FindSelector (dtype, mi)); - print ("public {0}{1} {2} ({3})", shouldOverrideDelegateString, TypeManager.RenderType (mi.ReturnType), mi.Name, RenderParameterDecl (pars)); + print ("public {0}{1} {2} ({3})", shouldOverrideDelegateString, TypeManager.RenderType (mi.ReturnType, mi.ReturnTypeCustomAttributes), mi.Name, RenderParameterDecl (pars)); print ("{"); indent++; if (mi.Name == bta.KeepRefUntil) @@ -7195,7 +7247,7 @@ public void Generate (Type type) foreach (var p in pars.Skip (minPars).OrderBy (p => p.Name, StringComparer.Ordinal)) { var pt = p.ParameterType; var bareType = pt.IsByRef ? pt.GetElementType () : pt; - var nullable = !pt.IsValueType && AttributeManager.HasAttribute (p); + var nullable = !pt.IsValueType && AttributeManager.IsNullable (p); print ("public {0}{1} {2} {{ get; set; }}", TypeManager.RenderType (bareType), nullable ? "?" : "", GetPublicParameterName (p)); } @@ -7451,8 +7503,6 @@ string RenderSingleParameter (ParameterInfo p, bool removeRefTypes) name += (removeRefTypes ? "" : (p.IsOut ? "out " : "ref ")) + TypeManager.RenderType (pt, p); } else name += TypeManager.RenderType (pt, p); - if (!pt.IsValueType && AttributeManager.HasAttribute (p)) - name += "?"; return name; } diff --git a/src/bgen/Models/AsyncMethodInfo.cs b/src/bgen/Models/AsyncMethodInfo.cs index 2d4cfe9901bb..951057afd346 100644 --- a/src/bgen/Models/AsyncMethodInfo.cs +++ b/src/bgen/Models/AsyncMethodInfo.cs @@ -28,7 +28,7 @@ public AsyncMethodInfo (Generator generator, IMemberGatherer gather, Type type, var lastParam = cbParams.LastOrDefault (); if (lastParam is not null && lastParam.ParameterType.Name == "NSError") { HasNSError = true; - IsNSErrorNullable = generator.AttributeManager.HasAttribute (lastParam); + IsNSErrorNullable = generator.AttributeManager.IsNullable (lastParam); cbParams = cbParams.DropLast (); } diff --git a/src/bgen/TypeManager.cs b/src/bgen/TypeManager.cs index d94fdaf8883c..2cdc7a1238d7 100644 --- a/src/bgen/TypeManager.cs +++ b/src/bgen/TypeManager.cs @@ -256,32 +256,36 @@ public string FormatTypeUsedIn (string? usedInNamespace, Type? type) public string? RenderType (Type t, ICustomAttributeProvider? provider = null) { + var nullable = string.Empty; + if (provider is not null && !t.IsValueType && AttributeManager.HasAttribute (provider)) + nullable = "?"; + if (!t.IsEnum) { switch (Type.GetTypeCode (t)) { case TypeCode.Char: - return "char"; + return "char" + nullable; case TypeCode.String: - return "string"; + return "string" + nullable; case TypeCode.Int32: - return "int"; + return "int" + nullable; case TypeCode.UInt32: - return "uint"; + return "uint" + nullable; case TypeCode.Int64: - return "long"; + return "long" + nullable; case TypeCode.UInt64: - return "ulong"; + return "ulong" + nullable; case TypeCode.Single: - return "float"; + return "float" + nullable; case TypeCode.Double: - return "double"; + return "double" + nullable; case TypeCode.Decimal: - return "decimal"; + return "decimal" + nullable; case TypeCode.SByte: - return "sbyte"; + return "sbyte" + nullable; case TypeCode.Byte: - return "byte"; + return "byte" + nullable; case TypeCode.Boolean: - return "bool"; + return "bool" + nullable; } } @@ -289,9 +293,9 @@ public string FormatTypeUsedIn (string? usedInNamespace, Type? type) return "void"; if (t == TypeCache.System_IntPtr) { - return AttributeManager.HasNativeAttribute (provider) ? "nint" : "IntPtr"; + return (AttributeManager.HasNativeAttribute (provider) ? "nint" : "IntPtr") + nullable; } else if (t == TypeCache.System_UIntPtr) { - return AttributeManager.HasNativeAttribute (provider) ? "nuint" : "UIntPtr"; + return (AttributeManager.HasNativeAttribute (provider) ? "nuint" : "UIntPtr") + nullable; } if (t.Namespace is not null) { @@ -299,18 +303,18 @@ public string FormatTypeUsedIn (string? usedInNamespace, Type? type) if (NamespaceCache.ImplicitNamespaces.Contains (ns) || t.IsGenericType) { var targs = t.GetGenericArguments (); if (targs.Length == 0) - return t.Name; - return $"global::{t.Namespace}." + t.Name.RemoveArity () + "<" + string.Join (", ", targs.Select (l => FormatTypeUsedIn (null, l)).ToArray ()) + ">"; + return t.Name + nullable; + return $"global::{t.Namespace}." + t.Name.RemoveArity () + "<" + string.Join (", ", targs.Select (l => FormatTypeUsedIn (null, l)).ToArray ()) + ">" + nullable; } if (NamespaceCache.NamespacesThatConflictWithTypes.Contains (ns)) - return "global::" + t.FullName; + return "global::" + t.FullName + nullable; if (t.Name == t.Namespace) - return "global::" + t.FullName; + return "global::" + t.FullName + nullable; else - return t.FullName; + return t.FullName + nullable; } - return t.FullName; + return t.FullName + nullable; } // TODO: If we ever have an API with nested properties of the same name more than diff --git a/src/corevideo.cs b/src/corevideo.cs index a2d1037fb570..46b5f699b921 100644 --- a/src/corevideo.cs +++ b/src/corevideo.cs @@ -6,6 +6,8 @@ // using System; + +using CoreGraphics; using Foundation; using ObjCRuntime; #if !WATCH @@ -568,4 +570,202 @@ public enum CVVersatileBayerPattern : uint { Gbrg = 2, Bggr = 3, } + + [Partial] + interface CVPixelFormatKeys { + [Field ("kCVPixelFormatName")] + NSString Name { get; } + + [Field ("kCVPixelFormatConstant")] + NSString Constant { get; } + + [Field ("kCVPixelFormatCodecType")] + NSString CodecType { get; } + + [Field ("kCVPixelFormatFourCC")] + NSString FourCC { get; } + + [Field ("kCVPixelFormatContainsAlpha")] + NSString ContainsAlpha { get; } + + [Field ("kCVPixelFormatContainsYCbCr")] + NSString ContainsYCbCr { get; } + + [Field ("kCVPixelFormatContainsRGB")] + NSString ContainsRgb { get; } + + [Field ("kCVPixelFormatContainsGrayscale")] + NSString ContainsGrayscale { get; } + + [iOS (16, 0), Mac (13, 0), MacCatalyst (16, 0), TV (16, 0), Watch (9, 0)] + [Field ("kCVPixelFormatContainsSenselArray")] + NSString ContainsSenselArray { get; } + + [Field ("kCVPixelFormatComponentRange")] + NSString ComponentRange { get; } + + [Field ("kCVPixelFormatPlanes")] + NSString Planes { get; } + + [Field ("kCVPixelFormatBlockWidth")] + NSString BlockWidth { get; } + + [Field ("kCVPixelFormatBlockHeight")] + NSString BlockHeight { get; } + + [Field ("kCVPixelFormatBitsPerBlock")] + NSString BitsPerBlock { get; } + + [Field ("kCVPixelFormatBlockHorizontalAlignment")] + NSString BlockHorizontalAlignment { get; } + + [Field ("kCVPixelFormatBlockVerticalAlignment")] + NSString BlockVerticalAlignment { get; } + + [Field ("kCVPixelFormatBlackBlock")] + NSString BlackBlock { get; } + + [Field ("kCVPixelFormatHorizontalSubsampling")] + NSString HorizontalSubsampling { get; } + + [Field ("kCVPixelFormatVerticalSubsampling")] + NSString VerticalSubsampling { get; } + + [Field ("kCVPixelFormatOpenGLFormat")] + NSString OpenGLFormat { get; } + + [Field ("kCVPixelFormatOpenGLType")] + NSString OpenGLType { get; } + + [Field ("kCVPixelFormatOpenGLInternalFormat")] + NSString OpenGLInternalFormat { get; } + + [Field ("kCVPixelFormatCGBitmapInfo")] + NSString CGBitmapInfo { get; } + + [Field ("kCVPixelFormatQDCompatibility")] + NSString QDCompatibility { get; } + + [Field ("kCVPixelFormatCGBitmapContextCompatibility")] + NSString CGBitmapContextCompatibility { get; } + + [Field ("kCVPixelFormatCGImageCompatibility")] + NSString CGImageCompatibility { get; } + + [Field ("kCVPixelFormatOpenGLCompatibility")] + NSString OpenGLCompatibility { get; } + + [NoWatch, NoMacCatalyst, NoMac] + [Field ("kCVPixelFormatOpenGLESCompatibility")] + NSString OpenGlesCompatibility { get; } + + [Field ("kCVPixelFormatFillExtendedPixelsCallback")] + NSString FillExtendedPixelsCallback { get; } + } + + [Partial] + interface CVPixelFormatComponentRangeKeys { + [Field ("kCVPixelFormatComponentRange_VideoRange")] + NSString VideoRange { get; } + + [Field ("kCVPixelFormatComponentRange_FullRange")] + NSString FullRange { get; } + + [Field ("kCVPixelFormatComponentRange_WideRange")] + NSString WideRange { get; } + } + + + [StrongDictionary ("CVPixelFormatComponentRangeKeys", Suffix = "")] + interface CVPixelFormatComponentRange { + // there's no documentation about the type, so binding as NSObject + NSObject VideoRange { get; set; } + + // there's no documentation about the type, so binding as NSObject + NSObject FullRange { get; set; } + + // there's no documentation about the type, so binding as NSObject + NSObject WideRange { get; set; } + } + + [StrongDictionary ("CVPixelFormatKeys", Suffix = "")] + interface CVPixelFormatDescription { + string Name { get; set; } + + CVPixelFormatType Constant { get; set; } + + // Documentation says 'CFString', but it also says 'CFString' about another property which clearly isn't, so I don't trust the documentation. + // Headers don't say, and tests don't show anything useful, there are no hits on Google for the underlying field, so leaving this typed as 'NSObject'. + NSObject CodecType { get; set; } + + int FourCC { get; set; } + + bool ContainsAlpha { get; set; } + +#if XAMCORE_5_0 + bool ContainsYCbCr { get; set; } +#else + [Export ("ContainsYCbCr")] + bool FormatContainsYCbCr { get; set; } +#endif + +#if XAMCORE_5_0 + bool ContainsRgb { get; set; } +#else + [Export ("ContainsRgb")] + bool FormatContainsRgb { get; set; } +#endif + + bool ContainsGrayscale { get; set; } + + [iOS (16, 0), Mac (13, 0), MacCatalyst (16, 0), TV (16, 0), Watch (9, 0)] +#if XAMCORE_5_0 + bool ContainsSenselArray { get; set; } +#else + [Export ("ContainsSenselArray")] + bool FormatContainsSenselArray { get; set; } +#endif + + CVPixelFormatComponentRange ComponentRange { get; set; } + + // This can be an array of dictionaries, or a single dictionary when there's only one plane, so we have to type as 'NSObject'. + NSObject Planes { get; set; } + + int BlockWidth { get; set; } + + int BlockHeight { get; set; } + + int BitsPerBlock { get; set; } + + int BlockHorizontalAlignment { get; set; } + + int BlockVerticalAlignment { get; set; } + + NSData BlackBlock { get; set; } + + int HorizontalSubsampling { get; set; } + + int VerticalSubsampling { get; set; } + + int OpenGLFormat { get; set; } + + int OpenGLType { get; set; } + + int OpenGLInternalFormat { get; set; } + + CGBitmapFlags CGBitmapInfo { get; set; } + + bool QDCompatibility { get; set; } + + bool CGBitmapContextCompatibility { get; set; } + + bool CGImageCompatibility { get; set; } + + bool OpenGLCompatibility { get; set; } + + [NoWatch, NoMacCatalyst, NoMac] + bool OpenGlesCompatibility { get; set; } + + NSData FillExtendedPixelsCallback { get; set; } + } } diff --git a/system-dependencies.sh b/system-dependencies.sh index 849747b2feac..4ee34b866112 100755 --- a/system-dependencies.sh +++ b/system-dependencies.sh @@ -54,8 +54,7 @@ while ! test -z $1; do shift ;; --provision-autotools) - PROVISION_AUTOTOOLS=1 - unset IGNORE_AUTOTOOLS + # this is an old argument, just ignore it shift ;; --provision-python3) @@ -108,8 +107,6 @@ while ! test -z $1; do unset IGNORE_CMAKE PROVISION_7Z=1 unset IGNORE_7Z - PROVISION_AUTOTOOLS=1 - unset IGNORE_AUTOTOOLS PROVISION_HOMEBREW=1 unset IGNORE_HOMEBREW PROVISION_SHARPIE=1 @@ -135,7 +132,6 @@ while ! test -z $1; do IGNORE_XCODE=1 IGNORE_CMAKE=1 IGNORE_7Z=1 - IGNORE_AUTOTOOLS=1 IGNORE_HOMEBREW=1 IGNORE_SHARPIE=1 IGNORE_SIMULATORS=1 @@ -162,7 +158,7 @@ while ! test -z $1; do shift ;; --ignore-autotools) - IGNORE_AUTOTOOLS=1 + # this is an old argument, just ignore it shift ;; --ignore-python3) @@ -687,15 +683,6 @@ function check_mono () { ok "Found Mono $ACTUAL_MONO_VERSION (at least $MIN_MONO_VERSION and not more than $MAX_MONO_VERSION is required)" } -function install_autoconf () { - if ! brew --version >& /dev/null; then - fail "Asked to install autoconf, but brew is not installed." - return - fi - - brew install autoconf -} - function install_shellcheck () { if ! brew --version >& /dev/null; then fail "Asked to install shellcheck, but brew is not installed." @@ -726,61 +713,6 @@ function install_python3 () { brew install python3 } -function install_libtool () { - if ! brew --version >& /dev/null; then - fail "Asked to install libtool, but brew is not installed." - return - fi - - brew install libtool -} - -function install_automake () { - if ! brew --version >& /dev/null; then - fail "Asked to install automake, but brew is not installed." - return - fi - - brew install automake -} - - -function check_autotools () { - if ! test -z $IGNORE_AUTOTOOLS; then return; fi - -IFStmp=$IFS -IFS=' -' - if AUTOCONF_VERSION=($(autoconf --version 2>/dev/null)); then - ok "Found ${AUTOCONF_VERSION[0]} (no specific version is required)" - elif ! test -z $PROVISION_AUTOTOOLS; then - install_autoconf - else - fail "You must install autoconf, read the README.md for instructions" - fi - - if ! LIBTOOL=$(which glibtool 2>/dev/null); then - LIBTOOL=$(which libtool) - fi - - if LIBTOOL_VERSION=($($LIBTOOL --version 2>/dev/null )); then - ok "Found ${LIBTOOL_VERSION[0]} (no specific version is required)" - elif ! test -z $PROVISION_AUTOTOOLS; then - install_libtool - else - fail "You must install libtool, read the README.md for instructions" - fi - - if AUTOMAKE_VERSION=($(automake --version 2>/dev/null)); then - ok "Found ${AUTOMAKE_VERSION[0]} (no specific version is required)" - elif ! test -z $PROVISION_AUTOTOOLS; then - install_automake - else - fail "You must install automake, read the README.md for instructions" - fi -IFS=$IFS_tmp -} - function check_shellcheck () { if ! test -z $IGNORE_SHELLCHECK; then return; fi @@ -931,7 +863,7 @@ IFS=' HOMEBREW_VERSION=($(brew --version 2>/dev/null)) log "Installed Homebrew ($HOMEBREW_VERSION)" else - warn "Could not find Homebrew. Homebrew is required to auto-provision some dependencies (autotools, cmake), but not required otherwise." + warn "Could not find Homebrew. Homebrew is required to auto-provision some dependencies (cmake), but not required otherwise." fi IFS=$IFS_tmp } @@ -1078,7 +1010,6 @@ check_osx_version check_checkout_dir check_xcode check_homebrew -check_autotools check_shellcheck check_yamllint check_python3 diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 7f9c0e6b7599..bb122cdc876a 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -8396,6 +8396,9 @@ F:CoreVideo.CVAttachmentMode.ShouldPropagate F:CoreVideo.CVFillExtendedPixelsCallBackData.FillCallBack F:CoreVideo.CVFillExtendedPixelsCallBackData.UserInfo F:CoreVideo.CVFillExtendedPixelsCallBackData.Version +F:CoreVideo.CVFillExtendedPixelsCallBackDataStruct.FillCallBack +F:CoreVideo.CVFillExtendedPixelsCallBackDataStruct.UserInfo +F:CoreVideo.CVFillExtendedPixelsCallBackDataStruct.Version F:CoreVideo.CVImageBufferAlphaChannelMode.Premultiplied F:CoreVideo.CVImageBufferAlphaChannelMode.Straight F:CoreVideo.CVImageBufferColorPrimaries.DciP3 @@ -8427,36 +8430,6 @@ F:CoreVideo.CVOptionFlags.None F:CoreVideo.CVPixelBufferLock.None F:CoreVideo.CVPixelBufferLock.ReadOnly F:CoreVideo.CVPixelBufferPoolFlushFlags.FlushExcessBuffers -F:CoreVideo.CVPixelFormatDescription.BitsPerBlockKey -F:CoreVideo.CVPixelFormatDescription.BlackBlockKey -F:CoreVideo.CVPixelFormatDescription.BlockHeightKey -F:CoreVideo.CVPixelFormatDescription.BlockHorizontalAlignmentKey -F:CoreVideo.CVPixelFormatDescription.BlockVerticalAlignmentKey -F:CoreVideo.CVPixelFormatDescription.BlockWidthKey -F:CoreVideo.CVPixelFormatDescription.CGBitmapContextCompatibilityKey -F:CoreVideo.CVPixelFormatDescription.CGBitmapInfoKey -F:CoreVideo.CVPixelFormatDescription.CGImageCompatibilityKey -F:CoreVideo.CVPixelFormatDescription.CodecTypeKey -F:CoreVideo.CVPixelFormatDescription.ComponentRangeFullRangeKey -F:CoreVideo.CVPixelFormatDescription.ComponentRangeKey -F:CoreVideo.CVPixelFormatDescription.ComponentRangeVideoRangeKey -F:CoreVideo.CVPixelFormatDescription.ComponentRangeWideRangeKey -F:CoreVideo.CVPixelFormatDescription.ConstantKey -F:CoreVideo.CVPixelFormatDescription.ContainsGrayscaleKey -F:CoreVideo.CVPixelFormatDescription.ContainsRgb -F:CoreVideo.CVPixelFormatDescription.ContainsSenselArray -F:CoreVideo.CVPixelFormatDescription.ContainsYCbCr -F:CoreVideo.CVPixelFormatDescription.FillExtendedPixelsCallbackKey -F:CoreVideo.CVPixelFormatDescription.FourCCKey -F:CoreVideo.CVPixelFormatDescription.HorizontalSubsamplingKey -F:CoreVideo.CVPixelFormatDescription.NameKey -F:CoreVideo.CVPixelFormatDescription.OpenGLCompatibilityKey -F:CoreVideo.CVPixelFormatDescription.OpenGLFormatKey -F:CoreVideo.CVPixelFormatDescription.OpenGLInternalFormatKey -F:CoreVideo.CVPixelFormatDescription.OpenGLTypeKey -F:CoreVideo.CVPixelFormatDescription.PlanesKey -F:CoreVideo.CVPixelFormatDescription.QDCompatibilityKey -F:CoreVideo.CVPixelFormatDescription.VerticalSubsamplingKey F:CoreVideo.CVPixelFormatType.Argb2101010LEPacked F:CoreVideo.CVPixelFormatType.CV128RGBAFloat F:CoreVideo.CVPixelFormatType.CV14BayerBggr @@ -27594,7 +27567,6 @@ M:BackgroundTasks.BGTaskScheduler.GetPending(System.Action{BackgroundTasks.BGTas M:BackgroundTasks.BGTaskScheduler.GetPendingAsync M:BackgroundTasks.BGTaskScheduler.Register(System.String,CoreFoundation.DispatchQueue,System.Action{BackgroundTasks.BGTask}) M:BackgroundTasks.BGTaskScheduler.Submit(BackgroundTasks.BGTaskRequest,Foundation.NSError@) -M:BusinessChat.BCChatAction.OpenTranscript(System.String,Foundation.NSDictionary{Foundation.NSString,Foundation.NSString}) M:BusinessChat.BCChatAction.OpenTranscript(System.String,System.Collections.Generic.Dictionary{BusinessChat.BCParameterName,System.String}) M:BusinessChat.BCChatButton.#ctor(BusinessChat.BCChatButtonStyle) M:BusinessChat.BCChatButton.BCChatButtonAppearance.#ctor(System.IntPtr) @@ -28452,7 +28424,6 @@ M:Contacts.CNSocialProfile.Copy(Foundation.NSZone) M:Contacts.CNSocialProfile.EncodeTo(Foundation.NSCoder) M:Contacts.CNSocialProfile.LocalizeProperty(Contacts.CNPostalAddressKeyOption) M:Contacts.CNSocialProfile.LocalizeProperty(Contacts.CNSocialProfileOption) -M:Contacts.CNSocialProfile.LocalizeProperty(Foundation.NSString) M:Contacts.CNSocialProfile.LocalizeService(Contacts.CNSocialProfileServiceOption) M:Contacts.CNSocialProfile.LocalizeService(Foundation.NSString) M:Contacts.ICNChangeHistoryEventVisitor.AddContact(Contacts.CNChangeHistoryAddContactEvent) @@ -28740,10 +28711,8 @@ M:CoreBluetooth.CBCentralManager.add_WillRestoreState(System.EventHandler{CoreBl M:CoreBluetooth.CBCentralManager.CancelPeripheralConnection(CoreBluetooth.CBPeripheral) M:CoreBluetooth.CBCentralManager.ConnectPeripheral(CoreBluetooth.CBPeripheral,CoreBluetooth.CBConnectPeripheralOptions) M:CoreBluetooth.CBCentralManager.ConnectPeripheral(CoreBluetooth.CBPeripheral,CoreBluetooth.PeripheralConnectionOptions) -M:CoreBluetooth.CBCentralManager.ConnectPeripheral(CoreBluetooth.CBPeripheral,Foundation.NSDictionary) M:CoreBluetooth.CBCentralManager.Dispose(System.Boolean) M:CoreBluetooth.CBCentralManager.RegisterForConnectionEvents(CoreBluetooth.CBConnectionEventMatchingOptions) -M:CoreBluetooth.CBCentralManager.RegisterForConnectionEvents(Foundation.NSDictionary) M:CoreBluetooth.CBCentralManager.remove_ConnectedPeripheral(System.EventHandler{CoreBluetooth.CBPeripheralEventArgs}) M:CoreBluetooth.CBCentralManager.remove_ConnectionEventDidOccur(System.EventHandler{CoreBluetooth.CBPeripheralConnectionEventEventArgs}) M:CoreBluetooth.CBCentralManager.remove_DidDisconnectPeripheral(System.EventHandler{CoreBluetooth.CBPeripheralDiconnectionEventEventArgs}) @@ -31166,10 +31135,8 @@ M:CoreImage.CIImage.#ctor(AVFoundation.AVPortraitEffectsMatte) M:CoreImage.CIImage.#ctor(AVFoundation.AVSemanticSegmentationMatte,Foundation.NSDictionary) M:CoreImage.CIImage.#ctor(AVFoundation.AVSemanticSegmentationMatte) M:CoreImage.CIImage.#ctor(CoreGraphics.CGImage,CoreImage.CIImageInitializationOptionsWithMetadata) -M:CoreImage.CIImage.#ctor(CoreGraphics.CGImage,Foundation.NSDictionary) M:CoreImage.CIImage.#ctor(CoreGraphics.CGImage) M:CoreImage.CIImage.#ctor(CoreGraphics.CGLayer,CoreImage.CIImageInitializationOptions) -M:CoreImage.CIImage.#ctor(CoreGraphics.CGLayer,Foundation.NSDictionary) M:CoreImage.CIImage.#ctor(CoreGraphics.CGLayer) M:CoreImage.CIImage.#ctor(CoreImage.CIColor) M:CoreImage.CIImage.#ctor(CoreImage.ICIImageProvider,System.UIntPtr,System.UIntPtr,CoreImage.CIFormat,CoreGraphics.CGColorSpace,CoreImage.CIImageProviderOptions) @@ -31187,7 +31154,6 @@ M:CoreImage.CIImage.#ctor(Foundation.NSUrl,CoreImage.CIImageInitializationOption M:CoreImage.CIImage.#ctor(Foundation.NSUrl,Foundation.NSDictionary) M:CoreImage.CIImage.#ctor(Foundation.NSUrl) M:CoreImage.CIImage.#ctor(ImageIO.CGImageSource,System.UIntPtr,CoreImage.CIImageInitializationOptionsWithMetadata) -M:CoreImage.CIImage.#ctor(ImageIO.CGImageSource,System.UIntPtr,Foundation.NSDictionary) M:CoreImage.CIImage.#ctor(IOSurface.IOSurface,CoreImage.CIImageInitializationOptions) M:CoreImage.CIImage.#ctor(IOSurface.IOSurface,Foundation.NSDictionary) M:CoreImage.CIImage.#ctor(IOSurface.IOSurface) @@ -31222,21 +31188,16 @@ M:CoreImage.CIImage.Draw(CoreGraphics.CGRect,CoreGraphics.CGRect,AppKit.NSCompos M:CoreImage.CIImage.EncodeTo(Foundation.NSCoder) M:CoreImage.CIImage.FromCGImage(CoreGraphics.CGImage,CoreGraphics.CGColorSpace) M:CoreImage.CIImage.FromCGImage(CoreGraphics.CGImage,CoreImage.CIImageInitializationOptionsWithMetadata) -M:CoreImage.CIImage.FromCGImage(CoreGraphics.CGImage,Foundation.NSDictionary) M:CoreImage.CIImage.FromCGImage(CoreGraphics.CGImage) M:CoreImage.CIImage.FromCGImageSource(ImageIO.CGImageSource,System.UIntPtr,CoreImage.CIImageInitializationOptionsWithMetadata) -M:CoreImage.CIImage.FromCGImageSource(ImageIO.CGImageSource,System.UIntPtr,Foundation.NSDictionary) M:CoreImage.CIImage.FromData(Foundation.NSData,CoreImage.CIImageInitializationOptionsWithMetadata) -M:CoreImage.CIImage.FromData(Foundation.NSData,Foundation.NSDictionary) M:CoreImage.CIImage.FromData(Foundation.NSData,System.IntPtr,CoreGraphics.CGSize,CoreImage.CIFormat,CoreGraphics.CGColorSpace) M:CoreImage.CIImage.FromData(Foundation.NSData) M:CoreImage.CIImage.FromDepthData(AVFoundation.AVDepthData,Foundation.NSDictionary) M:CoreImage.CIImage.FromDepthData(AVFoundation.AVDepthData) M:CoreImage.CIImage.FromImageBuffer(CoreVideo.CVImageBuffer,CoreImage.CIImageInitializationOptions) -M:CoreImage.CIImage.FromImageBuffer(CoreVideo.CVImageBuffer,Foundation.NSDictionary{Foundation.NSString,Foundation.NSObject}) M:CoreImage.CIImage.FromImageBuffer(CoreVideo.CVImageBuffer) M:CoreImage.CIImage.FromImageBuffer(CoreVideo.CVPixelBuffer,CoreImage.CIImageInitializationOptions) -M:CoreImage.CIImage.FromImageBuffer(CoreVideo.CVPixelBuffer,Foundation.NSDictionary) M:CoreImage.CIImage.FromImageBuffer(CoreVideo.CVPixelBuffer) M:CoreImage.CIImage.FromLayer(CoreGraphics.CGLayer,Foundation.NSDictionary) M:CoreImage.CIImage.FromLayer(CoreGraphics.CGLayer) @@ -31247,10 +31208,8 @@ M:CoreImage.CIImage.FromProvider(CoreImage.ICIImageProvider,System.UIntPtr,Syste M:CoreImage.CIImage.FromSemanticSegmentationMatte(AVFoundation.AVSemanticSegmentationMatte,Foundation.NSDictionary) M:CoreImage.CIImage.FromSemanticSegmentationMatte(AVFoundation.AVSemanticSegmentationMatte) M:CoreImage.CIImage.FromSurface(IOSurface.IOSurface,CoreImage.CIImageInitializationOptions) -M:CoreImage.CIImage.FromSurface(IOSurface.IOSurface,Foundation.NSDictionary) M:CoreImage.CIImage.FromSurface(IOSurface.IOSurface) M:CoreImage.CIImage.FromUrl(Foundation.NSUrl,CoreImage.CIImageInitializationOptions) -M:CoreImage.CIImage.FromUrl(Foundation.NSUrl,Foundation.NSDictionary) M:CoreImage.CIImage.FromUrl(Foundation.NSUrl) M:CoreImage.CIImage.GetAutoAdjustmentFilters M:CoreImage.CIImage.GetAutoAdjustmentFilters(CoreImage.CIAutoAdjustmentFilterOptions) @@ -32812,7 +32771,6 @@ M:CoreSpotlight.CSSearchableIndex_CSOptionalBatchingExtension.EndIndexBatch(Core M:CoreSpotlight.CSSearchableIndex_CSOptionalBatchingExtension.FetchLastClientState(CoreSpotlight.CSSearchableIndex,CoreSpotlight.CSSearchableIndexFetchHandler) M:CoreSpotlight.CSSearchableIndex.#ctor(System.String,CoreSpotlight.CSFileProtection) M:CoreSpotlight.CSSearchableIndex.#ctor(System.String,Foundation.NSFileProtectionType,System.String,System.IntPtr) -M:CoreSpotlight.CSSearchableIndex.#ctor(System.String,Foundation.NSString,System.String,System.IntPtr) M:CoreSpotlight.CSSearchableIndex.#ctor(System.String,Foundation.NSString) M:CoreSpotlight.CSSearchableIndex.#ctor(System.String) M:CoreSpotlight.CSSearchableIndex.Delete(System.String[],System.Action{Foundation.NSError}) @@ -33176,6 +33134,7 @@ M:CoreVideo.CVDisplayLink.SetOutputCallback(CoreVideo.CVDisplayLink.DisplayLinkO M:CoreVideo.CVDisplayLink.Start M:CoreVideo.CVDisplayLink.Stop M:CoreVideo.CVDisplayLink.TryTranslateTime(CoreVideo.CVTimeStamp,CoreVideo.CVTimeStamp@) +M:CoreVideo.CVFillExtendedPixelsCallBackDataStruct.CallFillCallback(CoreVideo.CVPixelBuffer) M:CoreVideo.CVImageBuffer.CreateFrom(Foundation.NSDictionary) M:CoreVideo.CVImageBuffer.GetCodePoint(CoreVideo.CVImageBufferColorPrimaries) M:CoreVideo.CVImageBuffer.GetCodePoint(CoreVideo.CVImageBufferTransferFunction) @@ -33227,8 +33186,12 @@ M:CoreVideo.CVPixelBufferPoolAllocationSettings.#ctor M:CoreVideo.CVPixelBufferPoolAllocationSettings.#ctor(Foundation.NSDictionary) M:CoreVideo.CVPixelBufferPoolSettings.#ctor M:CoreVideo.CVPixelBufferPoolSettings.#ctor(Foundation.NSDictionary) -M:CoreVideo.CVPixelFormatDescription.Create(CoreVideo.CVPixelFormatType) -M:CoreVideo.CVPixelFormatDescription.Register(Foundation.NSDictionary,CoreVideo.CVPixelFormatType) +M:CoreVideo.CVPixelFormatComponentRange.#ctor +M:CoreVideo.CVPixelFormatComponentRange.#ctor(Foundation.NSDictionary) +M:CoreVideo.CVPixelFormatComponentRangeKeys.#ctor +M:CoreVideo.CVPixelFormatDescription.#ctor +M:CoreVideo.CVPixelFormatDescription.#ctor(Foundation.NSDictionary) +M:CoreVideo.CVPixelFormatKeys.#ctor M:CoreVideo.CVPixelFormatTypeExtensions.IsCompressedPixelFormatAvailable(CoreVideo.CVPixelFormatType) M:CoreVideo.CVTime.Equals(System.Object) M:CoreVideo.CVTime.GetCurrentHostTime @@ -33909,18 +33872,9 @@ M:Foundation.INSNetServiceDelegate.Stopped(Foundation.NSNetService) M:Foundation.INSNetServiceDelegate.UpdatedTxtRecordData(Foundation.NSNetService,Foundation.NSData) M:Foundation.INSNetServiceDelegate.WillPublish(Foundation.NSNetService) M:Foundation.INSNetServiceDelegate.WillResolve(Foundation.NSNetService) -M:Foundation.INSObjectProtocol.ConformsToProtocol(ObjCRuntime.NativeHandle) -M:Foundation.INSObjectProtocol.DangerousAutorelease -M:Foundation.INSObjectProtocol.DangerousRelease -M:Foundation.INSObjectProtocol.DangerousRetain -M:Foundation.INSObjectProtocol.GetNativeHash -M:Foundation.INSObjectProtocol.IsEqual(Foundation.NSObject) -M:Foundation.INSObjectProtocol.IsKindOfClass(ObjCRuntime.Class) -M:Foundation.INSObjectProtocol.IsMemberOfClass(ObjCRuntime.Class) M:Foundation.INSObjectProtocol.PerformSelector(ObjCRuntime.Selector,Foundation.NSObject,Foundation.NSObject) M:Foundation.INSObjectProtocol.PerformSelector(ObjCRuntime.Selector,Foundation.NSObject) M:Foundation.INSObjectProtocol.PerformSelector(ObjCRuntime.Selector) -M:Foundation.INSObjectProtocol.RespondsToSelector(ObjCRuntime.Selector) M:Foundation.INSPortDelegate.MessageReceived(Foundation.NSPortMessage) M:Foundation.INSStreamDelegate.HandleEvent(Foundation.NSStream,Foundation.NSStreamEvent) M:Foundation.INSUrlAuthenticationChallengeSender.CancelAuthenticationChallenge(Foundation.NSUrlAuthenticationChallenge) @@ -34125,21 +34079,13 @@ M:Foundation.NSAttributedString.LoadData(System.String,System.Action{Foundation. M:Foundation.NSAttributedString.LoadDataAsync(System.String,Foundation.NSProgress@) M:Foundation.NSAttributedString.LoadDataAsync(System.String) M:Foundation.NSAttributedString.LoadFromHtml(Foundation.NSData,Foundation.NSAttributedStringDocumentAttributes,Foundation.NSAttributedStringCompletionHandler) -M:Foundation.NSAttributedString.LoadFromHtml(Foundation.NSData,Foundation.NSDictionary,Foundation.NSAttributedStringCompletionHandler) M:Foundation.NSAttributedString.LoadFromHtml(Foundation.NSUrl,Foundation.NSAttributedStringDocumentAttributes,Foundation.NSAttributedStringCompletionHandler) -M:Foundation.NSAttributedString.LoadFromHtml(Foundation.NSUrl,Foundation.NSDictionary,Foundation.NSAttributedStringCompletionHandler) M:Foundation.NSAttributedString.LoadFromHtml(Foundation.NSUrlRequest,Foundation.NSAttributedStringDocumentAttributes,Foundation.NSAttributedStringCompletionHandler) -M:Foundation.NSAttributedString.LoadFromHtml(Foundation.NSUrlRequest,Foundation.NSDictionary,Foundation.NSAttributedStringCompletionHandler) M:Foundation.NSAttributedString.LoadFromHtml(System.String,Foundation.NSAttributedStringDocumentAttributes,Foundation.NSAttributedStringCompletionHandler) -M:Foundation.NSAttributedString.LoadFromHtml(System.String,Foundation.NSDictionary,Foundation.NSAttributedStringCompletionHandler) M:Foundation.NSAttributedString.LoadFromHtmlAsync(Foundation.NSData,Foundation.NSAttributedStringDocumentAttributes) -M:Foundation.NSAttributedString.LoadFromHtmlAsync(Foundation.NSData,Foundation.NSDictionary) M:Foundation.NSAttributedString.LoadFromHtmlAsync(Foundation.NSUrl,Foundation.NSAttributedStringDocumentAttributes) -M:Foundation.NSAttributedString.LoadFromHtmlAsync(Foundation.NSUrl,Foundation.NSDictionary) M:Foundation.NSAttributedString.LoadFromHtmlAsync(Foundation.NSUrlRequest,Foundation.NSAttributedStringDocumentAttributes) -M:Foundation.NSAttributedString.LoadFromHtmlAsync(Foundation.NSUrlRequest,Foundation.NSDictionary) M:Foundation.NSAttributedString.LoadFromHtmlAsync(System.String,Foundation.NSAttributedStringDocumentAttributes) -M:Foundation.NSAttributedString.LoadFromHtmlAsync(System.String,Foundation.NSDictionary) M:Foundation.NSAttributedString.LowLevelGetAttributes(System.IntPtr,Foundation.NSRange@) M:Foundation.NSAttributedString.MutableCopy(Foundation.NSZone) M:Foundation.NSAttributedString.Substring(System.IntPtr,System.IntPtr) @@ -34569,9 +34515,7 @@ M:Foundation.NSKeyedUnarchiverDelegate.ReplacingObject(Foundation.NSKeyedUnarchi M:Foundation.NSKeyValueSorting_NSMutableOrderedSet.SortUsingDescriptors(Foundation.NSMutableOrderedSet,Foundation.NSSortDescriptor[]) M:Foundation.NSKeyValueSorting_NSOrderedSet.GetSortedArray(Foundation.NSOrderedSet,Foundation.NSSortDescriptor[]) M:Foundation.NSLinguisticAnalysis.EnumerateLinguisticTags(Foundation.NSString,Foundation.NSRange,Foundation.NSLinguisticTagScheme,Foundation.NSLinguisticTaggerOptions,Foundation.NSOrthography,Foundation.NSEnumerateLinguisticTagsEnumerator) -M:Foundation.NSLinguisticAnalysis.EnumerateLinguisticTags(Foundation.NSString,Foundation.NSRange,Foundation.NSString,Foundation.NSLinguisticTaggerOptions,Foundation.NSOrthography,Foundation.NSEnumerateLinguisticTagsEnumerator) M:Foundation.NSLinguisticAnalysis.GetLinguisticTags(Foundation.NSString,Foundation.NSRange,Foundation.NSLinguisticTagScheme,Foundation.NSLinguisticTaggerOptions,Foundation.NSOrthography,Foundation.NSValue[]@) -M:Foundation.NSLinguisticAnalysis.GetLinguisticTags(Foundation.NSString,Foundation.NSRange,Foundation.NSString,Foundation.NSLinguisticTaggerOptions,Foundation.NSOrthography,Foundation.NSValue[]@) M:Foundation.NSLoadFromHtmlResult.#ctor(Foundation.NSAttributedString,Foundation.NSDictionary{Foundation.NSString,Foundation.NSObject}) M:Foundation.NSLocale.Copy(Foundation.NSZone) M:Foundation.NSLocale.EncodeTo(Foundation.NSCoder) @@ -34869,15 +34813,11 @@ M:Foundation.NSObject.GetBindingValueClass(Foundation.NSString) M:Foundation.NSObject.GetDefaultPlaceholder(Foundation.NSObject,Foundation.NSString) M:Foundation.NSObject.GetHashCode M:Foundation.NSObject.GetMethodForSelector(ObjCRuntime.Selector) -M:Foundation.NSObject.GetNativeHash M:Foundation.NSObject.Invoke(System.Action,System.Double) M:Foundation.NSObject.Invoke(System.Action,System.TimeSpan) M:Foundation.NSObject.InvokeInBackground(System.Action) M:Foundation.NSObject.InvokeOnMainThread(ObjCRuntime.Selector,Foundation.NSObject) M:Foundation.NSObject.InvokeOnMainThread(System.Action) -M:Foundation.NSObject.IsEqual(Foundation.NSObject) -M:Foundation.NSObject.IsKindOfClass(ObjCRuntime.Class) -M:Foundation.NSObject.IsMemberOfClass(ObjCRuntime.Class) M:Foundation.NSObject.MutableCopy M:Foundation.NSObject.ObjectDidEndEditing(Foundation.NSObject) M:Foundation.NSObject.PerformSelector(ObjCRuntime.Selector,Foundation.NSObject,Foundation.NSObject) @@ -34886,7 +34826,6 @@ M:Foundation.NSObject.PerformSelector(ObjCRuntime.Selector) M:Foundation.NSObject.PrepareForInterfaceBuilder M:Foundation.NSObject.RemoveObserver(Foundation.NSObject,System.String,System.IntPtr) M:Foundation.NSObject.RemoveObserver(Foundation.NSObject,System.String) -M:Foundation.NSObject.RespondsToSelector(ObjCRuntime.Selector) M:Foundation.NSObject.SetDefaultPlaceholder(Foundation.NSObject,Foundation.NSObject,Foundation.NSString) M:Foundation.NSObject.SetValueForKeyPath(ObjCRuntime.NativeHandle,Foundation.NSString) M:Foundation.NSObject.ToString @@ -36685,7 +36624,6 @@ M:HomeKit.HMMutableCharacteristicEvent.MutableCopy(Foundation.NSZone) M:HomeKit.HMMutableCharacteristicThresholdRangeEvent.#ctor(HomeKit.HMCharacteristic,HomeKit.HMNumberRange) M:HomeKit.HMMutableDurationEvent.#ctor(System.Double) M:HomeKit.HMMutableLocationEvent.#ctor(CoreLocation.CLRegion) -M:HomeKit.HMMutableSignificantTimeEvent.#ctor(Foundation.NSString,Foundation.NSDateComponents) M:HomeKit.HMMutableSignificantTimeEvent.#ctor(HomeKit.HMSignificantEvent,Foundation.NSDateComponents) M:HomeKit.HMNetworkConfigurationProfile.Dispose(System.Boolean) M:HomeKit.HMNetworkConfigurationProfileDelegate_Extensions.DidUpdateNetworkAccessMode(HomeKit.IHMNetworkConfigurationProfileDelegate,HomeKit.HMNetworkConfigurationProfile) @@ -36696,7 +36634,6 @@ M:HomeKit.HMRoom.UpdateNameAsync(System.String) M:HomeKit.HMService.Dispose(System.Boolean) M:HomeKit.HMService.UpdateAssociatedServiceType(HomeKit.HMServiceType,System.Action{Foundation.NSError}) M:HomeKit.HMService.UpdateAssociatedServiceTypeAsync(HomeKit.HMServiceType) -M:HomeKit.HMService.UpdateAssociatedServiceTypeAsync(System.String) M:HomeKit.HMService.UpdateNameAsync(System.String) M:HomeKit.HMServiceGroup.AddServiceAsync(HomeKit.HMService) M:HomeKit.HMServiceGroup.RemoveServiceAsync(HomeKit.HMService) @@ -41735,7 +41672,6 @@ M:ModelIO.MDLAsset.FromScene(SceneKit.SCNScene,ModelIO.IMDLMeshBufferAllocator) M:ModelIO.MDLAsset.FromScene(SceneKit.SCNScene) M:ModelIO.MDLAsset.GetBoundingBox(System.Double) M:ModelIO.MDLAsset.GetChildObjects(ObjCRuntime.Class) -M:ModelIO.MDLAsset.GetComponent(ObjCRuntime.Protocol) M:ModelIO.MDLAsset.GetComponent(System.Type) M:ModelIO.MDLAsset.GetObject(System.String) M:ModelIO.MDLAsset.GetObject(System.UIntPtr) @@ -41743,7 +41679,6 @@ M:ModelIO.MDLAsset.GetObjectAtIndexedSubscript(System.UIntPtr) M:ModelIO.MDLAsset.LoadTextures M:ModelIO.MDLAsset.PlaceLightProbes(System.Single,ModelIO.MDLProbePlacement,ModelIO.IMDLLightProbeIrradianceDataSource) M:ModelIO.MDLAsset.RemoveObject(ModelIO.MDLObject) -M:ModelIO.MDLAsset.SetComponent(ModelIO.IMDLComponent,ObjCRuntime.Protocol) M:ModelIO.MDLAsset.SetComponent(ModelIO.IMDLComponent,System.Type) M:ModelIO.MDLAxisAlignedBoundingBox.#ctor(System.Numerics.Vector3,System.Numerics.Vector3) M:ModelIO.MDLBundleAssetResolver.#ctor(System.String) @@ -41873,7 +41808,6 @@ M:ModelIO.MDLObject.EnumerateChildObjects(ObjCRuntime.Class,ModelIO.MDLObject,Mo M:ModelIO.MDLObject.FromNode(SceneKit.SCNNode,ModelIO.IMDLMeshBufferAllocator) M:ModelIO.MDLObject.FromNode(SceneKit.SCNNode) M:ModelIO.MDLObject.GetBoundingBox(System.Double) -M:ModelIO.MDLObject.GetComponent(ObjCRuntime.Protocol) M:ModelIO.MDLObject.GetComponent(System.Type) M:ModelIO.MDLObject.GetObject(System.String) M:ModelIO.MDLObject.SetComponent(ModelIO.IMDLComponent,ObjCRuntime.Protocol) @@ -42113,9 +42047,7 @@ M:NaturalLanguage.NLEmbedding.EnumerateNeighbors(System.Single[],System.UIntPtr, M:NaturalLanguage.NLEmbedding.EnumerateNeighbors(System.Single[],System.UIntPtr,System.Double,NaturalLanguage.NLDistanceType,NaturalLanguage.NLEnumerateNeighborsHandler) M:NaturalLanguage.NLEmbedding.EnumerateNeighbors(System.String,System.UIntPtr,NaturalLanguage.NLDistanceType,NaturalLanguage.NLEnumerateNeighborsHandler) M:NaturalLanguage.NLEmbedding.EnumerateNeighbors(System.String,System.UIntPtr,System.Double,NaturalLanguage.NLDistanceType,NaturalLanguage.NLEnumerateNeighborsHandler) -M:NaturalLanguage.NLEmbedding.GetCurrentRevision(Foundation.NSString) M:NaturalLanguage.NLEmbedding.GetCurrentRevision(NaturalLanguage.NLLanguage) -M:NaturalLanguage.NLEmbedding.GetCurrentSentenceEmbeddingRevision(Foundation.NSString) M:NaturalLanguage.NLEmbedding.GetCurrentSentenceEmbeddingRevision(NaturalLanguage.NLLanguage) M:NaturalLanguage.NLEmbedding.GetDistance(System.String,System.String,NaturalLanguage.NLDistanceType) M:NaturalLanguage.NLEmbedding.GetEmbedding(Foundation.NSUrl,Foundation.NSError@) @@ -42123,40 +42055,28 @@ M:NaturalLanguage.NLEmbedding.GetNeighbors(System.Single[],System.UIntPtr,Natura M:NaturalLanguage.NLEmbedding.GetNeighbors(System.Single[],System.UIntPtr,System.Double,NaturalLanguage.NLDistanceType) M:NaturalLanguage.NLEmbedding.GetNeighbors(System.String,System.UIntPtr,NaturalLanguage.NLDistanceType) M:NaturalLanguage.NLEmbedding.GetNeighbors(System.String,System.UIntPtr,System.Double,NaturalLanguage.NLDistanceType) -M:NaturalLanguage.NLEmbedding.GetSentenceEmbedding(Foundation.NSString,System.UIntPtr) -M:NaturalLanguage.NLEmbedding.GetSentenceEmbedding(Foundation.NSString) M:NaturalLanguage.NLEmbedding.GetSentenceEmbedding(NaturalLanguage.NLLanguage,System.UIntPtr) M:NaturalLanguage.NLEmbedding.GetSentenceEmbedding(NaturalLanguage.NLLanguage) -M:NaturalLanguage.NLEmbedding.GetSupportedRevisions(Foundation.NSString) M:NaturalLanguage.NLEmbedding.GetSupportedRevisions(NaturalLanguage.NLLanguage) -M:NaturalLanguage.NLEmbedding.GetSupportedSentenceEmbeddingRevisions(Foundation.NSString) M:NaturalLanguage.NLEmbedding.GetSupportedSentenceEmbeddingRevisions(NaturalLanguage.NLLanguage) M:NaturalLanguage.NLEmbedding.GetVector(System.String) -M:NaturalLanguage.NLEmbedding.GetWordEmbedding(Foundation.NSString,System.UIntPtr) -M:NaturalLanguage.NLEmbedding.GetWordEmbedding(Foundation.NSString) M:NaturalLanguage.NLEmbedding.GetWordEmbedding(NaturalLanguage.NLLanguage,System.UIntPtr) M:NaturalLanguage.NLEmbedding.GetWordEmbedding(NaturalLanguage.NLLanguage) M:NaturalLanguage.NLEmbedding.TryGetVector(System.String,System.Single[]@) -M:NaturalLanguage.NLEmbedding.Write(Foundation.NSDictionary,Foundation.NSString,System.UIntPtr,Foundation.NSUrl,Foundation.NSError@) M:NaturalLanguage.NLEmbedding.Write(NaturalLanguage.NLVectorDictionary,System.Nullable{NaturalLanguage.NLLanguage},System.UIntPtr,Foundation.NSUrl,Foundation.NSError@) M:NaturalLanguage.NLGazetteer.#ctor(Foundation.NSData,Foundation.NSError@) -M:NaturalLanguage.NLGazetteer.#ctor(Foundation.NSDictionary,Foundation.NSString,Foundation.NSError@) M:NaturalLanguage.NLGazetteer.#ctor(Foundation.NSUrl,Foundation.NSError@) M:NaturalLanguage.NLGazetteer.#ctor(NaturalLanguage.NLStrongDictionary,System.Nullable{NaturalLanguage.NLLanguage},Foundation.NSError@) M:NaturalLanguage.NLGazetteer.Create(Foundation.NSUrl,Foundation.NSError@) M:NaturalLanguage.NLGazetteer.GetLabel(System.String) -M:NaturalLanguage.NLGazetteer.Write(Foundation.NSDictionary,Foundation.NSString,Foundation.NSUrl,Foundation.NSError@) M:NaturalLanguage.NLGazetteer.Write(NaturalLanguage.NLStrongDictionary,System.Nullable{NaturalLanguage.NLLanguage},Foundation.NSUrl,Foundation.NSError@) M:NaturalLanguage.NLLanguageRecognizer.#ctor M:NaturalLanguage.NLLanguageRecognizer.GetDominantLanguage(System.String) M:NaturalLanguage.NLLanguageRecognizer.GetLanguageHypotheses(System.UIntPtr) -M:NaturalLanguage.NLLanguageRecognizer.GetNativeLanguageHypotheses(System.UIntPtr) M:NaturalLanguage.NLLanguageRecognizer.Process(System.String) M:NaturalLanguage.NLLanguageRecognizer.Reset M:NaturalLanguage.NLModel.Create(CoreML.MLModel,Foundation.NSError@) M:NaturalLanguage.NLModel.Create(Foundation.NSUrl,Foundation.NSError@) -M:NaturalLanguage.NLModel.GetNativePredictedLabelHypotheses(System.String,System.UIntPtr) -M:NaturalLanguage.NLModel.GetNativePredictedLabelHypotheses(System.String[],System.UIntPtr) M:NaturalLanguage.NLModel.GetPredictedLabel(System.String) M:NaturalLanguage.NLModel.GetPredictedLabelHypotheses(System.String,System.UIntPtr) M:NaturalLanguage.NLModel.GetPredictedLabelHypotheses(System.String[],System.UIntPtr) @@ -42167,35 +42087,21 @@ M:NaturalLanguage.NLModelConfiguration.GetCurrentRevision(NaturalLanguage.NLMode M:NaturalLanguage.NLModelConfiguration.GetSupportedRevisions(NaturalLanguage.NLModelType) M:NaturalLanguage.NLStrongDictionary.#ctor M:NaturalLanguage.NLStrongDictionary.#ctor(Foundation.NSDictionary) -M:NaturalLanguage.NLTagger.#ctor(Foundation.NSString[]) M:NaturalLanguage.NLTagger.#ctor(NaturalLanguage.NLTagScheme[]) -M:NaturalLanguage.NLTagger.EnumerateTags(Foundation.NSRange,NaturalLanguage.NLTokenUnit,Foundation.NSString,NaturalLanguage.NLTaggerOptions,NaturalLanguage.NLTaggerEnumerateTagsContinuationHandler) M:NaturalLanguage.NLTagger.EnumerateTags(Foundation.NSRange,NaturalLanguage.NLTokenUnit,NaturalLanguage.NLTagScheme,NaturalLanguage.NLTaggerOptions,NaturalLanguage.NLTaggerEnumerateTagsContinuationHandler) -M:NaturalLanguage.NLTagger.GetAvailableTagSchemes(NaturalLanguage.NLTokenUnit,Foundation.NSString) M:NaturalLanguage.NLTagger.GetAvailableTagSchemes(NaturalLanguage.NLTokenUnit,NaturalLanguage.NLLanguage) -M:NaturalLanguage.NLTagger.GetGazetteers(Foundation.NSString) M:NaturalLanguage.NLTagger.GetGazetteers(NaturalLanguage.NLTagScheme) -M:NaturalLanguage.NLTagger.GetModels(Foundation.NSString) M:NaturalLanguage.NLTagger.GetModels(NaturalLanguage.NLTagScheme) -M:NaturalLanguage.NLTagger.GetNativeTagHypotheses(System.UIntPtr,NaturalLanguage.NLTokenUnit,Foundation.NSString,System.UIntPtr,Foundation.NSRange@) -M:NaturalLanguage.NLTagger.GetNativeTagHypotheses(System.UIntPtr,NaturalLanguage.NLTokenUnit,Foundation.NSString,System.UIntPtr) -M:NaturalLanguage.NLTagger.GetTag(System.UIntPtr,NaturalLanguage.NLTokenUnit,Foundation.NSString,Foundation.NSRange@) M:NaturalLanguage.NLTagger.GetTag(System.UIntPtr,NaturalLanguage.NLTokenUnit,NaturalLanguage.NLTagScheme,Foundation.NSRange@) M:NaturalLanguage.NLTagger.GetTagHypotheses(System.UIntPtr,NaturalLanguage.NLTokenUnit,NaturalLanguage.NLTagScheme,System.UIntPtr,Foundation.NSRange@) M:NaturalLanguage.NLTagger.GetTagHypotheses(System.UIntPtr,NaturalLanguage.NLTokenUnit,NaturalLanguage.NLTagScheme,System.UIntPtr) -M:NaturalLanguage.NLTagger.GetTags(Foundation.NSRange,NaturalLanguage.NLTokenUnit,Foundation.NSString,NaturalLanguage.NLTaggerOptions,Foundation.NSValue[]@) M:NaturalLanguage.NLTagger.GetTags(Foundation.NSRange,NaturalLanguage.NLTokenUnit,NaturalLanguage.NLTagScheme,NaturalLanguage.NLTaggerOptions,Foundation.NSValue[]@) M:NaturalLanguage.NLTagger.GetTokenRange(Foundation.NSRange,NaturalLanguage.NLTokenUnit) M:NaturalLanguage.NLTagger.GetTokenRange(System.UIntPtr,Foundation.NSString) -M:NaturalLanguage.NLTagger.RequestAssets(Foundation.NSString,Foundation.NSString,System.Action{NaturalLanguage.NLTaggerAssetsResult,Foundation.NSError}) M:NaturalLanguage.NLTagger.RequestAssets(NaturalLanguage.NLLanguage,NaturalLanguage.NLTagScheme,System.Action{NaturalLanguage.NLTaggerAssetsResult,Foundation.NSError}) -M:NaturalLanguage.NLTagger.RequestAssetsAsync(Foundation.NSString,Foundation.NSString) M:NaturalLanguage.NLTagger.RequestAssetsAsync(NaturalLanguage.NLLanguage,NaturalLanguage.NLTagScheme) -M:NaturalLanguage.NLTagger.SetGazetteers(NaturalLanguage.NLGazetteer[],Foundation.NSString) M:NaturalLanguage.NLTagger.SetGazetteers(NaturalLanguage.NLGazetteer[],NaturalLanguage.NLTagScheme) -M:NaturalLanguage.NLTagger.SetLanguage(Foundation.NSString,Foundation.NSRange) M:NaturalLanguage.NLTagger.SetLanguage(NaturalLanguage.NLLanguage,Foundation.NSRange) -M:NaturalLanguage.NLTagger.SetModels(NaturalLanguage.NLModel[],Foundation.NSString) M:NaturalLanguage.NLTagger.SetModels(NaturalLanguage.NLModel[],NaturalLanguage.NLTagScheme) M:NaturalLanguage.NLTagger.SetOrthography(Foundation.NSOrthography,Foundation.NSRange) M:NaturalLanguage.NLTokenizer.#ctor(NaturalLanguage.NLTokenUnit) @@ -42287,7 +42193,6 @@ M:Network.NWConnection.Send(System.Byte[],System.Int32,System.Int32,Network.NWCo M:Network.NWConnection.SendIdempotent(CoreFoundation.DispatchData,Network.NWContentContext,System.Boolean) M:Network.NWConnection.SendIdempotent(System.Byte[],Network.NWContentContext,System.Boolean) M:Network.NWConnection.SetBetterPathAvailableHandler(System.Action{System.Boolean}) -M:Network.NWConnection.SetBooleanChangeHandler(System.Action{System.Boolean}) M:Network.NWConnection.SetPathChangedHandler(System.Action{Network.NWPath}) M:Network.NWConnection.SetQueue(CoreFoundation.DispatchQueue) M:Network.NWConnection.SetStateChangeHandler(System.Action{Network.NWConnectionState,Network.NWError}) @@ -43405,11 +43310,8 @@ M:PassKit.PKPaymentMethod.EncodeTo(Foundation.NSCoder) M:PassKit.PKPaymentMethodSelectedEventArgs.#ctor(PassKit.PKPaymentMethod,System.Action{PassKit.PKPaymentSummaryItem[]}) M:PassKit.PKPaymentOrderDetails.#ctor(System.String,System.String,Foundation.NSUrl,System.String) M:PassKit.PKPaymentRequest.CreatePaymentBillingAddressInvalidError(Contacts.CNPostalAddressKeyOption,System.String) -M:PassKit.PKPaymentRequest.CreatePaymentBillingAddressInvalidError(Foundation.NSString,System.String) -M:PassKit.PKPaymentRequest.CreatePaymentContactInvalidError(Foundation.NSString,System.String) M:PassKit.PKPaymentRequest.CreatePaymentContactInvalidError(PassKit.PKContactFields,System.String) M:PassKit.PKPaymentRequest.CreatePaymentShippingAddressInvalidError(Contacts.CNPostalAddressKeyOption,System.String) -M:PassKit.PKPaymentRequest.CreatePaymentShippingAddressInvalidError(Foundation.NSString,System.String) M:PassKit.PKPaymentRequest.CreatePaymentShippingAddressUnserviceableError(System.String) M:PassKit.PKPaymentRequest.GetCouponCodeExpiredError(System.String) M:PassKit.PKPaymentRequest.GetCouponCodeInvalidError(System.String) @@ -43597,10 +43499,8 @@ M:PdfKit.PdfOutline.Child(System.IntPtr) M:PdfKit.PdfOutline.InsertChild(PdfKit.PdfOutline,System.IntPtr) M:PdfKit.PdfOutline.RemoveFromParent M:PdfKit.PdfPage.#ctor -M:PdfKit.PdfPage.#ctor(AppKit.NSImage,Foundation.NSDictionary) M:PdfKit.PdfPage.#ctor(AppKit.NSImage,PdfKit.PdfPageImageInitializationOption) M:PdfKit.PdfPage.#ctor(AppKit.NSImage) -M:PdfKit.PdfPage.#ctor(UIKit.UIImage,Foundation.NSDictionary) M:PdfKit.PdfPage.#ctor(UIKit.UIImage,PdfKit.PdfPageImageInitializationOption) M:PdfKit.PdfPage.#ctor(UIKit.UIImage) M:PdfKit.PdfPage.AddAnnotation(PdfKit.PdfAnnotation) @@ -44568,7 +44468,6 @@ M:SceneKit.ISCNProgramDelegate.UnbindValue(SceneKit.SCNProgram,System.String,Sys M:SceneKit.ISCNSceneExportDelegate.WriteImage(AppKit.NSImage,Foundation.NSUrl,Foundation.NSUrl) M:SceneKit.ISCNSceneExportDelegate.WriteImage(UIKit.UIImage,Foundation.NSUrl,Foundation.NSUrl) M:SceneKit.ISCNSceneRenderer.GetNodesInsideFrustum(SceneKit.SCNNode) -M:SceneKit.ISCNSceneRenderer.HitTest(CoreGraphics.CGPoint,Foundation.NSDictionary) M:SceneKit.ISCNSceneRenderer.IsNodeInsideFrustum(SceneKit.SCNNode,SceneKit.SCNNode) M:SceneKit.ISCNSceneRenderer.Prepare(Foundation.NSObject,System.Func{System.Boolean}) M:SceneKit.ISCNSceneRenderer.Prepare(Foundation.NSObject[],System.Action{System.Boolean}) @@ -44710,7 +44609,6 @@ M:SceneKit.SCNHitTestOptions.#ctor(Foundation.NSDictionary) M:SceneKit.SCNJavaScript.ExportModule(JavaScriptCore.JSContext) M:SceneKit.SCNLayer.Dispose(System.Boolean) M:SceneKit.SCNLayer.GetNodesInsideFrustum(SceneKit.SCNNode) -M:SceneKit.SCNLayer.HitTest(CoreGraphics.CGPoint,Foundation.NSDictionary) M:SceneKit.SCNLayer.HitTest(CoreGraphics.CGPoint,SceneKit.SCNHitTestOptions) M:SceneKit.SCNLayer.IsNodeInsideFrustum(SceneKit.SCNNode,SceneKit.SCNNode) M:SceneKit.SCNLayer.Prepare(Foundation.NSObject,System.Func{System.Boolean}) @@ -44916,7 +44814,6 @@ M:SceneKit.SCNRenderer.Dispose(System.Boolean) M:SceneKit.SCNRenderer.FromContext(OpenGL.CGLContext,Foundation.NSDictionary) M:SceneKit.SCNRenderer.FromContext(OpenGLES.EAGLContext,Foundation.NSDictionary) M:SceneKit.SCNRenderer.GetNodesInsideFrustum(SceneKit.SCNNode) -M:SceneKit.SCNRenderer.HitTest(CoreGraphics.CGPoint,Foundation.NSDictionary) M:SceneKit.SCNRenderer.HitTest(CoreGraphics.CGPoint,SceneKit.SCNHitTestOptions) M:SceneKit.SCNRenderer.IsNodeInsideFrustum(SceneKit.SCNNode,SceneKit.SCNNode) M:SceneKit.SCNRenderer.Prepare(Foundation.NSObject,System.Func{System.Boolean}) @@ -44944,7 +44841,6 @@ M:SceneKit.SCNSceneRenderer_Extensions.GetWorkingColorSpace(SceneKit.ISCNSceneRe M:SceneKit.SCNSceneRenderer_Extensions.PrepareAsync(SceneKit.ISCNSceneRenderer,Foundation.NSObject[]) M:SceneKit.SCNSceneRenderer_Extensions.PresentSceneAsync(SceneKit.ISCNSceneRenderer,SceneKit.SCNScene,SpriteKit.SKTransition,SceneKit.SCNNode) M:SceneKit.SCNSceneRenderer.GetNodesInsideFrustum(SceneKit.SCNNode) -M:SceneKit.SCNSceneRenderer.HitTest(CoreGraphics.CGPoint,Foundation.NSDictionary) M:SceneKit.SCNSceneRenderer.HitTest(CoreGraphics.CGPoint,SceneKit.SCNHitTestOptions) M:SceneKit.SCNSceneRenderer.IsNodeInsideFrustum(SceneKit.SCNNode,SceneKit.SCNNode) M:SceneKit.SCNSceneRenderer.Prepare(Foundation.NSObject,System.Func{System.Boolean}) @@ -45017,7 +44913,6 @@ M:SceneKit.SCNView.#ctor(CoreGraphics.CGRect,SceneKit.SCNRenderingOptions) M:SceneKit.SCNView.#ctor(CoreGraphics.CGRect) M:SceneKit.SCNView.Dispose(System.Boolean) M:SceneKit.SCNView.GetNodesInsideFrustum(SceneKit.SCNNode) -M:SceneKit.SCNView.HitTest(CoreGraphics.CGPoint,Foundation.NSDictionary) M:SceneKit.SCNView.HitTest(CoreGraphics.CGPoint,SceneKit.SCNHitTestOptions) M:SceneKit.SCNView.IsNodeInsideFrustum(SceneKit.SCNNode,SceneKit.SCNNode) M:SceneKit.SCNView.Prepare(Foundation.NSObject,System.Func{System.Boolean}) @@ -47050,7 +46945,6 @@ M:UIKit.IUIViewControllerTransitionCoordinator.AnimateAlongsideTransition(System M:UIKit.IUIViewControllerTransitionCoordinator.AnimateAlongsideTransitionInView(UIKit.UIView,System.Action{UIKit.IUIViewControllerTransitionCoordinatorContext},System.Action{UIKit.IUIViewControllerTransitionCoordinatorContext}) M:UIKit.IUIViewControllerTransitionCoordinator.NotifyWhenInteractionChanges(System.Action{UIKit.IUIViewControllerTransitionCoordinatorContext}) M:UIKit.IUIViewControllerTransitionCoordinator.NotifyWhenInteractionEndsUsingBlock(System.Action{UIKit.IUIViewControllerTransitionCoordinatorContext}) -M:UIKit.IUIViewControllerTransitionCoordinatorContext.GetTransitionViewControllerForKey(Foundation.NSString) M:UIKit.IUIViewControllerTransitionCoordinatorContext.GetViewControllerForKey(Foundation.NSString) M:UIKit.IUIViewControllerTransitionCoordinatorContext.TargetTransform M:UIKit.IUIViewControllerTransitioningDelegate.GetAnimationControllerForDismissedController(UIKit.UIViewController) @@ -49576,7 +49470,6 @@ M:UIKit.UITabBarItem.GetBadgeTextAttributes(UIKit.UIControlState) M:UIKit.UITabBarItem.GetFrame(UIKit.UIView) M:UIKit.UITabBarItem.SetBadgeTextAttributes(UIKit.UIStringAttributes,UIKit.UIControlState) M:UIKit.UITabBarItem.UITabBarItemAppearance.#ctor(System.IntPtr) -M:UIKit.UITabBarItem.UITabBarItemAppearance.GetBadgeTextAttributesDictionary(UIKit.UIControlState) M:UIKit.UITabBarItemAppearance.Copy(Foundation.NSZone) M:UIKit.UITabBarItemAppearance.EncodeTo(Foundation.NSCoder) M:UIKit.UITabBarItemEventArgs.#ctor(UIKit.UITabBarItem) @@ -50488,9 +50381,7 @@ M:UniformTypeIdentifiers.UTType.CreateFromMimeType(System.String) M:UniformTypeIdentifiers.UTType.CreateImportedType(System.String,UniformTypeIdentifiers.UTType) M:UniformTypeIdentifiers.UTType.CreateImportedType(System.String) M:UniformTypeIdentifiers.UTType.EncodeTo(Foundation.NSCoder) -M:UniformTypeIdentifiers.UTType.GetType(System.String,Foundation.NSString,UniformTypeIdentifiers.UTType) M:UniformTypeIdentifiers.UTType.GetType(System.String,UniformTypeIdentifiers.UTTagClass,UniformTypeIdentifiers.UTType) -M:UniformTypeIdentifiers.UTType.GetTypes(System.String,Foundation.NSString,UniformTypeIdentifiers.UTType) M:UniformTypeIdentifiers.UTType.GetTypes(System.String,UniformTypeIdentifiers.UTTagClass,UniformTypeIdentifiers.UTType) M:UniformTypeIdentifiers.UTType.IsSubtypeOf(UniformTypeIdentifiers.UTType) M:UniformTypeIdentifiers.UTType.IsSupertypeOf(UniformTypeIdentifiers.UTType) @@ -63502,7 +63393,71 @@ P:CoreVideo.CVPixelBufferPool.TypeID P:CoreVideo.CVPixelBufferPoolAllocationSettings.Threshold P:CoreVideo.CVPixelBufferPoolSettings.MaximumBufferAgeInSeconds P:CoreVideo.CVPixelBufferPoolSettings.MinimumBufferCount -P:CoreVideo.CVPixelFormatDescription.AllTypes +P:CoreVideo.CVPixelFormatComponentRange.FullRange +P:CoreVideo.CVPixelFormatComponentRange.VideoRange +P:CoreVideo.CVPixelFormatComponentRange.WideRange +P:CoreVideo.CVPixelFormatComponentRangeKeys.FullRange +P:CoreVideo.CVPixelFormatComponentRangeKeys.VideoRange +P:CoreVideo.CVPixelFormatComponentRangeKeys.WideRange +P:CoreVideo.CVPixelFormatDescription.BitsPerBlock +P:CoreVideo.CVPixelFormatDescription.BlackBlock +P:CoreVideo.CVPixelFormatDescription.BlockHeight +P:CoreVideo.CVPixelFormatDescription.BlockHorizontalAlignment +P:CoreVideo.CVPixelFormatDescription.BlockVerticalAlignment +P:CoreVideo.CVPixelFormatDescription.BlockWidth +P:CoreVideo.CVPixelFormatDescription.CGBitmapContextCompatibility +P:CoreVideo.CVPixelFormatDescription.CGBitmapInfo +P:CoreVideo.CVPixelFormatDescription.CGImageCompatibility +P:CoreVideo.CVPixelFormatDescription.CodecType +P:CoreVideo.CVPixelFormatDescription.ComponentRange +P:CoreVideo.CVPixelFormatDescription.Constant +P:CoreVideo.CVPixelFormatDescription.ContainsAlpha +P:CoreVideo.CVPixelFormatDescription.ContainsGrayscale +P:CoreVideo.CVPixelFormatDescription.FillExtendedPixelsCallback +P:CoreVideo.CVPixelFormatDescription.FillExtendedPixelsCallbackStruct +P:CoreVideo.CVPixelFormatDescription.FormatContainsRgb +P:CoreVideo.CVPixelFormatDescription.FormatContainsSenselArray +P:CoreVideo.CVPixelFormatDescription.FormatContainsYCbCr +P:CoreVideo.CVPixelFormatDescription.FourCC +P:CoreVideo.CVPixelFormatDescription.HorizontalSubsampling +P:CoreVideo.CVPixelFormatDescription.Name +P:CoreVideo.CVPixelFormatDescription.OpenGLCompatibility +P:CoreVideo.CVPixelFormatDescription.OpenGlesCompatibility +P:CoreVideo.CVPixelFormatDescription.OpenGLFormat +P:CoreVideo.CVPixelFormatDescription.OpenGLInternalFormat +P:CoreVideo.CVPixelFormatDescription.OpenGLType +P:CoreVideo.CVPixelFormatDescription.Planes +P:CoreVideo.CVPixelFormatDescription.QDCompatibility +P:CoreVideo.CVPixelFormatDescription.VerticalSubsampling +P:CoreVideo.CVPixelFormatKeys.BitsPerBlock +P:CoreVideo.CVPixelFormatKeys.BlackBlock +P:CoreVideo.CVPixelFormatKeys.BlockHeight +P:CoreVideo.CVPixelFormatKeys.BlockHorizontalAlignment +P:CoreVideo.CVPixelFormatKeys.BlockVerticalAlignment +P:CoreVideo.CVPixelFormatKeys.BlockWidth +P:CoreVideo.CVPixelFormatKeys.CGBitmapContextCompatibility +P:CoreVideo.CVPixelFormatKeys.CGBitmapInfo +P:CoreVideo.CVPixelFormatKeys.CGImageCompatibility +P:CoreVideo.CVPixelFormatKeys.CodecType +P:CoreVideo.CVPixelFormatKeys.ComponentRange +P:CoreVideo.CVPixelFormatKeys.Constant +P:CoreVideo.CVPixelFormatKeys.ContainsAlpha +P:CoreVideo.CVPixelFormatKeys.ContainsGrayscale +P:CoreVideo.CVPixelFormatKeys.ContainsRgb +P:CoreVideo.CVPixelFormatKeys.ContainsSenselArray +P:CoreVideo.CVPixelFormatKeys.ContainsYCbCr +P:CoreVideo.CVPixelFormatKeys.FillExtendedPixelsCallback +P:CoreVideo.CVPixelFormatKeys.FourCC +P:CoreVideo.CVPixelFormatKeys.HorizontalSubsampling +P:CoreVideo.CVPixelFormatKeys.Name +P:CoreVideo.CVPixelFormatKeys.OpenGLCompatibility +P:CoreVideo.CVPixelFormatKeys.OpenGlesCompatibility +P:CoreVideo.CVPixelFormatKeys.OpenGLFormat +P:CoreVideo.CVPixelFormatKeys.OpenGLInternalFormat +P:CoreVideo.CVPixelFormatKeys.OpenGLType +P:CoreVideo.CVPixelFormatKeys.Planes +P:CoreVideo.CVPixelFormatKeys.QDCompatibility +P:CoreVideo.CVPixelFormatKeys.VerticalSubsampling P:CoreVideo.CVTime.Flags P:CoreVideo.CVTime.IndefiniteTime P:CoreVideo.CVTime.ZeroTime @@ -63767,14 +63722,9 @@ P:Foundation.INSFilePresenter.PresentedItemOperationQueue P:Foundation.INSFilePresenter.PresentedItemUrl P:Foundation.INSFilePresenter.PrimaryPresentedItemUrl P:Foundation.INSItemProviderWriting.WritableTypeIdentifiersForItemProvider -P:Foundation.INSObjectProtocol.Class P:Foundation.INSObjectProtocol.DebugDescription P:Foundation.INSObjectProtocol.Description -P:Foundation.INSObjectProtocol.IsProxy P:Foundation.INSObjectProtocol.RetainCount -P:Foundation.INSObjectProtocol.Self -P:Foundation.INSObjectProtocol.Superclass -P:Foundation.INSObjectProtocol.Zone P:Foundation.INSProgressReporting.Progress P:Foundation.LoadInPlaceResult.FileUrl P:Foundation.LoadInPlaceResult.IsInPlace @@ -64469,15 +64419,10 @@ P:Foundation.NSObject.ChangeKindKey P:Foundation.NSObject.ChangeNewKey P:Foundation.NSObject.ChangeNotificationIsPriorKey P:Foundation.NSObject.ChangeOldKey -P:Foundation.NSObject.Class P:Foundation.NSObject.DebugDescription P:Foundation.NSObject.Description P:Foundation.NSObject.ExposedBindings -P:Foundation.NSObject.IsProxy P:Foundation.NSObject.RetainCount -P:Foundation.NSObject.Self -P:Foundation.NSObject.Superclass -P:Foundation.NSObject.Zone P:Foundation.NSObjectEventArgs.Obj P:Foundation.NSObservedChange.Change P:Foundation.NSObservedChange.Indexes @@ -67929,83 +67874,44 @@ P:MediaPlayer.MPMediaEntity.PersistentID P:MediaPlayer.MPMediaEntity.PropertyPersistentID P:MediaPlayer.MPMediaItem.AlbumArtist P:MediaPlayer.MPMediaItem.AlbumArtistPersistentID -P:MediaPlayer.MPMediaItem.AlbumArtistPersistentIDProperty -P:MediaPlayer.MPMediaItem.AlbumArtistProperty P:MediaPlayer.MPMediaItem.AlbumPersistentID -P:MediaPlayer.MPMediaItem.AlbumPersistentIDProperty P:MediaPlayer.MPMediaItem.AlbumTitle -P:MediaPlayer.MPMediaItem.AlbumTitleProperty P:MediaPlayer.MPMediaItem.AlbumTrackCount -P:MediaPlayer.MPMediaItem.AlbumTrackCountProperty P:MediaPlayer.MPMediaItem.AlbumTrackNumber -P:MediaPlayer.MPMediaItem.AlbumTrackNumberProperty P:MediaPlayer.MPMediaItem.Artist P:MediaPlayer.MPMediaItem.ArtistPersistentID -P:MediaPlayer.MPMediaItem.ArtistPersistentIDProperty -P:MediaPlayer.MPMediaItem.ArtistProperty P:MediaPlayer.MPMediaItem.Artwork -P:MediaPlayer.MPMediaItem.ArtworkProperty P:MediaPlayer.MPMediaItem.AssetURL -P:MediaPlayer.MPMediaItem.AssetURLProperty P:MediaPlayer.MPMediaItem.BeatsPerMinute -P:MediaPlayer.MPMediaItem.BeatsPerMinuteProperty P:MediaPlayer.MPMediaItem.BookmarkTime -P:MediaPlayer.MPMediaItem.BookmarkTimeProperty P:MediaPlayer.MPMediaItem.Comments -P:MediaPlayer.MPMediaItem.CommentsProperty P:MediaPlayer.MPMediaItem.Composer P:MediaPlayer.MPMediaItem.ComposerPersistentID -P:MediaPlayer.MPMediaItem.ComposerPersistentIDProperty -P:MediaPlayer.MPMediaItem.ComposerProperty P:MediaPlayer.MPMediaItem.DateAdded -P:MediaPlayer.MPMediaItem.DateAddedProperty P:MediaPlayer.MPMediaItem.DiscCount -P:MediaPlayer.MPMediaItem.DiscCountProperty P:MediaPlayer.MPMediaItem.DiscNumber -P:MediaPlayer.MPMediaItem.DiscNumberProperty P:MediaPlayer.MPMediaItem.Genre P:MediaPlayer.MPMediaItem.GenrePersistentID -P:MediaPlayer.MPMediaItem.GenrePersistentIDProperty -P:MediaPlayer.MPMediaItem.GenreProperty P:MediaPlayer.MPMediaItem.HasProtectedAsset -P:MediaPlayer.MPMediaItem.HasProtectedAssetProperty P:MediaPlayer.MPMediaItem.IsCloudItem -P:MediaPlayer.MPMediaItem.IsCloudItemProperty P:MediaPlayer.MPMediaItem.IsCompilation -P:MediaPlayer.MPMediaItem.IsCompilationProperty P:MediaPlayer.MPMediaItem.IsExplicitItem -P:MediaPlayer.MPMediaItem.IsExplicitProperty P:MediaPlayer.MPMediaItem.IsPreorder -P:MediaPlayer.MPMediaItem.IsPreorderProperty P:MediaPlayer.MPMediaItem.LastPlayedDate -P:MediaPlayer.MPMediaItem.LastPlayedDateProperty P:MediaPlayer.MPMediaItem.Lyrics -P:MediaPlayer.MPMediaItem.LyricsProperty P:MediaPlayer.MPMediaItem.MediaType -P:MediaPlayer.MPMediaItem.MediaTypeProperty P:MediaPlayer.MPMediaItem.PersistentID -P:MediaPlayer.MPMediaItem.PersistentIDProperty P:MediaPlayer.MPMediaItem.PlaybackDuration -P:MediaPlayer.MPMediaItem.PlaybackDurationProperty P:MediaPlayer.MPMediaItem.PlaybackStoreID -P:MediaPlayer.MPMediaItem.PlaybackStoreIDProperty P:MediaPlayer.MPMediaItem.PlayCount -P:MediaPlayer.MPMediaItem.PlayCountProperty P:MediaPlayer.MPMediaItem.PodcastPersistentID -P:MediaPlayer.MPMediaItem.PodcastPersistentIDProperty P:MediaPlayer.MPMediaItem.PodcastTitle -P:MediaPlayer.MPMediaItem.PodcastTitleProperty P:MediaPlayer.MPMediaItem.PropertyPersistentID P:MediaPlayer.MPMediaItem.Rating -P:MediaPlayer.MPMediaItem.RatingProperty P:MediaPlayer.MPMediaItem.ReleaseDate -P:MediaPlayer.MPMediaItem.ReleaseDateProperty P:MediaPlayer.MPMediaItem.SkipCount -P:MediaPlayer.MPMediaItem.SkipCountProperty P:MediaPlayer.MPMediaItem.Title -P:MediaPlayer.MPMediaItem.TitleProperty P:MediaPlayer.MPMediaItem.UserGrouping -P:MediaPlayer.MPMediaItem.UserGroupingProperty P:MediaPlayer.MPMediaItemArtwork.Bounds P:MediaPlayer.MPMediaItemArtwork.ImageCropRectangle P:MediaPlayer.MPMediaItemCollection.Count @@ -70600,7 +70506,6 @@ P:NaturalLanguage.NLGazetteer.Language P:NaturalLanguage.NLLanguageRecognizer.DominantLanguage P:NaturalLanguage.NLLanguageRecognizer.LanguageConstraints P:NaturalLanguage.NLLanguageRecognizer.LanguageHints -P:NaturalLanguage.NLLanguageRecognizer.NativeLanguageHints P:NaturalLanguage.NLModel.Configuration P:NaturalLanguage.NLModelConfiguration.Language P:NaturalLanguage.NLModelConfiguration.Revision @@ -72574,7 +72479,6 @@ P:SceneKit.SCNPhysicsTestSearchModeKeys.Any P:SceneKit.SCNPhysicsTestSearchModeKeys.Closest P:SceneKit.SCNPhysicsWorld.ContactDelegate P:SceneKit.SCNProgram.Delegate -P:SceneKit.SCNProgram.MappingChannelKey P:SceneKit.SCNProgram.Opaque P:SceneKit.SCNProgramSemanticOptions.MappingChannel P:SceneKit.SCNPropertyControllers.Angle @@ -73244,8 +73148,6 @@ P:TVMLKit.TVMediaItem.Title P:TVMLKit.TVMediaItem.Type P:TVMLKit.TVMediaItem.Url P:TVMLKit.TVMediaItem.UserInfo -P:TVMLKit.TVMediaItem.WeakContentRatingDomain -P:TVMLKit.TVMediaItem.WeakType P:TVMLKit.TVPlaybackCustomEventUserInfo.ExpectsReturnValue P:TVMLKit.TVPlaybackCustomEventUserInfo.Properties P:TVMLKit.TVPlaybackCustomEventUserInfo.ReturnValue @@ -78696,7 +78598,6 @@ T:CoreServices.LSAcceptanceFlags T:CoreServices.LSResult T:CoreServices.LSRoles T:CoreSpotlight.CSImportExtension -T:CoreSpotlight.CSMailboxKey T:CoreSpotlight.CSSearchableIndexBundleDataResult T:CoreSpotlight.CSSearchQueryContext T:CoreSpotlight.CSSearchQuerySourceOptions @@ -78853,6 +78754,7 @@ T:CoreVideo.CVDisplayLink T:CoreVideo.CVDisplayLink.DisplayLinkOutputCallback T:CoreVideo.CVFillExtendedPixelsCallBack T:CoreVideo.CVFillExtendedPixelsCallBackData +T:CoreVideo.CVFillExtendedPixelsCallBackDataStruct T:CoreVideo.CVImageBufferAlphaChannelMode T:CoreVideo.CVImageBufferColorPrimaries T:CoreVideo.CVImageBufferTransferFunction @@ -78861,7 +78763,10 @@ T:CoreVideo.CVMetalTexture T:CoreVideo.CVMetalTextureAttributes T:CoreVideo.CVPixelBufferAttributes T:CoreVideo.CVPixelBufferPoolSettings +T:CoreVideo.CVPixelFormatComponentRange +T:CoreVideo.CVPixelFormatComponentRangeKeys T:CoreVideo.CVPixelFormatDescription +T:CoreVideo.CVPixelFormatKeys T:CoreVideo.CVPixelFormatType T:CoreVideo.CVPixelFormatTypeExtensions T:CoreVideo.CVPlanarComponentInfo diff --git a/tests/common/shared-dotnet.mk b/tests/common/shared-dotnet.mk index 7299716da60e..995084302733 100644 --- a/tests/common/shared-dotnet.mk +++ b/tests/common/shared-dotnet.mk @@ -72,33 +72,37 @@ ifeq ($(PLATFORM),) PLATFORM=$(shell basename "$(CURDIR)") endif -ifeq ($(RUNTIMEIDENTIFIERS),) +ifneq ($(RUNTIMEIDENTIFIERS)$(RUNTIMEIDENTIFIER),) +$(error "Don't set RUNTIMEIDENTIFIER or RUNTIMEIDENTIFIERS, set RID instead") +endif + +ifeq ($(RID),) ifeq ($(PLATFORM),iOS) -RUNTIMEIDENTIFIERS=ios-arm64 +RID=ios-arm64 else ifeq ($(PLATFORM),tvOS) -RUNTIMEIDENTIFIERS=tvos-arm64 +RID=tvos-arm64 else ifeq ($(PLATFORM),MacCatalyst) ifeq ($(CONFIG),Release) -RUNTIMEIDENTIFIERS=maccatalyst-x64;maccatalyst-arm64 +RID=maccatalyst-x64;maccatalyst-arm64 else ifneq ($(UNIVERSAL),) -RUNTIMEIDENTIFIERS=maccatalyst-x64;maccatalyst-arm64 +RID=maccatalyst-x64;maccatalyst-arm64 else ifeq ($(shell arch),arm64) -RUNTIMEIDENTIFIERS=maccatalyst-arm64 +RID=maccatalyst-arm64 else -RUNTIMEIDENTIFIERS=maccatalyst-x64 +RID=maccatalyst-x64 endif else ifeq ($(PLATFORM),macOS) ifeq ($(CONFIG),Release) -RUNTIMEIDENTIFIERS=osx-x64;osx-arm64 +RID=osx-x64;osx-arm64 else ifneq ($(UNIVERSAL),) -RUNTIMEIDENTIFIERS=osx-x64;osx-arm64 +RID=osx-x64;osx-arm64 else ifeq ($(shell arch),arm64) -RUNTIMEIDENTIFIERS=osx-arm64 +RID=osx-arm64 else -RUNTIMEIDENTIFIERS=osx-x64 +RID=osx-x64 endif else -RUNTIMEIDENTIFIERS=unknown-platform-$(PLATFORM) +RID=unknown-platform-$(PLATFORM) endif endif @@ -106,10 +110,12 @@ ifneq ($(UNIVERSAL),) UNIVERSAL_ARGUMENT=/p:UniversalBuild=true endif -ifeq ($(findstring ;,$(RUNTIMEIDENTIFIERS)),;) +ifeq ($(findstring ;,$(RID)),;) PATH_RID= +export RUNTIMEIDENTIFIERS=$(RID) else -PATH_RID=$(RUNTIMEIDENTIFIERS)/ +PATH_RID=$(RID)/ +export RUNTIMEIDENTIFIER=$(RID) endif diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index e8c4a27c900e..26e67f552aac 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -230,6 +230,30 @@ public void Bug34042 () BuildFile (Profile.iOS, "bug34042.cs"); } + [Test] + [TestCase (Profile.iOS)] + public void NSCopyingNullability (Profile profile) + { + var bgen = BuildFile (profile, "tests/nscopying-nullability.cs"); + bgen.AssertNoWarnings (); + } + + [Test] + [TestCase (Profile.iOS)] + public void EditorBrowsable (Profile profile) + { + var bgen = BuildFile (profile, false, true, "tests/editor-browsable.cs"); + var types = bgen.ApiAssembly.MainModule.Types; + + var hasEditorBrowsableAttribute = new Func ((ICustomAttributeProvider provider) => { + return provider.CustomAttributes.Any (v => v.AttributeType.Name == "EditorBrowsableAttribute"); + }); + + var strongEnumType = types.Single (v => v.Name == "StrongEnum"); + Assert.IsTrue (hasEditorBrowsableAttribute (strongEnumType), "StrongEnumType"); + var objcClassType = types.Single (v => v.Name == "ObjCClass"); + Assert.IsTrue (hasEditorBrowsableAttribute (objcClassType), "ObjCClass"); + } static string RenderArgument (CustomAttributeArgument arg) { @@ -1641,21 +1665,74 @@ public void BackingFieldType (Profile profile) const string nuintName = "System.nuint"; #endif - var nsNumberGetConstant = bgen.ApiAssembly.MainModule.GetType ("BackingField", "NSNumberFieldTypeExtensions").Methods.First ((v) => v.Name == "GetConstant"); - Assert.AreEqual ("Foundation.NSNumber", nsNumberGetConstant.ReturnType.FullName, "NSNumber #1"); - var nsNumberGetValue = bgen.ApiAssembly.MainModule.GetType ("BackingField", "NSNumberFieldTypeExtensions").Methods.First ((v) => v.Name == "GetValue"); - Assert.AreEqual ("Foundation.NSNumber", nsNumberGetValue.Parameters [0].ParameterType.FullName, "NSNumber #2"); + var testCases = new [] { + new { BackingFieldType = "NSNumber", NullableType = "Foundation.NSNumber", RenderedBackingFieldType = "Foundation.NSNumber", SimplifiedNullableType = "Foundation.NSNumber" }, + new { BackingFieldType = "NSInteger", NullableType = $"System.Nullable`1<{nintName}>", RenderedBackingFieldType = nintName, SimplifiedNullableType = "System.Nullable`1" }, + new { BackingFieldType = "NSUInteger", NullableType = $"System.Nullable`1<{nuintName}>", RenderedBackingFieldType = nuintName, SimplifiedNullableType = "System.Nullable`1" }, + }; + + foreach (var tc in testCases) { + var getConstant = bgen.ApiAssembly.MainModule.GetType ("BackingField", $"{tc.BackingFieldType}FieldTypeExtensions").Methods.First ((v) => v.Name == "GetConstant"); + Assert.AreEqual (tc.NullableType, getConstant.ReturnType.FullName, $"{tc.BackingFieldType}: GetConstant return type"); - var nsNSIntegerGetConstant = bgen.ApiAssembly.MainModule.GetType ("BackingField", "NSIntegerFieldTypeExtensions").Methods.First ((v) => v.Name == "GetConstant"); - Assert.AreEqual ($"System.Nullable`1<{nintName}>", nsNSIntegerGetConstant.ReturnType.FullName, "NSInteger #1"); - var nsNSIntegerGetValue = bgen.ApiAssembly.MainModule.GetType ("BackingField", "NSIntegerFieldTypeExtensions").Methods.First ((v) => v.Name == "GetValue"); - Assert.AreEqual (nintName, nsNSIntegerGetValue.Parameters [0].ParameterType.FullName, "NSInteger #2"); + var getValue = bgen.ApiAssembly.MainModule.GetType ("BackingField", $"{tc.BackingFieldType}FieldTypeExtensions").Methods.First ((v) => v.Name == "GetValue"); + Assert.AreEqual (tc.RenderedBackingFieldType, getValue.Parameters [0].ParameterType.FullName, $"{tc.BackingFieldType}: GetValue parameter type"); - var nsNSUIntegerGetConstant = bgen.ApiAssembly.MainModule.GetType ("BackingField", "NSUIntegerFieldTypeExtensions").Methods.First ((v) => v.Name == "GetConstant"); - Assert.AreEqual ($"System.Nullable`1<{nuintName}>", nsNSUIntegerGetConstant.ReturnType.FullName, "NSUInteger #1"); - var nsNSUIntegerGetValue = bgen.ApiAssembly.MainModule.GetType ("BackingField", "NSUIntegerFieldTypeExtensions").Methods.First ((v) => v.Name == "GetValue"); - Assert.AreEqual (nuintName, nsNSUIntegerGetValue.Parameters [0].ParameterType.FullName, "NSUInteger #2"); + var toEnumArray = bgen.ApiAssembly.MainModule.GetType ("BackingField", $"{tc.BackingFieldType}FieldTypeExtensions").Methods.First ((v) => v.Name == "ToEnumArray"); + Assert.IsTrue (toEnumArray.ReturnType.IsArray, $"{tc.BackingFieldType} ToEnumArray return type IsArray"); + Assert.AreEqual ($"{tc.BackingFieldType}FieldType", toEnumArray.ReturnType.GetElementType ().Name, $"{tc.BackingFieldType} ToEnumArray return type"); + Assert.IsTrue (toEnumArray.Parameters [0].ParameterType.IsArray, $"{tc.BackingFieldType} ToEnumArray parameter type IsArray"); + Assert.AreEqual (tc.RenderedBackingFieldType, toEnumArray.Parameters [0].ParameterType.GetElementType ().FullName, $"{tc.BackingFieldType} ToEnumArray parameter type"); + + var toConstantArray = bgen.ApiAssembly.MainModule.GetType ("BackingField", $"{tc.BackingFieldType}FieldTypeExtensions").Methods.First ((v) => v.Name == "ToConstantArray"); + Assert.IsTrue (toConstantArray.ReturnType.IsArray, $"{tc.BackingFieldType} ToConstantArray return type IsArray"); + Assert.AreEqual (tc.SimplifiedNullableType, toConstantArray.ReturnType.GetElementType ().FullName, $"{tc.BackingFieldType} ToConstantArray return type"); + Assert.IsTrue (toConstantArray.Parameters [0].ParameterType.IsArray, $"{tc.BackingFieldType} ToConstantArray parameter type IsArray"); + Assert.AreEqual ($"{tc.BackingFieldType}FieldType", toConstantArray.Parameters [0].ParameterType.GetElementType ().Name, $"{tc.BackingFieldType} ToConstantArray parameter type"); + } } + [Test] + [TestCase (Profile.iOS)] + public void UnderlyingFieldType (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = BuildFile (profile, true, true, "tests/underlyingfieldtype.cs"); + +#if NET + const string nintName = "System.IntPtr"; + const string nuintName = "System.UIntPtr"; +#else + const string nintName = "System.nint"; + const string nuintName = "System.nuint"; +#endif + } + + [Test] + [TestCase (Profile.iOS)] + public void DelegatesWithNullableReturnType (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = BuildFile (profile, "tests/delegate-nullable-return.cs"); + bgen.AssertNoWarnings (); + + var delegateCallback = bgen.ApiAssembly.MainModule.GetType ("NS", "MyCallback").Methods.First ((v) => v.Name == "EndInvoke"); + Assert.That (delegateCallback.MethodReturnType.CustomAttributes.Any (v => v.AttributeType.Name == "NullableAttribute"), "Nullable return type"); + } + + [Test] + [TestCase (Profile.iOS)] + public void DelegatesWithPointerTypes (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = BuildFile (profile, "tests/delegate-types.cs"); + bgen.AssertNoWarnings (); + + var delegateCallback = bgen.ApiAssembly.MainModule.GetType ("NS", "MyCallback").Methods.First ((v) => v.Name == "EndInvoke"); + Assert.IsTrue (delegateCallback.MethodReturnType.ReturnType.IsPointer, "Pointer return type"); + foreach (var p in delegateCallback.Parameters.Where (v => v.Name != "result")) { + Assert.IsTrue (p.ParameterType.IsPointer, $"Pointer parameter type: {p.Name}"); + } + } } } diff --git a/tests/generator/ExpectedXmlDocs.MacCatalyst.xml b/tests/generator/ExpectedXmlDocs.MacCatalyst.xml index 47e7c2f01653..f68dbf3939d5 100644 --- a/tests/generator/ExpectedXmlDocs.MacCatalyst.xml +++ b/tests/generator/ExpectedXmlDocs.MacCatalyst.xml @@ -35,6 +35,14 @@ Retrieves the value named by . The name of the constant to retrieve. + + Converts an array of enum values into an array of their corresponding constants. + The array of enum values to convert. + + + Converts an array of values into an array of their corresponding enum values. + The array if values to convert. + Summary for E3 diff --git a/tests/generator/ExpectedXmlDocs.iOS.legacy.xml b/tests/generator/ExpectedXmlDocs.iOS.legacy.xml index 63e6c1222b2d..5b2159023f3b 100644 --- a/tests/generator/ExpectedXmlDocs.iOS.legacy.xml +++ b/tests/generator/ExpectedXmlDocs.iOS.legacy.xml @@ -35,6 +35,14 @@ Retrieves the value named by . The name of the constant to retrieve. + + Converts an array of enum values into an array of their corresponding constants. + The array of enum values to convert. + + + Converts an array of values into an array of their corresponding enum values. + The array if values to convert. + Summary for E3 diff --git a/tests/generator/ExpectedXmlDocs.iOS.xml b/tests/generator/ExpectedXmlDocs.iOS.xml index 204943d997fd..12f1913997c6 100644 --- a/tests/generator/ExpectedXmlDocs.iOS.xml +++ b/tests/generator/ExpectedXmlDocs.iOS.xml @@ -35,6 +35,14 @@ Retrieves the value named by . The name of the constant to retrieve. + + Converts an array of enum values into an array of their corresponding constants. + The array of enum values to convert. + + + Converts an array of values into an array of their corresponding enum values. + The array if values to convert. + Summary for E3 diff --git a/tests/generator/ExpectedXmlDocs.macOS.legacy.xml b/tests/generator/ExpectedXmlDocs.macOS.legacy.xml index 4ab92fe3181a..00f1404a0751 100644 --- a/tests/generator/ExpectedXmlDocs.macOS.legacy.xml +++ b/tests/generator/ExpectedXmlDocs.macOS.legacy.xml @@ -35,6 +35,14 @@ Retrieves the value named by . The name of the constant to retrieve. + + Converts an array of enum values into an array of their corresponding constants. + The array of enum values to convert. + + + Converts an array of values into an array of their corresponding enum values. + The array if values to convert. + Summary for E3 diff --git a/tests/generator/ExpectedXmlDocs.macOS.xml b/tests/generator/ExpectedXmlDocs.macOS.xml index 47e7c2f01653..f68dbf3939d5 100644 --- a/tests/generator/ExpectedXmlDocs.macOS.xml +++ b/tests/generator/ExpectedXmlDocs.macOS.xml @@ -35,6 +35,14 @@ Retrieves the value named by . The name of the constant to retrieve. + + Converts an array of enum values into an array of their corresponding constants. + The array of enum values to convert. + + + Converts an array of values into an array of their corresponding enum values. + The array if values to convert. + Summary for E3 diff --git a/tests/generator/ExpectedXmlDocs.tvOS.legacy.xml b/tests/generator/ExpectedXmlDocs.tvOS.legacy.xml index 4ab92fe3181a..00f1404a0751 100644 --- a/tests/generator/ExpectedXmlDocs.tvOS.legacy.xml +++ b/tests/generator/ExpectedXmlDocs.tvOS.legacy.xml @@ -35,6 +35,14 @@ Retrieves the value named by . The name of the constant to retrieve. + + Converts an array of enum values into an array of their corresponding constants. + The array of enum values to convert. + + + Converts an array of values into an array of their corresponding enum values. + The array if values to convert. + Summary for E3 diff --git a/tests/generator/ExpectedXmlDocs.tvOS.xml b/tests/generator/ExpectedXmlDocs.tvOS.xml index 47e7c2f01653..f68dbf3939d5 100644 --- a/tests/generator/ExpectedXmlDocs.tvOS.xml +++ b/tests/generator/ExpectedXmlDocs.tvOS.xml @@ -35,6 +35,14 @@ Retrieves the value named by . The name of the constant to retrieve. + + Converts an array of enum values into an array of their corresponding constants. + The array of enum values to convert. + + + Converts an array of values into an array of their corresponding enum values. + The array if values to convert. + Summary for E3 diff --git a/tests/generator/tests/delegate-nullable-return.cs b/tests/generator/tests/delegate-nullable-return.cs new file mode 100644 index 000000000000..7c669bfa5a6c --- /dev/null +++ b/tests/generator/tests/delegate-nullable-return.cs @@ -0,0 +1,16 @@ +using System; + +using Foundation; +using ObjCRuntime; + +namespace NS { + [return: NullAllowed] + delegate NSObject MyCallback ([NullAllowed] NSObject obj); + + [BaseType (typeof (NSObject))] + interface Widget { + [Export ("foo")] + [NullAllowed] + MyCallback Foo { get; set; } + } +} diff --git a/tests/generator/tests/delegate-types.cs b/tests/generator/tests/delegate-types.cs new file mode 100644 index 000000000000..650fef631b02 --- /dev/null +++ b/tests/generator/tests/delegate-types.cs @@ -0,0 +1,15 @@ +using System; + +using Foundation; +using ObjCRuntime; + +namespace NS { + unsafe delegate byte* MyCallback (sbyte* a, short* b, ushort* c, int* d, uint* e, long* f, ulong* g, float* h, double* i); + + [BaseType (typeof (NSObject))] + interface Widget { + [Export ("foo")] + [NullAllowed] + MyCallback Foo { get; set; } + } +} diff --git a/tests/generator/tests/editor-browsable.cs b/tests/generator/tests/editor-browsable.cs new file mode 100644 index 000000000000..ca45cdbc954d --- /dev/null +++ b/tests/generator/tests/editor-browsable.cs @@ -0,0 +1,19 @@ +using System; +using System.ComponentModel; + +using Foundation; + +namespace EditorBrowsable { + [EditorBrowsable (EditorBrowsableState.Never)] + enum StrongEnum { + [Field ("AField", "__Internal")] + A, + } + + [EditorBrowsable (EditorBrowsableState.Never)] + [BaseType (typeof (NSObject))] + interface ObjCClass { + [Export ("strongEnumField")] + StrongEnum StrongEnumField { get; set; } + } +} diff --git a/tests/generator/tests/nscopying-nullability.cs b/tests/generator/tests/nscopying-nullability.cs new file mode 100644 index 000000000000..01bb83b9dcfb --- /dev/null +++ b/tests/generator/tests/nscopying-nullability.cs @@ -0,0 +1,9 @@ +using System; +using Foundation; +using ObjCRuntime; + +namespace NS { + [BaseType (typeof (NSObject))] + interface MyNSCopyingWidget : INSCopying { + } +} diff --git a/tests/generator/tests/underlyingfieldtype.cs b/tests/generator/tests/underlyingfieldtype.cs new file mode 100644 index 000000000000..5fed436b373c --- /dev/null +++ b/tests/generator/tests/underlyingfieldtype.cs @@ -0,0 +1,40 @@ +using System; +using Foundation; + +namespace UnderlyingFieldType { + [BaseType (typeof (NSObject))] + interface FieldClass { + [Field ("SByteField", "__Internal")] + sbyte SByteField { get; set; } + + [Field ("ByteField", "__Internal")] + byte ByteField { get; set; } + + [Field ("ShortField", "__Internal")] + short ShortField { get; set; } + + [Field ("UShortField", "__Internal")] + ushort UShortField { get; set; } + + [Field ("IntField", "__Internal")] + int IntField { get; set; } + + [Field ("UIntField", "__Internal")] + uint UIntField { get; set; } + + [Field ("LongField", "__Internal")] + long LongField { get; set; } + + [Field ("ULongField", "__Internal")] + ulong ULongField { get; set; } + + [Field ("DoubleField", "__Internal")] + double DoubleField { get; set; } + + [Field ("UIntPtrField", "__Internal")] + UIntPtr UIntPtrField { get; set; } + + [Field ("IntPtrield", "__Internal")] + IntPtr IntPtrField { get; set; } + } +} diff --git a/tests/linker/ios/link sdk/AotBugs.cs b/tests/linker/ios/link sdk/AotBugs.cs index 09b6124dba31..d0a7329c00c4 100644 --- a/tests/linker/ios/link sdk/AotBugs.cs +++ b/tests/linker/ios/link sdk/AotBugs.cs @@ -412,6 +412,11 @@ IEnumerable> MakeEnumerable (KeyValuePair [] } [Test] +#if __MACOS__ && NET +#if !NET9_0_OR_GREATER // not sure if this issue is limited to .NET 8, but add this in so that we find out in our .NET 9 branch. + [Ignore ("https://github.com/dotnet/runtime/issues/107026")] +#endif +#endif public void AsEnumerable_4114 () { Enumbers e = new Enumbers (); diff --git a/tests/monotouch-test/CoreVideo/PixelFormatDescriptionTest.cs b/tests/monotouch-test/CoreVideo/PixelFormatDescriptionTest.cs index 448baf25fb85..1426de2be924 100644 --- a/tests/monotouch-test/CoreVideo/PixelFormatDescriptionTest.cs +++ b/tests/monotouch-test/CoreVideo/PixelFormatDescriptionTest.cs @@ -10,7 +10,11 @@ #if !__WATCHOS__ using System; +using System.IO; +using System.Text; + using Foundation; +using CoreGraphics; using CoreVideo; using ObjCRuntime; using NUnit.Framework; @@ -60,6 +64,54 @@ public void Register () Assert.NotNull (CVPixelFormatDescription.Create ((CVPixelFormatType) 3), "3b"); } + +#if NET + [Test] + public void CV32ARGB () + { + Assert.Multiple (() => { + var pf = CVPixelFormatType.CV32ARGB; + var desc = CVPixelFormatDescription.CreatePixelFormat (pf); + Assert.IsNull (desc.Name, "Name"); + Assert.AreEqual (pf, desc.Constant ?? ((CVPixelFormatType) 0xFFFFFFFF), "Constant"); + Assert.IsNull (desc.CodecType, "CodecType"); + Assert.IsNull (desc.FourCC, "FourCC"); + Assert.AreEqual (true, desc.ContainsAlpha, "ContainsAlpha"); + Assert.AreEqual (false, desc.FormatContainsYCbCr, "FormatContainsYCbCr"); + Assert.AreEqual (true, desc.FormatContainsRgb, "FormatContainsRgb"); + Assert.AreEqual (false, desc.ContainsGrayscale, "ContainsGrayscale"); + if (TestRuntime.CheckXcodeVersion (14, 0)) + Assert.IsNull (desc.FormatContainsSenselArray, "FormatContainsSenselArray"); + Assert.IsNull (desc.ComponentRange, "ComponentRange"); + Assert.IsNull (desc.Planes, "Planes"); + Assert.IsNull (desc.BlockWidth, "BlockWidth"); + Assert.IsNull (desc.BlockHeight, "BlockHeight"); + Assert.AreEqual (32, desc.BitsPerBlock, "BitsPerBlock"); + Assert.IsNull (desc.BlockHorizontalAlignment, "BlockHorizontalAlignment"); + Assert.IsNull (desc.BlockVerticalAlignment, "BlockVerticalAlignment"); + Assert.IsNotNull (desc.BlackBlock, "BlackBlock"); + Assert.IsNull (desc.HorizontalSubsampling, "HorizontalSubsampling"); + Assert.IsNull (desc.VerticalSubsampling, "VerticalSubsampling"); +#if (__IOS__ && !__MACCATALYST__) || __TVOS__ + Assert.IsNull (desc.OpenGLFormat, "OpenGLFormat"); + Assert.IsNull (desc.OpenGLType, "OpenGLType"); + Assert.IsNull (desc.OpenGLInternalFormat, "OpenGLInternalFormat"); + Assert.IsNull (desc.OpenGLCompatibility, "OpenGLCompatibility"); +#else + Assert.AreEqual (32993, desc.OpenGLFormat, "OpenGLFormat"); + Assert.AreEqual (32821, desc.OpenGLType, "OpenGLType"); + Assert.AreEqual (32856, desc.OpenGLInternalFormat, "OpenGLInternalFormat"); + Assert.AreEqual (true, desc.OpenGLCompatibility, "OpenGLCompatibility"); +#endif + Assert.AreEqual (CGBitmapFlags.ByteOrder32Big | CGBitmapFlags.First, desc.CGBitmapInfo, "CGBitmapInfo"); + Assert.AreEqual (true, desc.QDCompatibility, "QDCompatibility"); + Assert.AreEqual (true, desc.CGBitmapContextCompatibility, "CGBitmapContextCompatibility"); + Assert.AreEqual (true, desc.CGImageCompatibility, "CGImageCompatibility"); + Assert.IsNotNull (desc.FillExtendedPixelsCallback, "FillExtendedPixelsCallback"); + Assert.IsNotNull (desc.FillExtendedPixelsCallbackStruct, "FillExtendedPixelsCallbackStruct"); + }); + } +#endif // NET } } diff --git a/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs b/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs index 27e4cfa46839..909dbecdca53 100644 --- a/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs +++ b/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs @@ -33,5 +33,83 @@ public void OpenClose_libSystem () #endif Assert.That (err, Is.EqualTo (expected), "dlclose"); } + +#if NET + [Test] + public void GetVariables () + { + var symbol = "x_native_field"; + var handle = (IntPtr) Dlfcn.RTLD.Default; + + Assert.AreNotEqual (IntPtr.Zero, Dlfcn.dlsym (handle, symbol), "Symbol"); + + var originalValue = Dlfcn.GetUInt64 (handle, symbol); + Assert.Multiple (() => { + unchecked { + // the n(uint) and (U)IntPtr asserts only work in 64-bit, which is fine because we only care about 64-bit right now. + Assert.AreEqual ((ushort) 0x8899, (ushort) Dlfcn.GetInt16 (handle, symbol), "GetInt16"); + Assert.AreEqual ((uint) 0xeeff8899, (uint) Dlfcn.GetInt32 (handle, symbol), "GetInt32"); + Assert.AreEqual ((ulong) 0xaabbccddeeff8899, (ulong) Dlfcn.GetInt64 (handle, symbol), "GetInt64"); + Assert.AreEqual ((nuint) 0xaabbccddeeff8899, (nuint) Dlfcn.GetNInt (handle, symbol), "GetNInt"); + Assert.AreEqual ((ushort) 0x8899, Dlfcn.GetUInt16 (handle, symbol), "GetUInt16"); + Assert.AreEqual ((uint) 0xeeff8899, Dlfcn.GetUInt32 (handle, symbol), "GetUInt32"); + Assert.AreEqual ((ulong) 0xaabbccddeeff8899, Dlfcn.GetUInt64 (handle, symbol), "GetUInt64"); + Assert.AreEqual ((nuint) 0xaabbccddeeff8899, Dlfcn.GetNUInt (handle, symbol), "GetNUInt"); + Assert.AreEqual ((nfloat) (-7.757653393002521E-103), Dlfcn.GetNFloat (handle, symbol), "GetNFloat"); + Assert.AreEqual (-7.7576533930025207E-103d, Dlfcn.GetDouble (handle, symbol), "GetDouble"); + Assert.AreEqual ((nuint) 0xaabbccddeeff8899, (nuint) Dlfcn.GetIntPtr (handle, symbol), "GetIntPtr"); // won't work in 32-bit, but we don't care about that anymore + Assert.AreEqual ((nuint) 0xaabbccddeeff8899, Dlfcn.GetUIntPtr (handle, symbol), "GetUIntPtr"); + + Dlfcn.SetInt16 (handle, symbol, 0x77); + Assert.AreEqual ((short) 0x77, Dlfcn.GetInt16 (handle, symbol), "SetInt16"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetInt32 (handle, symbol, 0x77); + Assert.AreEqual ((int) 0x77, Dlfcn.GetInt32 (handle, symbol), "SetInt32"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetInt64 (handle, symbol, 0x77); + Assert.AreEqual ((long) 0x77, Dlfcn.GetInt64 (handle, symbol), "SetInt64"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetNInt (handle, symbol, 0x77); + Assert.AreEqual ((nint) 0x77, Dlfcn.GetNInt (handle, symbol), "SetNInt"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetUInt16 (handle, symbol, 0x77); + Assert.AreEqual ((ushort) 0x77, Dlfcn.GetUInt16 (handle, symbol), "SetUInt16"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetUInt32 (handle, symbol, 0x77); + Assert.AreEqual ((uint) 0x77, Dlfcn.GetUInt32 (handle, symbol), "SetUInt32"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetUInt64 (handle, symbol, 0x77); + Assert.AreEqual ((ulong) 0x77, Dlfcn.GetUInt64 (handle, symbol), "SetUInt64"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetNUInt (handle, symbol, 0x77); + Assert.AreEqual ((nuint) 0x77, Dlfcn.GetNUInt (handle, symbol), "SetNUInt"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetNFloat (handle, symbol, 0x77); + Assert.AreEqual ((nfloat) 0x77, Dlfcn.GetNFloat (handle, symbol), "SetNFloat"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetDouble (handle, symbol, 0x77); + Assert.AreEqual (0x77, Dlfcn.GetDouble (handle, symbol), "SetDouble"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetIntPtr (handle, symbol, 0x77); + Assert.AreEqual ((nint) 0x77, Dlfcn.GetIntPtr (handle, symbol), "SetIntPtr"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + + Dlfcn.SetUIntPtr (handle, symbol, 0x77); + Assert.AreEqual ((nuint) 0x77, Dlfcn.GetUIntPtr (handle, symbol), "SetUIntPtr"); + Dlfcn.SetUInt64 (handle, symbol, originalValue); + } + }); + } +#endif } } diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs index db0661c43b18..5232aceaf878 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs @@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Linq; +using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading; @@ -5536,6 +5537,37 @@ public void RefEnumValues () Assert.AreEqual (EnumUL.b, ul, "out: UL"); } } + +#if NET && HAS_UIKIT + [Test] + public void ProtocolsTrimmedAway () + { + PreserveIUIApplicationDelegate (null); + + // A little indirection to try to make the trimmer not be helpful and preserve all the methods on IUIApplicationDelegate. + AssertMemberCount (typeof (IUIApplicationDelegate)); + } + + void AssertMemberCount (Type type) + { + var members = type.GetMembers (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance); +#if OPTIMIZEALL || NATIVEAOT + var expectNoMembers = true; +#else + var expectNoMembers = false; +#endif + if (expectNoMembers) { + Assert.AreEqual (0, members.Length, $"All members should be trimmed away in {type.FullName}:\n\t{string.Join ("\n\t", members.Select (v => v.ToString ()))}"); + } else { + Assert.AreNotEqual (0, members.Length, $"All members should not be trimmed away in {type.FullName}"); + } + } + + void PreserveIUIApplicationDelegate (IUIApplicationDelegate obj) + { + GC.KeepAlive (obj); + } +#endif // NET && HAS_UIKIT } #if !__WATCHOS__ diff --git a/tests/monotouch-test/dotnet/shared.csproj b/tests/monotouch-test/dotnet/shared.csproj index 5e49cc55f80d..e72462bc7823 100644 --- a/tests/monotouch-test/dotnet/shared.csproj +++ b/tests/monotouch-test/dotnet/shared.csproj @@ -48,6 +48,7 @@ + diff --git a/tests/test-dependencies.sh b/tests/test-dependencies.sh index 8e7f8d6ca087..0e23982874ce 100755 --- a/tests/test-dependencies.sh +++ b/tests/test-dependencies.sh @@ -1,4 +1,4 @@ #!/bin/bash -ex cd "$(dirname "$0")" -./system-dependencies.sh --provision-mono --ignore-autotools --ignore-xamarin-studio --ignore-xcode --ignore-osx --ignore-cmake --ignore-dotnet --ignore-shellcheck --ignore-yamllint +./system-dependencies.sh --provision-mono --ignore-xamarin-studio --ignore-xcode --ignore-osx --ignore-cmake --ignore-dotnet --ignore-shellcheck --ignore-yamllint diff --git a/tests/test-libraries/libtest.h b/tests/test-libraries/libtest.h index 219a0e59b7b8..fa765586d097 100644 --- a/tests/test-libraries/libtest.h +++ b/tests/test-libraries/libtest.h @@ -17,6 +17,8 @@ extern "C" { int theUltimateAnswer (); void useZLib (); +__attribute__ ((used)) unsigned long long x_native_field = 0xAABBCCDDEEFF8899; + // NS_ASSUME_NONNULL_BEGIN doesn't work #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" diff --git a/tests/test-libraries/rename.h b/tests/test-libraries/rename.h index 9ba236efdf0e..6b35363e9ce9 100644 --- a/tests/test-libraries/rename.h +++ b/tests/test-libraries/rename.h @@ -74,6 +74,7 @@ #define x_SCNMatrix4MakeScale object_x_SCNMatrix4MakeScale #define x_SCNMatrix4Translate object_x_SCNMatrix4Translate #define x_GlobalString object_x_GlobalString + #define x_native_field object_x_native_field #elif PREFIX == 2 #define theUltimateAnswer ar_theUltimateAnswer #define useZLib ar_useZLib @@ -149,6 +150,7 @@ #define x_SCNMatrix4MakeScale ar_x_SCNMatrix4MakeScale #define x_SCNMatrix4Translate ar_x_SCNMatrix4Translate #define x_GlobalString ar_x_GlobalString + #define x_native_field ar_x_native_field #else // keep original names #endif diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore index c896fa3cbdc0..6ed54ca923b9 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore @@ -3,39 +3,6 @@ !missing-field! kCVIndefiniteTime not bound !missing-field! kCVPixelBufferPoolFreeBufferNotification not bound -## the following fields are manually bound in CVPixelFormatDescription.cs -!missing-field! kCVPixelFormatBitsPerBlock not bound -!missing-field! kCVPixelFormatBlackBlock not bound -!missing-field! kCVPixelFormatBlockHeight not bound -!missing-field! kCVPixelFormatBlockHorizontalAlignment not bound -!missing-field! kCVPixelFormatBlockVerticalAlignment not bound -!missing-field! kCVPixelFormatBlockWidth not bound -!missing-field! kCVPixelFormatCGBitmapContextCompatibility not bound -!missing-field! kCVPixelFormatCGBitmapInfo not bound -!missing-field! kCVPixelFormatCGImageCompatibility not bound -!missing-field! kCVPixelFormatCodecType not bound -!missing-field! kCVPixelFormatComponentRange not bound -!missing-field! kCVPixelFormatComponentRange_FullRange not bound -!missing-field! kCVPixelFormatComponentRange_VideoRange not bound -!missing-field! kCVPixelFormatComponentRange_WideRange not bound -!missing-field! kCVPixelFormatConstant not bound -!missing-field! kCVPixelFormatContainsAlpha not bound -!missing-field! kCVPixelFormatContainsGrayscale not bound -!missing-field! kCVPixelFormatContainsRGB not bound -!missing-field! kCVPixelFormatContainsYCbCr not bound -!missing-field! kCVPixelFormatFillExtendedPixelsCallback not bound -!missing-field! kCVPixelFormatFourCC not bound -!missing-field! kCVPixelFormatHorizontalSubsampling not bound -!missing-field! kCVPixelFormatName not bound -!missing-field! kCVPixelFormatOpenGLCompatibility not bound -!missing-field! kCVPixelFormatOpenGLFormat not bound -!missing-field! kCVPixelFormatOpenGLInternalFormat not bound -!missing-field! kCVPixelFormatOpenGLType not bound -!missing-field! kCVPixelFormatPlanes not bound -!missing-field! kCVPixelFormatQDCompatibility not bound -!missing-field! kCVPixelFormatVerticalSubsampling not bound -!missing-field! kCVPixelFormatContainsSenselArray not bound - !missing-field! kCVZeroTime not bound !missing-pinvoke! CVPixelBufferRelease is not bound !missing-pinvoke! CVPixelBufferRetain is not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreVideo.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreVideo.ignore index e9418f1287a8..a3fd156ac4a0 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreVideo.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreVideo.ignore @@ -1,4 +1,3 @@ !missing-pinvoke! CVImageBufferCreateColorSpaceFromAttachments is not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey not bound -!missing-field! kCVPixelFormatOpenGLESCompatibility not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CoreVideo.ignore b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CoreVideo.ignore index e9418f1287a8..a3fd156ac4a0 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CoreVideo.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CoreVideo.ignore @@ -1,4 +1,3 @@ !missing-pinvoke! CVImageBufferCreateColorSpaceFromAttachments is not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey not bound -!missing-field! kCVPixelFormatOpenGLESCompatibility not bound diff --git a/tests/xtro-sharpie/common-CoreVideo.ignore b/tests/xtro-sharpie/common-CoreVideo.ignore index 918354e32440..0417b951f1dd 100644 --- a/tests/xtro-sharpie/common-CoreVideo.ignore +++ b/tests/xtro-sharpie/common-CoreVideo.ignore @@ -3,39 +3,6 @@ !missing-field! kCVIndefiniteTime not bound !missing-field! kCVPixelBufferPoolFreeBufferNotification not bound -## the following fields are manually bound in CVPixelFormatDescription.cs -!missing-field! kCVPixelFormatBitsPerBlock not bound -!missing-field! kCVPixelFormatBlackBlock not bound -!missing-field! kCVPixelFormatBlockHeight not bound -!missing-field! kCVPixelFormatBlockHorizontalAlignment not bound -!missing-field! kCVPixelFormatBlockVerticalAlignment not bound -!missing-field! kCVPixelFormatBlockWidth not bound -!missing-field! kCVPixelFormatCGBitmapContextCompatibility not bound -!missing-field! kCVPixelFormatCGBitmapInfo not bound -!missing-field! kCVPixelFormatCGImageCompatibility not bound -!missing-field! kCVPixelFormatCodecType not bound -!missing-field! kCVPixelFormatComponentRange not bound -!missing-field! kCVPixelFormatComponentRange_FullRange not bound -!missing-field! kCVPixelFormatComponentRange_VideoRange not bound -!missing-field! kCVPixelFormatComponentRange_WideRange not bound -!missing-field! kCVPixelFormatConstant not bound -!missing-field! kCVPixelFormatContainsAlpha not bound -!missing-field! kCVPixelFormatContainsGrayscale not bound -!missing-field! kCVPixelFormatContainsRGB not bound -!missing-field! kCVPixelFormatContainsYCbCr not bound -!missing-field! kCVPixelFormatFillExtendedPixelsCallback not bound -!missing-field! kCVPixelFormatFourCC not bound -!missing-field! kCVPixelFormatHorizontalSubsampling not bound -!missing-field! kCVPixelFormatName not bound -!missing-field! kCVPixelFormatOpenGLCompatibility not bound -!missing-field! kCVPixelFormatOpenGLFormat not bound -!missing-field! kCVPixelFormatOpenGLInternalFormat not bound -!missing-field! kCVPixelFormatOpenGLType not bound -!missing-field! kCVPixelFormatPlanes not bound -!missing-field! kCVPixelFormatQDCompatibility not bound -!missing-field! kCVPixelFormatVerticalSubsampling not bound -!missing-field! kCVPixelFormatContainsSenselArray not bound - !missing-field! kCVZeroTime not bound !missing-pinvoke! CVPixelBufferRelease is not bound !missing-pinvoke! CVPixelBufferRetain is not bound diff --git a/tests/xtro-sharpie/iOS-CoreVideo.ignore b/tests/xtro-sharpie/iOS-CoreVideo.ignore index 1d0f65ee8b95..1285849da476 100644 --- a/tests/xtro-sharpie/iOS-CoreVideo.ignore +++ b/tests/xtro-sharpie/iOS-CoreVideo.ignore @@ -1,6 +1,5 @@ !missing-pinvoke! CVImageBufferCreateColorSpaceFromAttachments is not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey not bound -!missing-field! kCVPixelFormatOpenGLESCompatibility not bound !missing-pinvoke! CVMetalTextureCacheGetTypeID is not bound !missing-pinvoke! CVMetalTextureGetTypeID is not bound diff --git a/tests/xtro-sharpie/tvOS-CoreVideo.ignore b/tests/xtro-sharpie/tvOS-CoreVideo.ignore index 1d0f65ee8b95..1285849da476 100644 --- a/tests/xtro-sharpie/tvOS-CoreVideo.ignore +++ b/tests/xtro-sharpie/tvOS-CoreVideo.ignore @@ -1,6 +1,5 @@ !missing-pinvoke! CVImageBufferCreateColorSpaceFromAttachments is not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey not bound !missing-field! kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey not bound -!missing-field! kCVPixelFormatOpenGLESCompatibility not bound !missing-pinvoke! CVMetalTextureCacheGetTypeID is not bound !missing-pinvoke! CVMetalTextureGetTypeID is not bound diff --git a/tools/common/Make.common b/tools/common/Make.common index ef34668c0fa8..838256b0934d 100644 --- a/tools/common/Make.common +++ b/tools/common/Make.common @@ -33,22 +33,22 @@ -e "s/@IOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ -e 's/@IOS_REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ -e "s/@IOS_NUGET_VERSION@/$(IOS_NUGET_VERSION)/g" \ - -e "s/@IOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(IOS_NUGET_COMMIT_DISTANCE)+$(NUGET_BUILD_METADATA)/g" \ + -e "s/@IOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(IOS_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g" \ \ -e "s/@TVOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ -e 's/@TVOS_REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ -e "s/@TVOS_NUGET_VERSION@/$(TVOS_NUGET_VERSION)/g" \ - -e "s/@TVOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(TVOS_NUGET_COMMIT_DISTANCE)+$(NUGET_BUILD_METADATA)/g" \ + -e "s/@TVOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(TVOS_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g" \ \ -e "s/@WATCHOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ -e 's/@WATCHOS_REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ -e "s/@WATCHOS_NUGET_VERSION@/$(WATCHOS_NUGET_VERSION)/g" \ - -e "s/@WATCHOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(WATCHOS_NUGET_COMMIT_DISTANCE)+$(NUGET_BUILD_METADATA)/g" \ + -e "s/@WATCHOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(WATCHOS_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g" \ \ -e "s/@MACOS_VERSION@/$(MAC_PACKAGE_VERSION_MAJOR).$(MAC_PACKAGE_VERSION_MINOR).$(MAC_PACKAGE_VERSION_REV)/g" \ -e 's/@MACOS_REVISION@/$(MAC_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ -e "s/@MACOS_NUGET_VERSION@/$(MACOS_NUGET_VERSION)/g" \ - -e "s/@MACOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(MACOS_NUGET_COMMIT_DISTANCE)+$(NUGET_BUILD_METADATA)/g" \ + -e "s/@MACOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(MACOS_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g" \ \ -e "s/@TARGET_PLATFORM_VERSION_IOS@/$(IOS_NUGET_OS_VERSION)/g" \ -e "s/@TARGET_PLATFORM_VERSION_TVOS@/$(TVOS_NUGET_OS_VERSION)/g" \ @@ -72,7 +72,7 @@ \ $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),-e 's/@$(platform)_REVISION@/$($(platform)_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g') \ $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),-e 's/@$(platform)_NUGET_VERSION@/$($(platform)_NUGET_VERSION)/g') \ - $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),-e "s/@$(platform)_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$($(platform)_NUGET_COMMIT_DISTANCE)+$(NUGET_BUILD_METADATA)/g") \ + $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),-e "s/@$(platform)_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$($(platform)_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g") \ \ -e "s/@PRODUCT_HASH@/$(CURRENT_HASH_LONG)/g" \ $< > $@ diff --git a/tools/devops/automation/build-pipeline.yml b/tools/devops/automation/build-pipeline.yml index 6fa9c00eeb16..eeb88f0df7fc 100644 --- a/tools/devops/automation/build-pipeline.yml +++ b/tools/devops/automation/build-pipeline.yml @@ -198,6 +198,8 @@ trigger: exclude: - refs/heads/locfiles/* - refs/heads/dev/* + - refs/heads/darc-* + - refs/heads/backport-pr-* paths: exclude: - .github diff --git a/tools/devops/automation/run-ci-api-diff.yml b/tools/devops/automation/run-ci-api-diff.yml index 9d5210603a97..ae851ebf6ad8 100644 --- a/tools/devops/automation/run-ci-api-diff.yml +++ b/tools/devops/automation/run-ci-api-diff.yml @@ -7,6 +7,8 @@ trigger: exclude: - refs/heads/locfiles/* - refs/heads/dev/* + - refs/heads/darc-* + - refs/heads/backport-pr-* paths: exclude: - .github diff --git a/tools/devops/automation/scripts/VSTS.psm1 b/tools/devops/automation/scripts/VSTS.psm1 index 92e6014c6649..655df55a6600 100644 --- a/tools/devops/automation/scripts/VSTS.psm1 +++ b/tools/devops/automation/scripts/VSTS.psm1 @@ -242,6 +242,125 @@ class Vsts { class BuildConfiguration { + # list of the default variables we are interested in + static [string[]] $defaultBuildVariables = $( + "BUILD_BUILDID", + "BUILD_BUILDNUMBER", + "BUILD_BUILDURI", + "BUILD_BINARIESDIRECTORY", + "BUILD_DEFINITIONNAME", + "BUILD_REASON", + "BUILD_REPOSITORY_ID", + "BUILD_REPOSITORY_NAME", + "BUILD_REPOSITORY_PROVIDER", + "BUILD_REPOSITORY_URI", + "BUILD_SOURCEBRANCH", + "BUILD_SOURCEBRANCHNAME" + ) + + <# + .SYNOPSIS + Stores the default variables in the current buld as PARENT_BUILD_* in the + configuration object. This allows cascading pipelines to access the configuration + of the pipeline that triggered them. + #> + [void] StoreParentBuildVariables ([PSCustomObject] $configuration) { + Write-Debug ("=> StoreParentBuildVariables") + foreach ($buildVariable in [BuildConfiguration]::defaultBuildVariables) { + $variableName = "PARENT_BUILD_$buildVariable" + $variableValue = [Environment]::GetEnvironmentVariable($buildVariable) + if ($variableValue) { + Write-Debug "$variableName = $variableValue" + $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue + } else { + Write-Debug "$variableName not found." + } + } + } + + <# + .SYNOPSIS + Exports the default variables in the current buld as PARENT_BUILD_* from the + configuration object. + #> + [void] ExportParentBuildVariables ([PSCustomObject] $configuration) { + Write-Debug ("=> ExportParentBuildVariables") + foreach ($buildVariable in [BuildConfiguration]::defaultBuildVariables) { + $variableName = "PARENT_BUILD_$buildVariable" + $variableValue = $configuration.$variableName + if ($variableValue) { + Write-Debug "$variableName = $variableValue" + Write-Host "##vso[task.setvariable variable=$variableName;isOutput=true]$variableValue" + } else { + Write-Debug "$variableName not found." + } + } + } + + static [string[]] $labelsOfInterest = $( + "build-package", + "skip-packages", + "skip-nugets", + "skip-signing", + "run-sample-tests", + "skip-packaged-macos-tests", + "run-packaged-macos-tests", + "skip-api-comparison", + "run-windows-tests", + "skip-windows-tests", + "skip-all-tests" + ) + + [void] SetLabelsFromPR ([PSCustomObject] $prInfo, [bool]$isPR) { + if ($prInfo) { + Write-Deubg "Setting VSTS labels from $($prInfo.labels)" + foreach ($l in [BuildConfiguration]::labelsOfInterest) { + $labelPresent = 1 -eq ($prInfo.labels | Where-Object { $_.name -eq "$l"}).Count + # We need to replace dashes with underscores, because bash can't access an environment variable with a dash in the name. + $lbl = $l.Replace('-', '_') + Write-Host "##vso[task.setvariable variable=$lbl;isOutput=true]$labelPresent" + } + } else { + Write-Debug "Not setting PR labels because there was not info provided." + } + + # set if the build is a PR or not + if ($isPR) { + Write-Host "##vso[task.setvariable variable=prBuild;isOutput=true]True" + } else { + Write-Host "##vso[task.setvariable variable=prBuild;isOutput=true]False" + } + } + + <# + .SYNOPSIS + Retrieve the change id and export it as an enviroment variable. + #> + [string] ExportChangeId ([object] $configuration) { + # This is an interesting step, we do know we are dealing with a PR, but we need the PR id to + # be able to get the labels, the buildSourceBranch follows the pattern: refs/pull/{ChangeId}/merge + # we could use a regexp but then we would have two problems instead of one + $changeId = $null + if ($configuration.PARENT_BUILD_BUILD_SOURCEBRANCH) { + # use the source branch information from the configuration object + $changeId = $configuration.PARENT_BUILD_BUILD_SOURCEBRANCH.Replace("refs/pull/", "").Replace("/merge", "") + } else { + Write-Debug "Retrieving change id from the environment since it could not be found in the config." + # retrieve the change ide form the BUILD_SOURCEBRANCH enviroment variable. + $changeId = "$Env:BUILD_SOURCEBRANCH".Replace("refs/pull/", "").Replace("/merge", "") + } + + # we can always fail (regexp error or not env varaible) + if ($changeId) { + # add a var with the change id, which can be later consumed by some of the old scripts from + # jenkins + Write-Host "##vso[task.setvariable variable=pr_number;isOutput=true]$changeId" + } else { + Write-Debug "Not setting the change id because it could not be calculated." + } + return $changeId + } + [PSCustomObject] Import([string] $configFile) { if (-not (Test-Path -Path $configFile -PathType Leaf)) { throw [System.InvalidOperationException]::new("Configuration file $configFile is missing") @@ -253,31 +372,8 @@ class BuildConfiguration { throw [System.InvalidOperationException]::new("Failed to load configuration file $configFile") } - $defaultBuildVariables = @( - "BUILD_BUILDID", - "BUILD_BUILDNUMBER", - "BUILD_BUILDURI", - "BUILD_BINARIESDIRECTORY", - "BUILD_DEFINITIONNAME", - "BUILD_REASON", - "BUILD_REPOSITORY_ID", - "BUILD_REPOSITORY_NAME", - "BUILD_REPOSITORY_PROVIDER", - "BUILD_REPOSITORY_URI", - "BUILD_SOURCEBRANCH", - "BUILD_SOURCEBRANCHNAME" - ) - - # load the variable name from the parent - foreach ($buildVariable in $defaultBuildVariables) { - $variableName = "PARENT_BUILD_$buildVariable" - $variableValue = $config.$variableName - if ($variableValue) { - Write-Host "##vso[task.setvariable variable=$variableName;isOutput=true]$variableValue" - } else { - Write-Debug "Ignoring variable $variableName" - } - } + # load the variables from the config and export them to be accessable from others + $this.ExportParentBuildVariables($config) $dotnetPlatforms = $config.DOTNET_PLATFORMS.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) Write-Host "##vso[task.setvariable variable=DOTNET_PLATFORMS;isOutput=true]$dotnetPlatforms" @@ -339,6 +435,7 @@ class BuildConfiguration { return $config } + [PSCustomObject] Create([bool] $addTags, [string] $configFile) { # we are going to use a custom object to store all the configuration of the build, this later # will be uploaded as an artifact so that it can be easily shared with the cascade pipelines, we will @@ -349,27 +446,12 @@ class BuildConfiguration { DOTNET_PLATFORMS = "$Env:CONFIGURE_PLATFORMS_DOTNET_PLATFORMS" } - $defaultBuildVariables = @( - "BUILD_BUILDID", - "BUILD_BUILDNUMBER", - "BUILD_BUILDURI", - "BUILD_BINARIESDIRECTORY", - "BUILD_DEFINITIONNAME", - "BUILD_REASON", - "BUILD_REPOSITORY_ID", - "BUILD_REPOSITORY_NAME", - "BUILD_REPOSITORY_PROVIDER", - "BUILD_REPOSITORY_URI", - "BUILD_SOURCEBRANCH", - "BUILD_SOURCEBRANCHNAME" - ) - - # loop over the default build enviroments and add them with a prefix to the configuration objects - foreach ($buildVariable in $defaultBuildVariables) { - $variableName = "PARENT_BUILD_$buildVariable" - $variableValue = [Environment]::GetEnvironmentVariable($buildVariable) - $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue - } + $this.StoreParentBuildVariables($configuration) + + # store if dotnet has been enabled + $variableName = "ENABLE_DOTNET" + $variableValue = [Environment]::GetEnvironmentVariable($variableName) + $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue # For each .NET platform we support, add a INCLUDE_DOTNET_ variable specifying whether that platform is enabled or not. $dotnetPlatforms = $configuration.DOTNET_PLATFORMS.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) @@ -402,6 +484,36 @@ class BuildConfiguration { } } + # store all the variables needed when classic xamarin has been enabled + $configuration | Add-Member -NotePropertyName "INCLUDE_XAMARIN_LEGACY" -NotePropertyValue $Env:INCLUDE_XAMARIN_LEGACY + + # if xamarin legacy has been included, check if we need to include the xamarin sdk for each of the platforms, otherewise it will be + # false for all + $xamarinPlatforms = @("ios", "macos", "tvos", "watchos", "maccatalyst") + if ($configuration.INCLUDE_XAMARIN_LEGACY -eq "true") { + foreach ($platform in $xamarinPlatforms) { + $variableName = "INCLUDE_LEGACY_$($platform.ToUpper())" + $variableValue = [Environment]::GetEnvironmentVariable("$variableName") + $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue + } + } else { + foreach ($platform in $xamarinPlatforms) { + $variableName = "INCLUDE_LEGACY_$($platform.ToUpper())" + $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue "false" + } + } + + # add all the include platforms as well as the nuget os version + foreach ($platform in $xamarinPlatforms) { + $variableName = "INCLUDE_$($platform.ToUpper())" + $variableValue = [Environment]::GetEnvironmentVariable("$variableName") + $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue + + $variableName = "$($platform.ToUpper())__NUGET_OS_VERSION" + $variableValue = [Environment]::GetEnvironmentVariable("$variableName") + $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue + } + # calculate the commit to later share it with the cascade pipelines if ($Env:BUILD_REASON -eq "PullRequest") { $changeId = $configuration.PARENT_BUILD_BUILD_SOURCEBRANCH.Replace("refs/pull/", "").Replace("/merge", "") @@ -420,15 +532,9 @@ class BuildConfiguration { if ($configuration.BuildReason -eq "PullRequest" -or (($configuration.BuildReason -eq "Manual") -and ($configuration.PARENT_BUILD_BUILD_SOURCEBRANCH -eq "merge")) ) { Write-Host "Configuring build from PR." - # This is an interesting step, we do know we are dealing with a PR, but we need the PR id to - # be able to get the labels, the buildSourceBranch follows the pattern: refs/pull/{ChangeId}/merge - # we could use a regexp but then we would have two problems instead of one - $changeId = $configuration.PARENT_BUILD_BUILD_SOURCEBRANCH.Replace("refs/pull/", "").Replace("/merge", "") - - # add a var with the change id, which can be later consumed by some of the old scripts from - # jenkins - Write-Host "##vso[task.setvariable variable=pr_number;isOutput=true]$changeId" + # retrieve the PR data to be able to fwd the labels from github + $changeId = $this.ExportChangeId($configuration) $prInfo = Get-GitHubPRInfo -ChangeId $changeId Write-Host $prInfo @@ -446,29 +552,11 @@ class BuildConfiguration { $tags.Add("$ref") # set output variables based on the git labels - $labelsOfInterest = @( - "build-package", - "skip-packages", - "skip-nugets", - "skip-signing", - "run-sample-tests", - "skip-packaged-macos-tests", - "run-packaged-macos-tests", - "skip-api-comparison", - "run-windows-tests", - "skip-windows-tests", - "skip-all-tests" - ) - - foreach ($l in $labelsOfInterest) { - $labelPresent = 1 -eq ($prInfo.labels | Where-Object { $_.name -eq "$l"}).Count - # We need to replace dashes with underscores, because bash can't access an environment variable with a dash in the name. - $lbl = $l.Replace('-', '_') - Write-Host "##vso[task.setvariable variable=$lbl;isOutput=true]$labelPresent" - } + $this.SetLabelsFromPR($prInfo, $true) - Write-Host "##vso[task.setvariable variable=prBuild;isOutput=true]True" } else { + # thee are not labels to add in a CI build and we will set the build as a ci build. + $this.SetLabelsFromPR($null, $false) if ($tags.Contains("cronjob")) { # debug so that we do know why we do not have ciBuild Write-Debug "Skipping the tag 'ciBuild' because we are dealing with a translation build." diff --git a/tools/devops/automation/templates/build/api-diff-build-and-detect.yml b/tools/devops/automation/templates/build/api-diff-build-and-detect.yml index 678669c58018..776f708bb4b0 100644 --- a/tools/devops/automation/templates/build/api-diff-build-and-detect.yml +++ b/tools/devops/automation/templates/build/api-diff-build-and-detect.yml @@ -61,6 +61,6 @@ steps: displayName: 'Publish change detection artifact' inputs: targetPath: '$(Build.ArtifactStagingDirectory)/change-detection/change-detection.zip' - artifactName: ${{ parameters.uploadPrefix }}change-detection + artifactName: ${{ parameters.uploadPrefix }}change-detection-$(System.StageAttempt) condition: succeededOrFailed() # we always want to upload the zip as an artifact continueOnError: true diff --git a/tools/devops/automation/templates/build/api-diff-process-results.yml b/tools/devops/automation/templates/build/api-diff-process-results.yml index eeb4b050db0f..a73bcb9e572f 100644 --- a/tools/devops/automation/templates/build/api-diff-process-results.yml +++ b/tools/devops/automation/templates/build/api-diff-process-results.yml @@ -41,7 +41,7 @@ steps: - task: DownloadPipelineArtifact@2 displayName: 'Download change detection artifacts' inputs: - patterns: '${{ parameters.uploadPrefix }}change-detection/change-detection.zip' + patterns: '${{ parameters.uploadPrefix }}change-detection-$(System.StageAttempt)/change-detection.zip' allowFailedBuilds: true path: $(System.DefaultWorkingDirectory)/Artifacts @@ -49,7 +49,7 @@ steps: - task: ExtractFiles@1 displayName: 'Decompress change detection artifacts' inputs: - archiveFilePatterns: '$(System.DefaultWorkingDirectory)/Artifacts/${{ parameters.uploadPrefix }}change-detection/change-detection.zip' + archiveFilePatterns: '$(System.DefaultWorkingDirectory)/Artifacts/${{ parameters.uploadPrefix }}change-detection-$(System.StageAttempt)/change-detection.zip' destinationFolder: '$(System.DefaultWorkingDirectory)/change-detection' # Upload the change detection results to vsdrops diff --git a/tools/devops/automation/templates/common/configure.yml b/tools/devops/automation/templates/common/configure.yml index 3d7d23108915..e909e535fe88 100644 --- a/tools/devops/automation/templates/common/configure.yml +++ b/tools/devops/automation/templates/common/configure.yml @@ -81,7 +81,6 @@ steps: # compress the json to remove any newlines, because we can't set the variable below if the json has any newlines Write-Host "$testMatrix" $testMatrix = $testMatrix | ConvertFrom-Json | ConvertTo-Json -Compress - Write-Host "##vso[task.setvariable variable=TEST_MATRIX;isOutput=true]$testMatrix" # update the config file so that we do not recalculate the matrix in other pipelines Edit-BuildConfiguration -ConfigKey TEST_MATRIX -ConfigValue $testMatrix -ConfigFile $Env:CONFIG_PATH #CONFIG_PATH diff --git a/tools/devops/automation/templates/common/load_configuration.yml b/tools/devops/automation/templates/common/load_configuration.yml new file mode 100644 index 000000000000..5ecac652b11f --- /dev/null +++ b/tools/devops/automation/templates/common/load_configuration.yml @@ -0,0 +1,106 @@ +# yamllint disable rule:line-length +# This job will parse all the labels present in a PR, will set +# the tags for the build AND will set a number of configuration +# variables to be used by the rest of the projects +parameters: + + - name: uploadArtifacts + type: boolean + default: false + + - name: use1ES + type: boolean + default: false + + - name: repositoryAlias + type: string + default: self + + - name: commit + type: string + default: HEAD + + - name: uploadPrefix + type: string + default: '$(MaciosUploadPrefix)' + + - name: testConfigurations + type: object + default: [] + + - name: supportedPlatforms + type: object + default: [] + + - name: testsLabels + type: string + default: '' + + - name: statusContext + type: string + default: '' + +steps: + - template: checkout.yml + parameters: + isPR: true + repositoryAlias: ${{ parameters.repositoryAlias }} + commit: ${{ parameters.commit }} + + - download: macios + displayName: Download Build Config + artifact: build-configuration + + - pwsh: | + Get-ChildItem -Path "$(Pipeline.Workspace)/macios" -Recurse -Force + displayName: 'Display downloads' + timeoutInMinutes: 5 + + - bash: ./xamarin-macios/tools/devops/automation/scripts/bash/configure-platforms.sh + name: configure_platforms + displayName: 'Configure platforms' + + - pwsh: | + Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1 + $jsonPath = Join-Path -Path "$(Build.ArtifactStagingDirectory)" -ChildPath "configuration.json" + Write-Host "##vso[task.setvariable variable=CONFIG_PATH]$jsonPath" + New-BuildConfiguration -ConfigFile $jsonPath + env: + GITHUB_TOKEN: $(GitHub.Token) + ACCESSTOKEN: $(AzDoBuildAccess.Token) + name: labels + displayName: 'Configure build' + + - bash: ./xamarin-macios/tools/devops/automation/scripts/bash/configure-decisions.sh + name: decisions + displayName: 'Make decisions' + + - pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 + displayName: 'Show Environment' + + - pwsh: | + Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1 + # load the configuration files and set the required variables to be used in the later stages + $configPath = Get-ChildItem -Path "$(Pipeline.Workspace)/macios/build-configuration/configuration.json" -Recurse -Force + $config = Import-BuildConfiguration -ConfigFile $configPath + $testMatrix = $config.TEST_MATRIX + Write-Host "##vso[task.setvariable variable=TEST_MATRIX;isOutput=true]$testMatrix" + name: test_matrix + displayName: 'Create tests strategy matrix' + + # upload config to be consumed later + - ${{ if eq(parameters.uploadArtifacts, true) }}: + - ${{ if eq(parameters.use1ES, true) }}: + - task: 1ES.PublishPipelineArtifact@1 + displayName: 'Publish Artifact: configuration.json' + inputs: + path: '$(Build.ArtifactStagingDirectory)/configuration.json' + artifact: '${{ parameters.uploadPrefix }}build-configuration' + continueOnError: true + - ${{ else }}: + - task: PublishPipelineArtifact@1 + displayName: 'Publish Artifact: configuration.json' + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/configuration.json' + artifactName: '${{ parameters.uploadPrefix }}build-configuration' + continueOnError: true diff --git a/tools/devops/automation/templates/mac/build.yml b/tools/devops/automation/templates/mac/build.yml index 39157d705e5d..94ca35e2b3ba 100644 --- a/tools/devops/automation/templates/mac/build.yml +++ b/tools/devops/automation/templates/mac/build.yml @@ -191,7 +191,7 @@ steps: -GithubFailureCommentFile "$Env:GITHUB_FAILURE_COMMENT_FILE" -StatusContext "${{ parameters.statusContext }}" displayName: 'Run tests' - timeoutInMinutes: 60 + timeoutInMinutes: 90 ${{ if not(parameters.isPR) }}: retryCountOnTaskFailure: ${{ parameters.retryCount }} env: diff --git a/tools/devops/automation/templates/tests-stage.yml b/tools/devops/automation/templates/tests-stage.yml index 64d3ad47565b..904ede195003 100644 --- a/tools/devops/automation/templates/tests-stage.yml +++ b/tools/devops/automation/templates/tests-stage.yml @@ -290,7 +290,7 @@ stages: BRANCH_NAME: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ] steps: - - template: common/configure.yml + - template: common/load_configuration.yml parameters: repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} diff --git a/tools/devops/provision-brew-packages.csx b/tools/devops/provision-brew-packages.csx index 256a4c25bf57..291ec5e294cd 100644 --- a/tools/devops/provision-brew-packages.csx +++ b/tools/devops/provision-brew-packages.csx @@ -2,9 +2,6 @@ BrewPackages ( "shellcheck", "yamllint", "cmake", - "autoconf", - "automake", - "libtool", "p7zip", "msitools", "wget", diff --git a/tools/dotnet-linker/Steps/CollectUnmarkedMembers.cs b/tools/dotnet-linker/Steps/CollectUnmarkedMembers.cs index 0e257297ead4..0fef0c7c4d86 100644 --- a/tools/dotnet-linker/Steps/CollectUnmarkedMembers.cs +++ b/tools/dotnet-linker/Steps/CollectUnmarkedMembers.cs @@ -26,6 +26,12 @@ protected override void Process (TypeDefinition type) if (!Annotations.IsMarked (type)) LinkContext.AddLinkedAwayType (type); + if (type.IsInterface && + Configuration.DerivedLinkContext.App.Optimizations.RegisterProtocols == true && + type.HasCustomAttribute (LinkContext, Namespaces.Foundation, "ProtocolAttribute")) { + Configuration.DerivedLinkContext.StoreProtocolMethods (type); + } + if (type.HasInterfaces) { foreach (var iface in type.Interfaces) { if (Annotations.IsMarked (iface)) diff --git a/tools/dotnet-linker/Steps/PreMarkDispatcher.cs b/tools/dotnet-linker/Steps/PreMarkDispatcher.cs index fa091bf17865..8970681eb1eb 100644 --- a/tools/dotnet-linker/Steps/PreMarkDispatcher.cs +++ b/tools/dotnet-linker/Steps/PreMarkDispatcher.cs @@ -7,6 +7,7 @@ namespace Xamarin.Linker.Steps { class PreMarkDispatcher : SubStepsDispatcher { public PreMarkDispatcher () : base (new BaseSubStep [] { + new SetBeforeFieldInitStep (), new CollectUnmarkedMembersSubStep (), new StoreAttributesStep () }) diff --git a/tools/dotnet-linker/Steps/SetBeforeFieldInitStep.cs b/tools/dotnet-linker/Steps/SetBeforeFieldInitStep.cs new file mode 100644 index 000000000000..22f70f051ef0 --- /dev/null +++ b/tools/dotnet-linker/Steps/SetBeforeFieldInitStep.cs @@ -0,0 +1,55 @@ +using Mono.Linker.Steps; +using Xamarin.Linker; + +using Mono.Cecil; +using Mono.Tuner; + +#nullable enable + +namespace Xamarin.Linker.Steps { + public class SetBeforeFieldInitStep : ConfigurationAwareSubStep { + protected override string Name { get; } = "Set BeforeFieldInit"; + protected override int ErrorCode { get; } = 2380; + + public override SubStepTargets Targets { + get { + return SubStepTargets.Type; + } + } + + protected override void Process (TypeDefinition type) + { + // If we're registering protocols, we want to remove the static + // constructor on the protocol interface, because it's not needed + // (because we've removing all the DynamicDependency attributes + // from the cctor). + // + // However, just removing the static constructor from the type + // causes problems later on in the trimming process, so we want + // the trimmer to just not mark it. + // + // The trimmer marks it, because it has a static constructor, so + // we're in a bit of a cyclic dependency here. + // + // This is complicated by a few facts: + // - When we optimize the cctor (i.e. removing the + // DynamicDependency attributes), the cctor is already marked. + // - Adding a MarkHandler that processes types doesn't work + // either, because it may be called after the cctor is marked: + // https://github.com/dotnet/runtime/blob/6177a9f920861900681cfda2b6cc66ac3557e93b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs#L1928-L1952 + // + // So this is a pre-mark step that just sets + // IsBeforeFieldInit=true for interfaces we want trimmed away by + // the linker. + + if (Configuration.DerivedLinkContext.App.Optimizations.RegisterProtocols != true) + return; + + if (!type.IsBeforeFieldInit && type.IsInterface && type.HasMethods) { + var cctor = type.GetTypeConstructor (); + if (cctor is not null && cctor.IsBindingImplOptimizableCode (LinkContext)) + type.IsBeforeFieldInit = true; + } + } + } +} diff --git a/tools/linker/CoreOptimizeGeneratedCode.cs b/tools/linker/CoreOptimizeGeneratedCode.cs index 0e49ce76e68d..356e3289ae67 100644 --- a/tools/linker/CoreOptimizeGeneratedCode.cs +++ b/tools/linker/CoreOptimizeGeneratedCode.cs @@ -755,6 +755,9 @@ protected override void Process (MethodDefinition method) return; // nothing else to do here. } + if (ProcessProtocolInterfaceStaticConstructor (method)) + return; + var instructions = method.Body.Instructions; for (int i = 0; i < instructions.Count; i++) { var ins = instructions [i]; @@ -1191,6 +1194,19 @@ static Instruction GetPreviousSkippingNops (Instruction ins) return ins; } + static Instruction SkipNops (Instruction ins) + { + if (ins is null) + return null; + + while (ins.OpCode == OpCodes.Nop) { + if (ins.Next is null) + return null; + ins = ins.Next; + } + return ins; + } + int ProcessIsARM64CallingConvention (MethodDefinition caller, Instruction ins) { const string operation = "inline Runtime.IsARM64CallingConvention"; @@ -1345,5 +1361,66 @@ MethodReference GetBlockLiteralConstructor (MethodDefinition caller, Instruction } return caller.Module.ImportReference (block_ctor_def); } + + bool ProcessProtocolInterfaceStaticConstructor (MethodDefinition method) + { + // The static cctor in protocol interfaces exists only to preserve the protocol's members, for inspection by the registrar(s). + // If we're registering protocols, then we don't need to preserve protocol members, because the registrar + // already knows everything about it => we can remove the static cctor. + + if (!(method.DeclaringType.IsInterface && method.DeclaringType.IsInterface && method.IsStatic && method.IsConstructor && method.HasBody)) + return false; + + if (Optimizations.RegisterProtocols != true) { + Driver.Log (4, "Did not optimize static constructor in the protocol interface {0}: the 'register-protocols' optimization is disabled.", method.DeclaringType.FullName); + return false; + } + + if (!method.DeclaringType.HasCustomAttributes || !method.DeclaringType.CustomAttributes.Any (v => v.AttributeType.Is ("Foundation", "ProtocolAttribute"))) { + Driver.Log (4, "Did not optimize static constructor in the protocol interface {0}: no Protocol attribute found.", method.DeclaringType.FullName); + return false; + } + + var ins = SkipNops (method.Body.Instructions.First ()); + if (ins is null) { + ErrorHelper.Show (ErrorHelper.CreateWarning (LinkContext.App, 2112, method, ins, Errors.MX2112_A /* Could not optimize the static constructor in the interface {0} because it did not have the expected instruction sequence (found end of method too soon). */, method.DeclaringType.FullName)); + return false; + } else if (ins.OpCode != OpCodes.Ldnull) { + ErrorHelper.Show (ErrorHelper.CreateWarning (LinkContext.App, 2112, method, ins, Errors.MX2112_B /* Could not optimize the static constructor in the interface {0} because it had an unexpected instruction {1} at offset {2}. */, method.DeclaringType.FullName, ins.OpCode, ins.Offset)); + return false; + } + + ins = SkipNops (ins.Next); + var callGCKeepAlive = ins; + if (ins is null) { + ErrorHelper.Show (ErrorHelper.CreateWarning (LinkContext.App, 2112, method, ins, Errors.MX2112_A /* Could not optimize the static constructor in the interface {0} because it did not have the expected instruction sequence (found end of method too soon). */, method.DeclaringType.FullName)); + return false; + } else if (callGCKeepAlive.OpCode != OpCodes.Call || !(callGCKeepAlive.Operand is MethodReference methodOperand) || methodOperand.Name != "KeepAlive" || !methodOperand.DeclaringType.Is ("System", "GC")) { + ErrorHelper.Show (ErrorHelper.CreateWarning (LinkContext.App, 2112, method, ins, Errors.MX2112_B /* Could not optimize the static constructor in the interface {0} because it had an unexpected instruction {1} at offset {2}. */, method.DeclaringType.FullName, ins.OpCode, ins.Offset)); + return false; + } + + ins = SkipNops (ins.Next); + if (ins is null) { + ErrorHelper.Show (ErrorHelper.CreateWarning (LinkContext.App, 2112, method, ins, Errors.MX2112_A /* Could not optimize the static constructor in the interface {0} because it did not have the expected instruction sequence (found end of method too soon). */, method.DeclaringType.FullName)); + return false; + } else if (ins.OpCode != OpCodes.Ret) { + ErrorHelper.Show (ErrorHelper.CreateWarning (LinkContext.App, 2112, method, ins, Errors.MX2112_B /* Could not optimize the static constructor in the interface {0} because it had an unexpected instruction {1} at offset {2}. */, method.DeclaringType.FullName, ins.OpCode, ins.Offset)); + return false; + } + + ins = SkipNops (ins.Next); + if (ins is not null) { + ErrorHelper.Show (ErrorHelper.CreateWarning (LinkContext.App, 2112, method, ins, Errors.MX2112_B /* Could not optimize the static constructor in the interface {0} because it had an unexpected instruction {1} at offset {2}. */, method.DeclaringType.FullName, ins.OpCode, ins.Offset)); + return false; + } + + // We can just remove the entire method, however that confuses the linker later on, so just empty it out and remove all the attributes. + Driver.Log (4, "Optimized static constructor in the protocol interface {0} (static constructor was cleared and custom attributes removed)", method.DeclaringType.FullName); + method.Body.Instructions.Clear (); + method.Body.Instructions.Add (Instruction.Create (OpCodes.Ret)); + method.CustomAttributes.Clear (); + return true; + } } } diff --git a/tools/mtouch/Errors.designer.cs b/tools/mtouch/Errors.designer.cs index 8ff0567c53d0..023c6f0a6661 100644 --- a/tools/mtouch/Errors.designer.cs +++ b/tools/mtouch/Errors.designer.cs @@ -3923,6 +3923,24 @@ public static string MX2111 { } } + /// + /// Looks up a localized string similar to Could not optimize the static constructor in the interface {0} because it did not have the expected instruction sequence (found end of method too soon).. + /// + public static string MX2112_A { + get { + return ResourceManager.GetString("MX2112_A", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not optimize the static constructor in the interface {0} because it had an unexpected instruction {1} at offset {2}.. + /// + public static string MX2112_B { + get { + return ResourceManager.GetString("MX2112_B", resourceCulture); + } + } + /// /// Looks up a localized string similar to Could not {0} the assembly '{1}' /// . diff --git a/tools/mtouch/Errors.resx b/tools/mtouch/Errors.resx index e68e28c5148a..a909ea87a58c 100644 --- a/tools/mtouch/Errors.resx +++ b/tools/mtouch/Errors.resx @@ -1327,6 +1327,13 @@ + + Could not optimize the static constructor in the interface {0} because it did not have the expected instruction sequence (found end of method too soon). + + + + Could not optimize the static constructor in the interface {0} because it had an unexpected instruction {1} at offset {2}. +