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

9680 Коммитов

Автор SHA1 Сообщение Дата
Manuel de la Pena a810f6954a [Security] Fix some tests after the bump to NUnitlite. 2020-11-17 11:14:04 -05:00
Manuel de la Pena 0f7bc75e50 Merge branch 'xcode12.2' into main-xcode12.2 2020-11-17 11:09:15 -05:00
Manuel de la Pena b949a93c40
[fileprovider] Fix breaking change (#10099)
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2020-11-16 16:47:27 -05:00
Manuel de la Pena 13567cc11a
[VSMac] Bump max version to current stable. (#10092) 2020-11-13 16:07:24 -05:00
Přemek Vysoký 0fba63cdc7
[xharness] Remove Microsoft.DotNet.XHarness.iOS.Shared project and use NuGet instead (#9980) 2020-11-13 11:05:10 -05:00
Chris Hamons c2697b1bf3
Update CODEOWNERS. 👋 (#10090) 2020-11-13 09:20:14 -06:00
Sebastien Pouliot d4fb41b172
[tests] Update framework tests not to embed/zip the native binaries (#10073)
Manually added `NoBindingEmbedding` to bindings .csproj and removed
`[LinkWith]` attributes.

Also added support for NativeReference to harness and updated the
workaround for watchOS (since it can't link against ModelIO)

Fixed/adapted unit tests wrt change
2020-11-11 12:00:48 -05:00
Rolf Bjarne Kvinge cd362f8ffa
[msbuild] Remove unnecessary properties in Xamarin.Mac.Common.targets. (#10080)
The _ACTool_PartialAppManifestCache and _ACTool_BundleResourceCache are
duplicated (merge conflict resolution failure?), and also already present in
Xamarin.Shared.targets, so just remove these definitions.
2020-11-11 11:06:42 +01:00
Rolf Bjarne Kvinge bbc81dd80c
[dotnet] We're not doing anything with regards to the http handler, so we won't have a runtime-options.plist. (#10083) 2020-11-11 07:43:49 +01:00
Rolf Bjarne Kvinge d0d0a3dd93
[dotnet-linker] Remove AssemblyResolver.cs from the project, it's not needed. (#10081) 2020-11-11 07:42:34 +01:00
Rolf Bjarne Kvinge 9ada363d10
[mmp] Fix build. (#10082)
This broke in 59bc3c16ab, and wasn't caught because the Xamarin.Mac build is disabled.
2020-11-10 17:20:23 +01:00
Rolf Bjarne Kvinge 59bc3c16ab
[tools] Add all our product constants to SdkVersions.cs and use them in dotnet-linker. (#10065)
Also, the correct constants to use is now determined by current platform in the Application
instance, instead of a constant value.
2020-11-10 14:21:47 +01:00
Rolf Bjarne Kvinge db23ca881a
[dotnet] Add _CreateDebugSettings, _CreateDebugConfiguration and _CreatePkgInfo to the targets we run on app creation. (#10061) 2020-11-10 13:44:26 +01:00
Rolf Bjarne Kvinge ac36750f49
[tests] Add a tvOS version of the dotnet introspection test project. (#10066)
* [tests] Move the dotnet introspection test project to a new test directory.

A tvOS project will come soon too, this makes the separation nicer.

* [tests] Add a tvOS version of the dotnet introspection test project.
2020-11-10 13:44:05 +01:00
Rolf Bjarne Kvinge 90d43ab86d
[mmp] Fix link path for Stripper.cs (#10062)
This makes the file show up in the right place (together with other files from
the tools/mtouch directory) in the solution explorer in VSMac.
2020-11-10 08:27:51 +01:00
Rolf Bjarne Kvinge 390b9e4b83
[dotnet-linker] Improve error reporting (#10064)
Improve error reporting in dotnet-linker by not requiring an instance of a LinkerConfiguration
to report errors. This is accomplished by making the LinkerConfiguration.Report method
a static method.

Otherwise reporting errors before we've successfully created a LinkerConfiguration
turns out to be troublesome (we end up throwing another exception, usually a NullReferenceException,
which is just confusing).
2020-11-10 08:27:28 +01:00
Alex Soto 42bec7dfa0
[mono] Bump mono to match android (#10069)
New commits in mono/mono:

* mono/mono@ac596375c7 Add support for OP_FCONV_TO_I to mini-arm64.c. (#20548)
* mono/mono@392fe5b87b [2020-02][watchOS] Add simwatch64 support (#20552)
* mono/mono@a22ed3f094 Fix potential crash for Encoder.Convert (#20522)
* mono/mono@970783731f Bump to F# 5.0 (#20511)
* mono/mono@32ab5066f7 Bump msbuild to fix a build issue
* mono/mono@93a7fe77e8 Ensure special static slots respect alignment. (#20506)
* mono/mono@3db5b35841 [debugger] Switch to GC Unsafe in signal handler callbacks (#20495)
* mono/mono@af315f44c4 [2020-02][corlib] ThreadAbortException protection for ArraySortHelper (#20468)

Diff: ca11fb0fd8..ac596375c7
2020-11-09 11:16:25 -05:00
Sebastien Pouliot 61cb18be6c
Bump Xcode 12.2 to RC (#10060)
Both xtro and intro looks fine locally, no update required.
2020-11-06 10:12:06 -05:00
Rolf Bjarne Kvinge 8b76cf4735
[dotnet] Fix MSBuild syntax. (#10055)
For some reason .NET 6 does not like spaces in certain places:

    MSB4259: Unexpected space at position "32" of condition [...]

So just remove them.
2020-11-06 14:01:19 +01:00
Rolf Bjarne Kvinge 06cd5722cc
[msbuild] Add SceneKit assets to our items included by default. (#10053) 2020-11-06 08:11:25 +01:00
Sebastien Pouliot 7db9e66d87
[tests] Disable XM samples that use QTKit, ibtool won't compile their nib anymore (#10057) 2020-11-05 13:24:27 -05:00
monojenkins f7b13c49f2
[tests] Bump sampletester hashes to pick up fixes (#10054) 2020-11-05 11:32:05 -05:00
Manuel de la Pena dcfc6467fa
[Makefile] Respect the configuration of dotnet after the make clean. (#10045) 2020-11-05 09:58:15 -05:00
Rolf Bjarne Kvinge 0def89604d
[msbuild] Add Metal files to our items included by default. (#10049) 2020-11-05 15:36:36 +01:00
Rolf Bjarne Kvinge 6fcf25ffd4
[msbuild] Share targets related to Collada assets. (#10050) 2020-11-05 15:10:19 +01:00
Rolf Bjarne Kvinge 8aa53ba943
[dotnet] Add app extension targets to our list of stuff to do during the build. (#10044)
That makes app extensions build in dotnet.

This required adding a RuntimeIdentifier property to all the extension test
projects.
2020-11-05 08:34:29 +01:00
Rolf Bjarne Kvinge 1c6cd0b439
[tests] Re-enable the ReleaseBuild.RebuildTest, since we're using msbuild exclusively now. (#10041)
This test also required a few changes to pass.
2020-11-05 08:24:50 +01:00
Sebastien Pouliot 505b6c659a
[generator] Remove generated availability attribute duplicates (and some incorrect ones) (#9866) 2020-11-04 14:12:05 -05:00
TJ Lambert c67a2d076c
[msbuild] Adding W0111 Translations (#10022)
Updating msbuild localization string translation for error code W0111
2020-11-04 09:55:06 -06:00
Rolf Bjarne Kvinge e7dd367125
[msbuild] Add CoreML models to our items included by default. (#10038) 2020-11-04 16:01:43 +01:00
Rolf Bjarne Kvinge 354beec69c
[msbuild] Share the app extensions targets between iOS and Mac. (#10039)
* Share the following targets:

    * _ResolveAppExtensionReferences
    * _SplitAppExtensionReferencesByExistent
    * _AssignAppExtensionConfiguration
    * _SeparateAppExtensionReferences
    * _CopyAppExtensionsToBundle

The first four were pretty much identical between iOS and Mac already, and
needed very few changes.

The latter, _CopyAppExtensionsToBundle, required a little bit of tweaking to
the targets to make sure it works for both iOS and Mac:

* Removed the conditions on the Ditto task to check if we have app extensions
  - this is unnecessary because Inputs/Outputs on the target itself (which
  weren't there when the Ditto task conditions were written).
* Added a '_PlaceAppExtensions' target that calculates where in the
  container's app bundle extensions should be placed (the '_AppExtensionRoot'
  property), and the name of the containing folder (the 'ContainerName'
  metadata).
2020-11-04 15:39:02 +01:00
Rolf Bjarne Kvinge 32f360ed42
[tests] Re-enable an that requires msbuild (as opposed to xbuild). (#10040)
Since we're using msbuild exclusively now.
2020-11-04 15:19:05 +01:00
Sebastien Pouliot 9eeeb5c512
[tests] Bump sampletester hashes to pick up fixes (#10020) 2020-11-04 09:01:47 -05:00
juliuszint 3a1a7d4e77
Generate default compilation includes for pdf image assets. (#10018)
iOS and macOS have support to generate image assets for various
resolutions from vector based PDF files. These files should be included by
default for SDK-Style projects.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-11-04 09:00:06 +01:00
Rolf Bjarne Kvinge 781bc851a5
[dotnet] Add atlas textures to the our items included by default. (#9995) 2020-11-04 08:40:16 +01:00
Manuel de la Pena 738b237355
[VSTS] Remove the UI prompt ASAP. (#10034)
Using provisionator could result in the UI prompt being shown which will
make the pipeline hang until there is human interaction.

Move the step to be one of the first ones to ensure provisionator does
not get stuck.
2020-11-03 18:32:32 -05:00
Manuel de la Pena ffa08ac060
[VSTS] Continue even if we could not clean the HD, we might have space. (#10032) 2020-11-03 13:02:59 -05:00
Rolf Bjarne Kvinge d104a660ed
[tests] Update .NET unit tests to parse the binlog. (#10031)
Update the .NET unit tests to parse the binlog instead of standard output for
specific build output, since we're not printing a diagnostic build log to
standard output anymore.

This fixes numerous test failures in the .NET unit tests:

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBundledResources("iOS","monotouch"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBundledResources("watchOS","monotouch"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBundledResources("tvOS","monotouch"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildMyTVApp: Linker did not executed as expected.
        Expected: String containing "Building target "_RunILLink" completely."
        But was: "Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET [...]"

    * Xamarin.Tests.DotNetProjectTest.BuildMySingleView: Linker did not executed as expected.
        Expected: String containing "Building target "_RunILLink" completely."
        But was: "Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET [...]"

    * Xamarin.Tests.DotNetProjectTest.BuildInterdependentBindingProjects("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildInterdependentBindingProjects("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>
2020-11-03 18:20:33 +01:00
monojenkins 44e1621893
[Actions] Add debug for the workflow to find why it does not work with hub. (#10027)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-11-03 10:02:09 -05:00
Manuel de la Pena d43eba662c
[Makefile] Update the path of xcode to be stable. (#10023) 2020-11-03 09:43:42 -05:00
Rolf Bjarne Kvinge 0011fc1488
[jenkins] Add missing eol to pr comments. (#10029)
Example of broken pr comment: https://github.com/xamarin/xamarin-macios/pull/10020#issuecomment-720606818
2020-11-03 14:13:44 +01:00
Sebastien Pouliot 1f0b89cd6a
[appkit] Fix introspection tests for NSAccessibility on macOS 10.9 (#10016)
This reverts parts of https://github.com/xamarin/xamarin-macios/pull/9993
and add a special case to the test looking for duplicate attributes
between members and the type.

Why ? Introspection fails because `bgen` inline the `NSAccessibility`
protocol (added in 10.10) into types that existed earlier. That's
normally not a problem since the type-level attribute is there.
However because of the 10.9 (type) vs 10.10 (protocol) issue that was
moved into the manual bindings (so `bgen` does not know it)

Even if built inside `COREBUILD` the issue exists since the protocol
interface does not really exists at that point (by default), so it's
the type (10.9) availability that is looked up.

In retrospect we should have created a new type, like Swift did (a
few years later), named `NSAccessibilityProtocol` for 10.10.

Fix https://github.com/xamarin/xamarin-macios/issues/10009
2020-11-02 08:15:47 -05:00
Sebastien Pouliot a18679b036
[metrickit] Add missing `MXMetricManager.MakeLogHandle` API (#10017)
and add unit test since it's _partially_ a manual binding as it
returns an non-ObjC type.

Fixes https://github.com/xamarin/xamarin-macios/issues/10004
2020-10-30 18:28:58 -04:00
Sebastien Pouliot 2d7edf555f
[objcruntime] Add helper to check for disposed instances (#8679)
We're handling `ObjectDisposedException` a bit inconsistently in our
bindings.

Some, but not all, manual bindings have checks (not all of them are fully
consistent) but there's none for generated bindings, which can lead to
errors wrt nullability.

**Example**

```
[Test]
public void IncompleteNullabilityCheck ()
{
	NSString s = new NSString ("bonjour");
	s.Dispose ();
	ManagedLayer (s);
}

void ManagedLayer (NSString s)
{
	// this is similar to the generated binding code
	if (s == null)
		throw new ArgumentNullException ("s");
	NativeCode (s.Handle);
}

void NativeCode (IntPtr p)
{
	// let's assume this is native and dereference the pointer
	if (p == IntPtr.Zero)
		Assert.Fail ("boo");
}
```

This shows that we can, _if disposed_, provide `nil` to a native API for
which we know `nil` is not a valid argument. That can crash a process in
a situation that was possible to detect and throw a (catchable) managed
exception.

Adding dispose checks everywhere could be costly (in size) unless we
share that code with the null check (and a few other optimizations could
be applied too). Sharing the code would also ensure more consistency
across all bindings.

**Impact**

Here's the IL for an existing `CGColor` constructor that *already*
does the dispose check.

```
.method public hidebysig specialname rtspecialname
	instance void .ctor (
		class CoreGraphics.CGColorSpace colorspace,
		valuetype System.nfloat[] components
	) cil managed
{
	// Method begins at RVA 0x20c834
	// Code size 82 (0x52)
	.maxstack 3

	IL_0000: ldarg.0
	IL_0001: call instance void [mscorlib]System.Object::.ctor()
	IL_0006: ldarg.2
	IL_0007: brtrue.s IL_0014

	IL_0009: ldstr "components"
	IL_000e: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_0013: throw

	IL_0014: ldarg.1
	IL_0015: brtrue.s IL_0022

	IL_0017: ldstr "colorspace"
	IL_001c: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_0021: throw

	IL_0022: ldarg.1
	IL_0023: ldfld native int CoreGraphics.CGColorSpace::handle
	IL_0028: ldsfld native int [mscorlib]System.IntPtr::Zero
	IL_002d: call bool [mscorlib]System.IntPtr::op_Equality(native int, native int)
	IL_0032: brfalse.s IL_003f

	IL_0034: ldstr "colorspace"
	IL_0039: newobj instance void [mscorlib]System.ObjectDisposedException::.ctor(string)
	IL_003e: throw

	IL_003f: ldarg.0
	IL_0040: ldarg.1
	IL_0041: ldfld native int CoreGraphics.CGColorSpace::handle
	IL_0046: ldarg.2
	IL_0047: call native int CoreGraphics.CGColor::CGColorCreate(native int, valuetype System.nfloat[])
	IL_004c: stfld native int CoreGraphics.CGColor::handle
	IL_0051: ret
} // end of method CGColor::.ctor

Here's the IL code (as committed) using a helper extension method.

```
.method public hidebysig specialname rtspecialname
	instance void .ctor (
		class CoreGraphics.CGColorSpace colorspace,
		valuetype System.nfloat[] components
	) cil managed
{
	// Method begins at RVA 0x210558
	// Code size 46 (0x2e)
	.maxstack 3
	.locals init (
		[0] native int handleof_colorspace
	)

	IL_0000: ldarg.0
	IL_0001: call instance void [mscorlib]System.Object::.ctor()
	IL_0006: ldarg.2
	IL_0007: brtrue.s IL_0014

	IL_0009: ldstr "components"
	IL_000e: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_0013: throw

	IL_0014: ldarg.1
	IL_0015: ldstr "colorspace"
	IL_001a: call native int ObjCRuntime.NativeObjectHelper::GetNonNullHandle(class ObjCRuntime.INativeObject, string)
	IL_001f: stloc.0
	IL_0020: ldarg.0
	IL_0021: ldloc.0
	IL_0022: ldarg.2
	IL_0023: call native int CoreGraphics.CGColor::CGColorCreate(native int, valuetype System.nfloat[])
	IL_0028: stfld native int CoreGraphics.CGColor::handle
	IL_002d: ret
} // end of method CGColor::.ctor
```

So existing checks becomes a lot smaller. Here's another example where
a dispose check is **missing** (on `pattern`). Note that the check for
`colorspace` is not updated so we can see the impact of adding missing
dispose checks in existing code (manual or generated).

```
.method public hidebysig specialname rtspecialname
	instance void .ctor (
		class CoreGraphics.CGColorSpace colorspace,
		class CoreGraphics.CGPattern pattern,
		valuetype System.nfloat[] components
	) cil managed
{
	// Method begins at RVA 0x210660
	// Code size 126 (0x7e)
	.maxstack 4

	IL_0000: ldarg.0
	IL_0001: call instance void [mscorlib]System.Object::.ctor()
	IL_0006: ldarg.1
	IL_0007: brtrue.s IL_0014

	IL_0009: ldstr "colorspace"
	IL_000e: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_0013: throw

	IL_0014: ldarg.1
	IL_0015: ldfld native int CoreGraphics.CGColorSpace::handle
	IL_001a: ldsfld native int [mscorlib]System.IntPtr::Zero
	IL_001f: call bool [mscorlib]System.IntPtr::op_Equality(native int, native int)
	IL_0024: brfalse.s IL_0031

	IL_0026: ldstr "colorspace"
	IL_002b: newobj instance void [mscorlib]System.ObjectDisposedException::.ctor(string)
	IL_0030: throw

	IL_0031: ldarg.2
	IL_0032: brtrue.s IL_003f

	IL_0034: ldstr "pattern"
	IL_0039: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_003e: throw

	IL_003f: ldarg.3
	IL_0040: brtrue.s IL_004d

	IL_0042: ldstr "components"
	IL_0047: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_004c: throw

	IL_004d: ldarg.0
	IL_004e: ldarg.1
	IL_004f: ldfld native int CoreGraphics.CGColorSpace::handle
	IL_0054: ldarg.2
	IL_0055: callvirt instance native int CoreFoundation.NativeObject::get_Handle()
	IL_005a: ldarg.3
	IL_005b: call native int CoreGraphics.CGColor::CGColorCreateWithPattern(native int, native int, valuetype System.nfloat[])
	IL_0060: stfld native int CoreGraphics.CGColor::handle
	IL_0065: ldarg.0
	IL_0066: ldfld native int CoreGraphics.CGColor::handle
	IL_006b: ldsfld native int [mscorlib]System.IntPtr::Zero
	IL_0070: call bool [mscorlib]System.IntPtr::op_Equality(native int, native int)
	IL_0075: brfalse.s IL_007d

	IL_0077: newobj instance void [mscorlib]System.ArgumentException::.ctor()
	IL_007c: throw

	IL_007d: ret
} // end of method CGColor::.ctor
```

into

```
.method public hidebysig specialname rtspecialname
	instance void .ctor (
		class CoreGraphics.CGColorSpace colorspace,
		class CoreGraphics.CGPattern pattern,
		valuetype System.nfloat[] components
	) cil managed
{
	// Method begins at RVA 0x210660
	// Code size 119 (0x77)
	.maxstack 4
	.locals init (
		[0] native int handleof_pattern
	)

	IL_0000: ldarg.0
	IL_0001: call instance void [mscorlib]System.Object::.ctor()
	IL_0006: ldarg.1
	IL_0007: brtrue.s IL_0014

	IL_0009: ldstr "colorspace"
	IL_000e: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_0013: throw

	IL_0014: ldarg.1
	IL_0015: ldfld native int CoreGraphics.CGColorSpace::handle
	IL_001a: ldsfld native int [mscorlib]System.IntPtr::Zero
	IL_001f: call bool [mscorlib]System.IntPtr::op_Equality(native int, native int)
	IL_0024: brfalse.s IL_0031

	IL_0026: ldstr "colorspace"
	IL_002b: newobj instance void [mscorlib]System.ObjectDisposedException::.ctor(string)
	IL_0030: throw

	IL_0031: ldarg.3
	IL_0032: brtrue.s IL_003f

	IL_0034: ldstr "components"
	IL_0039: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string)
	IL_003e: throw

	IL_003f: ldarg.2
	IL_0040: ldstr "pattern"
	IL_0045: call native int ObjCRuntime.NativeObjectHelper::GetNonNullHandle(class ObjCRuntime.INativeObject, string)
	IL_004a: stloc.0
	IL_004b: ldarg.0
	IL_004c: ldarg.1
	IL_004d: ldfld native int CoreGraphics.CGColorSpace::handle
	IL_0052: ldloc.0
	IL_0053: ldarg.3
	IL_0054: call native int CoreGraphics.CGColor::CGColorCreateWithPattern(native int, native int, valuetype System.nfloat[])
	IL_0059: stfld native int CoreGraphics.CGColor::handle
	IL_005e: ldarg.0
	IL_005f: ldfld native int CoreGraphics.CGColor::handle
	IL_0064: ldsfld native int [mscorlib]System.IntPtr::Zero
	IL_0069: call bool [mscorlib]System.IntPtr::op_Equality(native int, native int)
	IL_006e: brfalse.s IL_0076

	IL_0070: newobj instance void [mscorlib]System.ArgumentException::.ctor()
	IL_0075: throw

	IL_0076: ret
} // end of method CGColor::.ctor
```

so the difference is smaller, but it's still smaller (7 bytes) than the
existing code (that did not check for a disposed instance).

There are many more optimizations that can be applied on top of this.
However the main/original goal is to have a correct and consistent
handling of disposed managed instances. IOW the size reduction is a nice
side-effect of correctness and actual optimizations can come later :)

Add `ObjectDisposedException` when required on Handle access.
Instead of providing `nil` to native API that are decorated **not**
accepting them.

Also do this using existing and new extension method helpers so the IL
size of the assemblies is (a bit) smaller than the existing code.

The latter has a small, positive impact for Xamarin.Mac (JIT'ing or
requiring IL for, non-full, AOT'ing) and for Xamarin.iOS when the
interpreter is used.
2020-10-30 13:02:15 -04:00
TJ Lambert d51d34a0eb
[msbuild] Localization String Test for All Strings (#9971)
This test will run through all available strings in MSBStrings.Designer.cs in the each of the supported languages.
If any strings should fire in other languages but are still in english, an error will be thrown unless that error code is in an ignore file.

There are two types of ignore files introduced:

LocalizationIgnore/common-Translations.ignore
for error codes that are not yet translated in all languages
LocalizationIgnore/<LOCALE>-Translations.ignore
for error codes that are not yet translated in the specific locale

If an error code is in an ignore file and it turns out it is translated, an error will be thrown to remove the error code from the ignore file.

If there is a non-valid error code in any ignore file, an error will also be thrown.

Wiki will be updated for the team to reflect this test: https://github.com/xamarin/maccore/wiki/Localization
2020-10-30 10:19:55 -05:00
Rolf Bjarne Kvinge 6e5f39a5b5
[tests] Make sure there are no simulators lurking around when we start running the .NET unit tests. (#10013)
It seems actool can fail in interesting ways if there are other types of simulators running from earlier tests:

* com.apple.actool.errors
   * Failed to find newest available Simulator runtime, no available runtime found from:
        watchOS 7.0 (7.0 - 18R382) - com.apple.CoreSimulator.SimRuntime.watchOS-7-0 (unavailable, failed to open liblaunch_sim.dylib) ==> not available: Error Domain=com.apple.CoreSimulator.SimError Code=401 "The watchOS 7.0 simulator runtime is not available." UserInfo={NSLocalizedDescription=The watchOS 7.0 simulator runtime is not available., NSUnderlyingError=0x7ff2160359b0 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort" UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff958b89a0> { count = 1, transaction: 0, voucher = 0x0, contents =
        	"XPCErrorDescription" => <string: 0x7fff958b8b08> { length = 18, contents = "Connection invalid" }
        }}}, NSLocalizedRecoverySuggestion=Unable to open liblaunch_sim.dylib.  Try reinstalling Xcode or the simulator runtime., NSLocalizedFailureReason=failed to open liblaunch_sim.dylib}

        tvOS 14.0 (14.0 - 18J383) - com.apple.CoreSimulator.SimRuntime.tvOS-14-0 (unavailable, failed to open liblaunch_sim.dylib) ==> not available: Error Domain=com.apple.CoreSimulator.SimError Code=401 "The tvOS 14.0 simulator runtime is not available." UserInfo={NSLocalizedDescription=The tvOS 14.0 simulator runtime is not available., NSUnderlyingError=0x7ff216332580 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort" UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff958b89a0> { count = 1, transaction: 0, voucher = 0x0, contents =
        	"XPCErrorDescription" => <string: 0x7fff958b8b08> { length = 18, contents = "Connection invalid" }
        }}}, NSLocalizedRecoverySuggestion=Unable to open liblaunch_sim.dylib.  Try reinstalling Xcode or the simulator runtime., NSLocalizedFailureReason=failed to open liblaunch_sim.dylib},

        iOS 14.1 (14.1 - 18A8394) - com.apple.CoreSimulator.SimRuntime.iOS-14-1 (unavailable, failed to open liblaunch_sim.dylib) ==> not available: Error Domain=com.apple.CoreSimulator.SimError Code=401 "The iOS 14.1 simulator runtime is not available." UserInfo={NSLocalizedDescription=The iOS 14.1 simulator runtime is not available., NSUnderlyingError=0x7ff21a607c80 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort" UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff958b89a0> { count = 1, transaction: 0, voucher = 0x0, contents =
        	"XPCErrorDescription" => <string: 0x7fff958b8b08> { length = 18, contents = "Connection invalid" }
        }}}, NSLocalizedRecoverySuggestion=Unable to open liblaunch_sim.dylib.  Try reinstalling Xcode or the simulator runtime., NSLocalizedFailureReason=failed to open liblaunch_sim.dylib},
    ] when matching for <IBCocoaTouchPlatformToolDescription: 0x7ff216274910> System content for IBAppleTVFramework-fourteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7ff21622c520> scaleFactor=1x, renderMode.identifier=(null), idiom=<IBAppleTVIdiom: 0x7ff219f898b0> runtime=<IBCocoaTouchTargetRuntime: 0x7ff216257050>
2020-10-30 15:40:28 +01:00
Rolf Bjarne Kvinge 491e3e9925
Merge pull request #10000 from rolfbjarne/tests-msbuild-improve
[tests] Clean up Xamarin.MacDev.Tests.
2020-10-30 14:38:21 +01:00
Rolf Bjarne Kvinge 90bfb623ed
[compare-commits] Fix corruption in dotnet assemblies after API comparison. (#10011)
Make sure to redirect the dotnet build output to our custom output directory
when building the previous commit so that it doesn't interfere with the normal
build output.

Also add validation for this.
2020-10-30 14:36:21 +01:00
Rolf Bjarne Kvinge 5f7993f24a
Bump maccore. Fixes #9961. (#10006)
New commits in xamarin/maccore:

* xamarin/maccore@0e3a80dd61 [Xamarin.Hosting] Apps without Info.plists aren't watch apps. (#2329)

Diff: 5e97cc52a4..0e3a80dd61

Fixes: https://github.com/xamarin/xamarin-macios/issues/9961
2020-10-30 08:57:49 +01:00
Rolf Bjarne Kvinge 957bb31838 Merge remote-tracking branch 'origin/main' into tests-msbuild-improve 2020-10-30 08:34:02 +01:00