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

12983 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 15c17ddece
[msbuild] Implement proper MSBuild logging in FileCopier. (#14176)
Fixes https://github.com/xamarin/xamarin-macios/issues/12422.
Fixes https://github.com/xamarin/xamarin-macios/issues/13697.
Fixes https://github.com/xamarin/xamarin-macios/issues/14157.
2022-02-24 16:51:49 +01:00
Rolf Bjarne Kvinge bd97933b60
[runtime] Remove ObjCRuntime.nfloat in favor of System.Runtime.InteropServices.NFloat. (#14197)
* Remove ObjCRuntime.nfloat (in favor of   System.Runtime.InteropServices.NFloat).
* Automatically add a reference to the System.Runtime.InteropServices.Internal
  package, so that developers get the new NFloat API (with operators) we've
  added post .NET 6 (but don't do this for .NET 7).
* Automatically add a global using alias for
  System.Runtime.InteropServices.NFloat -> nfloat. This is not behind the
  usual `ImplicitUsings` condition our other implicit usings are, because
  they're off by default for existing projects, and the main target for the
  global using alias for nfloat is upgraded projects.
* Automatically generate a global using alias (like above) in the generator
  for all code the generator compiles.
* Update xtro entries to reference System.Runtime.InteropServices.NFloat
  instead of ObjCRuntime.nfloat.
* Add a workaround for a hopefully temporary issue with .NET/CoreCLR where the
  wrong runtime pack is selected otherwise (without the new NFloat API, so
  nothing works at runtime).

Ref: https://github.com/xamarin/xamarin-macios/issues/13087
2022-02-24 16:51:12 +01:00
Rolf Bjarne Kvinge 3b617adb0f
[CloudKit] Remove API that no longer exists in the headers from .NET. (#14228) 2022-02-24 08:20:26 +01:00
Rolf Bjarne Kvinge 2c13696d8b
[VideoToolbox] Remove VTDecompressionSession.Create overload requiring manual reference counting. (#14218)
We already have a better overload that does not need manual reference counting.
2022-02-23 23:25:55 +01:00
Rolf Bjarne Kvinge d9a2e9d3b2
[CoreGraphics] Remove a CGPDFOperatorTable.SetCallback overload in .NET. (#14219)
Remove the CGPDFOperatorTable.SetCallback overload that takes a normal managed
delegate, because on platforms that are AOT'ed, this delegate must point to a
static function with the MonoPInvokeCallback attribute, and if you don't
follow this requirement, you'll either get an exception at runtime (which is
not very nice to the app developer) or make the AOT compiler crash (which is a
completely different level of not being nice to developers).

In .NET, we already have an overload that takes an unmanaged function pointer,
where these requirements are enforced by the C# compiler, so just use that
instead.
2022-02-23 23:24:40 +01:00
Rolf Bjarne Kvinge 3b655ec5ed
[src] Remove dead NET code inside !NET blocks. (#14227) 2022-02-23 23:22:36 +01:00
Rolf Bjarne Kvinge 20ceeae4c4
[Foundation] Hide obsolete NSString/NSArray API with CoreFoundation replacements. (#14212) 2022-02-23 23:21:46 +01:00
Sebastien Pouliot e82711f73e
[corefoundation] Optimize `CFString` creation (#12736)
* Add fast path if string is empty (`length == 0`)
* Add fast path (less allocations) for short string (`stackalloc`)
* Use `Marshal.AllocHGlobal`
	* we were the only consumer of `Marshal.AllocCoTaskMem` and `FreeCoTaskMem` (inside most apps) so those symbols can now be removed
	* `Marshal.AllocCoTaskMem` simply calls `AllocHGlobal` (with some extra casts) so it does not really have any other impact

* Add a few `CFString.FromHandle`` performance tests

To cover cases for

* `nil` which returns `null`
* `128` characters, which is the limit for `stackalloc`
* `129` characters, which is just over the limit for `stackalloc`

**Expectations**

* `empty` should be faster, since it now returns earlier
* `short_*` and `stackalloc_limit` should be a bit faster as they use `stackalloc`
* `allochglobal` and `long_string` should be (nearly) identical

**Before**

|              Method |             name |         Mean |       Error |     StdDev |
|-------------------- |----------------- |-------------:|------------:|-----------:|
| CFString_FromString |     allochglobal |   547.765 ns | 245.5782 ns | 13.4610 ns |
| CFString_FromString |            empty |   377.983 ns |   6.7926 ns |  0.3723 ns |
| CFString_FromString |      long_string | 5,480.664 ns | 264.9473 ns | 14.5227 ns |
| CFString_FromString |              nil |     4.848 ns |   0.0412 ns |  0.0023 ns |
| CFString_FromString |      short_7bits |   442.096 ns |  30.4907 ns |  1.6713 ns |
| CFString_FromString |     short_accent |   221.221 ns |   2.2069 ns |  0.1210 ns |
| CFString_FromString |      short_emoji |   221.870 ns |   2.4471 ns |  0.1341 ns |
| CFString_FromString |    short_unicode |   217.954 ns |   1.8771 ns |  0.1029 ns |
| CFString_FromString | stackalloc_limit |   484.019 ns |   6.3940 ns |  0.3505 ns |


**After**

|              Method |             name |         Mean |       Error |     StdDev |
|-------------------- |----------------- |-------------:|------------:|-----------:|
| CFString_FromString |     allochglobal |   554.028 ns | 317.1811 ns | 17.3858 ns |
| CFString_FromString |            empty |    95.442 ns |   7.6434 ns |  0.4190 ns |
| CFString_FromString |      long_string | 5,468.565 ns | 251.2252 ns | 13.7705 ns |
| CFString_FromString |              nil |     3.299 ns |   0.0229 ns |  0.0013 ns |
| CFString_FromString |      short_7bits |   352.567 ns |  25.7539 ns |  1.4117 ns |
| CFString_FromString |     short_accent |   221.132 ns |   0.9760 ns |  0.0535 ns |
| CFString_FromString |      short_emoji |   222.557 ns |   4.5978 ns |  0.2520 ns |
| CFString_FromString |    short_unicode |   216.375 ns |   5.1619 ns |  0.2829 ns |
| CFString_FromString | stackalloc_limit |   427.663 ns |  77.9610 ns |  4.2733 ns |
2022-02-23 20:49:10 +01:00
Sebastien Pouliot c918142101
[objcruntime] Fix some `IntPtr` -> `NativeHandle` inside `Class` (#14174)
* Using `NativeHandle` avoids implicit casts [1]
* Do not expose `IntPtr` as the type for the `SuperClass` handle

[1] likely not an issue with JIT/AOT optimization, less sure for the
interpreter. No harm in not having those in the product assembly.
2022-02-23 20:45:43 +01:00
Rolf Bjarne Kvinge c0074d0c79
[dotnet] Hardcode the version band instead of inferring it. (#14225) 2022-02-23 20:43:27 +01:00
TJ Lambert b2cc6d9c2e
[assetslibrary] Add nullability to (generated and manual) bindings (#14222)
Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
2022-02-23 11:29:58 -06:00
github-actions[bot] 7af9f78ae4
[Localization] Pulling New Localization Translations 1877675209 (#14206)
* LEGO: Merge pull request 12848

LEGO: Merge pull request 12848

* LEGO: Merge pull request 12923

LEGO: Merge pull request 12923

* LEGO: Merge pull request 13022

LEGO: Merge pull request 13022

* LEGO: Merge pull request 13612

LEGO: Merge pull request 13612

* LEGO: Merge pull request 13638

LEGO: Merge pull request 13638

* LEGO: Merge pull request 14101

LEGO: Merge pull request 14101

* LEGO: check in for Localization to temporary branch.

Co-authored-by: csigs <csigs@users.noreply.github.com>
Co-authored-by: CSIGS <csigs@outlook.com>
2022-02-23 11:25:19 -06:00
Rolf Bjarne Kvinge 4fd770c3c4
[msbuild/generator] Pass .NET's C# compiler to bgen to use. Fixes #12922. (#14192)
We can't execute mono's C# compiler when using .NET, so we need to tell bgen
where csc is in that case.

Fixes https://github.com/xamarin/xamarin-macios/issues/12922.
2022-02-23 09:36:43 +01:00
Rolf Bjarne Kvinge 05398b5ff3
[src] Remove .NET availability attributes for files that are processed by the generator. (#14207) 2022-02-23 08:22:41 +01:00
Rolf Bjarne Kvinge 166f42b987
[dotnet] Name all templates as preview templates. (#14210)
All templates except one were named "... (Preview)".

Now the one outlier has joined the rest.
2022-02-23 08:19:23 +01:00
Rolf Bjarne Kvinge cff92006d5
[src] For .NET remove misc API that's either unusable or a an obsolete simple wrapper around other functional API. (#14209) 2022-02-23 08:19:08 +01:00
Rolf Bjarne Kvinge 101e3346c9
[UIKit] Hide the obsolete UIApplication.Main overload. (#14217)
Hide the obsolete UIApplication.Main overload that takes string parameters
from intellisense. This overload is used *a lot*, so it's not worth it to
remove it, since it would break a lot of user code.
2022-02-23 08:16:37 +01:00
Rolf Bjarne Kvinge 5acea1a41f
[runtime] Ask curl to fail (--fail) if fetching the URL fails for coreclrhost.h. (#14216)
This fixes an issue where the build would continue if the server in question
serves an error page (and eventually fail with weird errors because the error
page wouldn't be valid C code).
2022-02-23 08:10:51 +01:00
Sebastien Pouliot 868dad9bbd
Reduce string duplication in the platform assemblies (part 1) (#14191)
The size of unicode strings for the minimal MySingleView.app (.net
version) goes from 6315 to 5171 characters (each being 2 bytes).

Part of the work to solve/minimize https://github.com/xamarin/xamarin-macios/issues/14188

This also removes the recent `Console.WriteLine` and replace it
with a call to `NSLog` so `System.Console.dll` is not part of the
final app bundle (size regression).

Fixes https://github.com/xamarin/xamarin-macios/issues/14182
2022-02-22 16:39:45 +01:00
Rolf Bjarne Kvinge 66dcb94e1f
[AVFoundation] Simplify code behind + api definition for AVCaptureConnection. (#14199)
* Remove the code behind for AVCaptureConnection.SupportsVideoMinFrameDuration
  and AVCaptureConnection.SupportsVideoMaxFrameDuration. The codebehind looks like
  a workaround for Apple renaming the selector, but from history it looks like that
  happened before the earliest version of iOS we support today, so this can be expressed
  in an api definition now without any code behind.
* Add these fields to macOS, where they're not even deprecated (like they are on
  other platforms).
* Remove conditional code in api definition, and distribute [No*] attributes as
  required.
* Remove the AVCaptureConnection.AudioChannels property from .NET, it doesn't do
  anything useful.
2022-02-21 20:58:47 +01:00
Rolf Bjarne Kvinge 08f38b3f90
[AVFoundation] AVAudioUnitManufacturerNameApple and AVAudioUnitType aren't deprecated neither in headers nor documentation. (#14198) 2022-02-21 14:28:08 +01:00
TJ Lambert 188a35d879
[ApiDiffs] More renaming to enable ApiDiffs (#14187)
There was a large change to rename a lot of our Xamarin assemblies to Microsoft
ie) Xamarin.iOS -> Microsoft.iOS

There is a mismatch with some of the prerequisites in our tools/apidiff/Makefile where dependencies 
are looking for ...Microsoft.iOS... but they are still named ...Xamarin.iOS...

This PR takes any remaining "Xamarin" names and changes them to "Microsoft" for all dotnet related rules.
We will also change other dotnet rules to use the new naming convention of "macOS" and "tvOS"

The only exception is to the Xamarin.PLATFORM.dll's coming from the zip - those remain as Xamarin.iOS.dll

We should expect to see the gists showing up in ApiDiffs from this PR!

Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
2022-02-21 10:39:07 +01:00
Rolf Bjarne Kvinge 96c32e380e
[msbuild/dotnet] Make codesigning createdump work in universal apps. Fixes #14155. (#14196)
We don't sign each rid-specific bundle, but we sign the final merged app bundle instead.
This means that we must store the list of files to codesign from the rid-specific
build and load those lists before running codesign on the merged app bundle.

https://github.com/xamarin/xamarin-macios/issues/14155.
2022-02-21 08:24:09 +01:00
Rolf Bjarne Kvinge f83857638d
[tests/msbuild] Use full path to binlogs and executables. (#14195)
This way it's easier to copy-paste the path to the these files from terminal output
and open/run it (with a relative/partial path you'll need to know the current directory,
which is just an annoying thing to figure out sometimes).
2022-02-21 08:02:23 +01:00
dotnet-maestro[bot] 2d2650605a
Update dependencies from https://github.com/dotnet/installer build 20220218.1 (#14194)
Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.300-preview.22116.1 -> To Version 6.0.300-preview.22118.1

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-1.21519.4 -> To Version 6.0.200-1.22069.1 (parent: Microsoft.Dotnet.Sdk.Internal

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2022-02-21 07:58:44 +01:00
Rolf Bjarne Kvinge 74d947e72f
[CoreGraphics] Remove CGColorConversionInfo and CGColorConversionInfoTriple from .NET. (#14200)
These types aren't used anywhere in the exposed API, nor do they do anything
useful today.
2022-02-19 08:45:19 -05:00
Alex Soto 72aa44989b
Update SignList.xml to look for our new Microsoft.* assemblies 2022-02-18 11:36:52 -05:00
Manuel de la Pena a6ca5917b6
[CI] If we disabled the api diff do not event spawn a job. (#13875) 2022-02-18 11:02:53 -05:00
Manuel de la Pena 0fae15ebf9
[CI] Allow several builds to upload binlogs and do not fail. (#14172) 2022-02-18 10:59:49 -05:00
Rolf Bjarne Kvinge 639675dd7e
[msbuild] Don't report 'unable to open object file:' from dsymutil as warnings. (#14179)
Just log these messages as normal messages, because they're not very actionable.

Ref: #13652.
2022-02-18 16:35:51 +01:00
Rolf Bjarne Kvinge 21d7dd8de3
[msbuild] Move debug-related targets to shared code. (#14180) 2022-02-18 16:35:28 +01:00
Rolf Bjarne Kvinge 2140d46327
[monotouch-test] The RuntimeTest.ResurrectedObjectsDisposedTest test seems to be passing everywhere in .NET now. (#14175) 2022-02-18 16:34:58 +01:00
Sebastien Pouliot d658c1d209
[net][objcruntime] Remove `DisposableObject.ClearHandle` (#14161)
It is not really needed. The only caller `SKIndex` was already clearing
the handle by calling `Dispose(bool)` which called `ClearHandle`.

If it really becomes needed then it can be reintroduced in the future.
2022-02-18 13:20:22 +01:00
Sebastien Pouliot e6e4ddbab2
[appcompare] Remove old/local copy of the tool and update comparison documentation (#14190)
There's a newer version of the tool availble as a (tool)
[nuget](https://www.nuget.org/packages/appcompare/)

The nicest part, for this use case, is that it can map renamed files
between the two app bundles being compared.
[Example](https://gist.github.com/spouliot/68a43a4f514315d52b35446016ba0d2e)
2022-02-18 13:04:28 +01:00
Sebastien Pouliot d1f8cc8a58
[net] Fix the product/assemblies names in error messages (#14189)
Found while looking [1] at the strings inside the assemblies.

The diff for before/after the PR is

```diff
-Version mismatch between the native Xamarin.iOS runtime and Xamarin.iOS.dll. Please reinstall Xamarin.iOS.
+Version mismatch between the native Microsoft.iOS runtime and Microsoft.iOS.dll. Please reinstall Microsoft.iOS.
```

[1] https://github.com/xamarin/xamarin-macios/issues/14188
2022-02-18 10:17:37 +01:00
Sebastien Pouliot 878d2b66da
[objcruntime] Use more direct calls in `Runtime` (#14186)
so the linker can remove more overloads from most/small applications.

In case of `ErrorHelper.CreateError` then the API was already accepting a
`null` exception so the extra code was not needed.
2022-02-18 07:52:41 +01:00
Sebastien Pouliot e636eabc3c
[objcruntime] Small simplification of `ErrorHelper.CollectExceptions` (#14185)
Simplified code and reduced visibility.
2022-02-18 07:51:13 +01:00
Sebastien Pouliot 1ea563d467
[foundation] Fix some `IntPtr` -> `NativeHandle` inside `NSObject` (#14183)
Using NativeHandle avoids implicit casts [1]

[1] likely not an issue with JIT/AOT optimization, less sure for the
interpreter. No harm in not having those in the product assembly.
2022-02-18 07:50:15 +01:00
dotnet-maestro[bot] 1273190e5f
[main] Update dependencies from dotnet/installer (#14156)
* Update dependencies from https://github.com/dotnet/installer build 20220211.11

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.201-servicing.22111.7 -> To Version 6.0.300-preview.22111.11

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.200-1.22069.1 -> To Version 6.0.100-1.21519.4 (parent: Microsoft.Dotnet.Sdk.Internal

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

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.201-servicing.22111.7 -> To Version 6.0.300-preview.22116.1

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.200-1.22069.1 -> To Version 6.0.100-1.21519.4 (parent: Microsoft.Dotnet.Sdk.Internal

* Use the preview csc.

* Hardcode the toolchain version band to 6.0.200 for now.

* Bump dotnet/runtime to get nfloat changes.

* Add a dependency on Microsoft.NET.Workload.Emscripten.Manifest-6.0.100, and use it.

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-02-17 15:29:41 +01:00
TJ Lambert 4aaaf63e92
[accelerate] Add nullability to (generated and manual) bindings (#14135)
* Changing to better null exception handling

* using is null and is not null

* Enable nullability

* revert throw null changes

* Accidentally included this file, so removing now

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2022-02-16 18:18:23 -06:00
Rolf Bjarne Kvinge e25163f573
[.NET] Rename our product assemblies. Fixes #13748. (#13847)
Rename our product assemblies to:

* Microsoft.iOS.dll
* Microsoft.tvOS.dll
* Microsoft.macOS.dll
* Microsoft.MacCatalyst.dll

This makes it easy to distinguish between legacy Xamarin and .NET whenever the
product assembly is mentioned, and I've also chosen the platform part of the
name to match how the platforms are named elsewhere (this also makes it
possible to simplify our build logic, since we can remove a lot of special
casing).

Fixes https://github.com/xamarin/xamarin-macios/issues/13748.
2022-02-16 21:30:32 +01:00
Rolf Bjarne Kvinge 5b8250486f
[dotnet/msbuild] Run install_name_tool to fix the id for dylibs. Fixes #13999. (#14147)
Fixes https://github.com/xamarin/xamarin-macios/issues/13999.
2022-02-16 21:13:40 +01:00
Rolf Bjarne Kvinge a404081365
[dotnet] Add support for the PublishFolderType metadata on Content and BundleResource items. (#14162)
Add support for the PublishFolderType metadata on Content and BundleResource
items, which makes it possible to change the location in the app bundle for
these items (this was possible to do before with the Link metadata), but most
importantly it also makes it possible to choose to *not* bundle these items in
the app bundle (which was not possible before with the Link metadata, nor any
other means).

At first I thought setting CopyToPublishDirectory /
CopyToOutputDirectory=Never would accomplish that, but it turns out we don't
honor those, and since we already have this behavior of ignoring
CopyToPublishDirectory / CopyToOutputDirectory in legacy Xamarin, I didn't
want to change it in .NET.

So I added support for honoring the PublishFolderType metadata instead, which
is new and we already support for other item groups. This is accomplished by
adding all Content and BundleResource items with PublishFolderType set to the
ResolvedFileToPublish item group (where we already handle any
PublishFolderType values), and then we ignore such Content and BundleResource
items in our CollectBundleResources task.

Also update the documentation and add tests.
2022-02-16 20:54:14 +01:00
Rolf Bjarne Kvinge 8060e2f6d3
[tests] Use the correct OS version for Mac Catalyst. (#14143)
This fixes the CheckManagedFilters tests on Mac Catalyst on older macOS versions:

    [FAIL] CheckManagedFilters :   Managed filters not found for CIAreaMinMax, CIAreaMinMaxRed, CIAttributedTextImageGenerator, CIBarcodeGenerator, CIBicubicScaleTransform, CIBlendWithBlueMask, CIBlendWithRedMask, CIBokehBlur, CICameraCalibrationLensCorrection, CIColorCubesMixedWithMask, CIColorCurves, CICoreMLModelFilter, CIDepthBlurEffect, CIDepthToDisparity, CIDisparityToDepth, CIDither, CIDocumentEnhancer, CIEdgePreserveUpsampleFilter, CIGaborGradients, CIGuidedFilter, CIKeystoneCorrectionCombined, CIKeystoneCorrectionHorizontal, CIKeystoneCorrectionVertical, CIKMeans, CILabDeltaE, CIMeshGenerator, CIMix, CIMorphologyGradient, CIMorphologyMaximum, CIMorphologyMinimum, CIMorphologyRectangleMaximum, CIMorphologyRectangleMinimum, CIPaletteCentroid, CIPalettize, CIPerspectiveRotate, CIRoundedRectangleGenerator, CISaliencyMapFilter, CISampleNearest, CITextImageGenerator
      Expected: 0
      But was:  39
2022-02-16 20:11:57 +01:00
Rolf Bjarne Kvinge d8e5cce46e
[runtime] Be a bit more explicit about format warnings related to security. (#14165) 2022-02-16 20:11:23 +01:00
Rolf Bjarne Kvinge 2e62431fb1
[nfloat] Obsolete nfloat.CopyArray in legacy Xamarin and stop using it. (#14164)
There's no corresponding System.Runtime.InteropServices.NFloat.CopyArray method in .NET.

It turned out that the API where we used CopyArray don't need to use CopyArray at all, the same can be accomplished faster and simpler by using unsafe code.
2022-02-16 20:10:13 +01:00
Rolf Bjarne Kvinge d61af8aa70
[msbuild] Generate Versions.*.g.cs before running msbuild to build the solution. (#14163)
Hopefully fixes random build failures like this:

> xamarin-macios/msbuild/Versions.ios.g.cs(3,1): error CS1022: Type or namespace definition, or end-of-file expected
2022-02-16 20:04:59 +01:00
Rolf Bjarne Kvinge 404b6e9af5
[msbuild/dotnet] Set NoBindingEmbedding to 'true' by default in .NET. Fixes #12530. (#12694)
Not embedding third-party libraries in the binding assembly is the future, and
let's try to enable it by default starting with .NET.

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

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-02-16 10:30:41 +01:00
Rolf Bjarne Kvinge 635950d7a6
[SceneKit] Remove dead code from SCNMatrix4.cs. (#14149)
This entire file is already inside a !NET condition, so no need to have
additional conditions inside the file.
2022-02-16 10:21:12 +01:00
Sebastien Pouliot 7bff1c4ca9
[corefoundation] Skip intermediate call inside `CFArray.DefaultConvert` (#14160)
This allow the linker to remove the helper API (code and metadata) from
smaller apps.
2022-02-16 08:24:50 +01:00