This reverts commit 9a27951a99.
The purpose of the original commit was to take out 4 tasks that were only executed from Windows to the Windows specific pack (and enabling more tasks that need to be executed remotely on that pack).
To execute tasks remotely the build will initially run `SayHello` which connects to the Mac and shares the connection with all the tasks through IBuildEngine4[1]. When that connection object is retrieved on the tasks we need to cast it as a Messaging connection type, and this works from Visual Studio and msbuild because there's just one messaging assembly loaded.
But it doesn't work on dotnet/msbuild, because there's a feature called ALC (AssemblyLoadContext) which will load each assembly task into it's own context[2], loading all its dependencies in that context. In this scenario sharing custom objects between tasks won't work because the original object type could be from a different context than the one retrieving it. This is described here: https://github.com/dotnet/msbuild/issues/5084.
[1] https://docs.microsoft.com/en-us/dotnet/api/microsoft.build.framework.ibuildengine4?view=msbuild-16-netcore
[2] https://github.com/dotnet/msbuild/blob/master/documentation/specs/task-isolation-and-dependencies.md
Also set to 13.0 (first Catalyst version) any framework that existed
earlier in iOS.
* Avoid multiple lookup in the frameworks collection since we need to access/update most of them anyway
xtro tests are based on Apple's header files and report as _unknown_
bindings to API that are not found in headers - Catalyst in this case.
Removing them is required so the applications can be submitted to the
AppStore.
This also means linking with the runtime packs from .NET instead of the mono archive
(thus we have one less reliance on the mono archive).
We're also using the Xamarin.iOS code for our macOS launch sequence now, since
(at least at first) we're only going to support self-contained .NET macOS apps
(so no need to support a system-installed runtime, which simplifies things a
bit).
* [dotnet-linker] Disable Objective-C exception marshalling by default for macOS and Mac Catalyst.
* Apply suggestions from code review
Co-authored-by: Filip Navara <filip.navara@gmail.com>
This required working around internal ctor that uses internal (non
re-generated) types. E.g.
```
build/dotnet/maccatalyst/ref/Xamarin.iOS.cs(9201,64): error CS0234: The type or namespace name 'ABFunc<>' does not exist in the namespace 'AddressBookUI' (are you missing an assembly reference?)
```
We cannot just skip such constructor since the C# compiler will add a
**public** default one when none is present (and that's the case for
the error above),
This also required fixing the ctor chaining code (which can't be shared
with the, previously fixed, override code) so base classes could be
called for some `*EventArg` types.
Follow up to https://github.com/xamarin/xamarin-macios/pull/10658 , https://github.com/xamarin/xamarin-macios/pull/10678 and https://github.com/xamarin/xamarin-macios/pull/10706
This is the last framework that needs removal - but there's still a few
`unknown-*` entries in Catalyst-supported frameworks (more PR coming).
* [bgen] Remove trailing newlines from warning/error messages.
This fixes an issue where a composed error message would show up in two lines:
BTOUCH : error BI1079: bgen: Do not know how to make a signature for System.Boolean*
in parameter `inventoryAbortResultCodeFound' from iOSBinding.Easy2ReadProtocolMessage.FromRawData
Leaving customers confused (https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1280923),
because they wouldn't see the second part of the error.
After the fix:
BTOUCH : error BI1079: bgen: Do not know how to make a signature for System.Boolean* in parameter `inventoryAbortResultCodeFound' from iOSBinding.Easy2ReadProtocolMessage.FromRawData
* Update translations.
Fixes this crash in monotouch-test:
Process terminated. A callback was made on a garbage collected delegate of type 'Xamarin.Mac!CoreMedia.CMSampleBuffer+CMSampleBufferInvalidateCallback::Invoke'.
Repeat 2 times:
--------------------------------
at CoreMedia.CMSampleBuffer.CMSampleBufferInvalidate(IntPtr)
--------------------------------
at CoreMedia.CMSampleBuffer.Invalidate()
at MonoTouchFixtures.CoreMedia.SampleBufferTest.SetInvalidateCallback()
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean, Boolean)
at NUnit.Framework.Internal.Reflect.InvokeMethod(System.Reflection.MethodInfo, System.Object, System.Object[])
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(NUnit.Framework.Internal.TestExecutionContext)
at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformWork()
at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()
at NUnit.Framework.Internal.Execution.WorkItem.Execute()
at NUnit.Framework.Internal.Execution.MainThreadWorkItemDispatcher.Dispatch(NUnit.Framework.Internal.Execution.WorkItem)
at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformWork()
at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()
at NUnit.Framework.Internal.Execution.WorkItem.Execute()
at NUnit.Framework.Internal.Execution.MainThreadWorkItemDispatcher.Dispatch(NUnit.Framework.Internal.Execution.WorkItem)
at NUnit.Framework.Internal.Execution.MainThreadWorkItemDispatcher.Start(NUnit.Framework.Internal.Execution.WorkItem)
at NUnit.Framework.Api.NUnitTestAssemblyRunner.StartRun(NUnit.Framework.Interfaces.ITestListener)
at NUnit.Framework.Api.NUnitTestAssemblyRunner+<>c__DisplayClass38_0.<RunAsync>b__0()
at NUnit.Framework.Api.NUnitTestAssemblyRunner.WrapInNUnitCallContext(System.Action)
at NUnit.Framework.Api.NUnitTestAssemblyRunner.RunAsync(NUnit.Framework.Interfaces.ITestListener, NUnit.Framework.Interfaces.ITestFilter)
at NUnit.Framework.Api.NUnitTestAssemblyRunner.Run(NUnit.Framework.Interfaces.ITestListener, NUnit.Framework.Interfaces.ITestFilter)
at MonoTouch.NUnit.UI.BaseTouchRunner.Run(NUnit.Framework.Internal.Test)
at MonoTouch.NUnit.UI.BaseTouchRunner.Run()
at MonoTouch.NUnit.UI.BaseTouchRunner.RunAsync()
at MonoTouch.NUnit.UI.MacRunner+<RunTestsAsync>d__1.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at MonoTouch.NUnit.UI.MacRunner.RunTestsAsync(MonoTouch.NUnit.UI.TouchOptions, System.Reflection.Assembly[])
at MonoTouch.NUnit.UI.MacRunner+<>c__DisplayClass0_0+<<MainAsync>b__0>d.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at MonoTouch.NUnit.UI.MacRunner+<>c__DisplayClass0_0.<MainAsync>b__0()
at Foundation.NSActionDispatcher.Apply()
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean, Boolean)
at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at ObjCRuntime.Runtime.InvokeMethod(IntPtr, IntPtr, IntPtr)
at ObjCRuntime.Runtime.bridge_runtime_invoke_method(IntPtr, IntPtr, IntPtr, IntPtr ByRef)
at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_bool(IntPtr, IntPtr, IntPtr, IntPtr, Boolean)
at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_bool(IntPtr, IntPtr, IntPtr, IntPtr, Boolean)
at Foundation.NSObject.InvokeOnMainThread(System.Action)
at MonoTouch.NUnit.UI.MacRunner+<MainAsync>d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at MonoTouch.NUnit.UI.MacRunner.MainAsync(System.Collections.Generic.IList`1<System.String>, Boolean, System.Action`1<Int32>, System.Reflection.Assembly[])
at Xamarin.Mac.Tests.MainClass+<Main>d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at Xamarin.Mac.Tests.MainClass.Main(System.String[])
at Xamarin.Mac.Tests.MainClass.<Main>(System.String[])
* [tests] Add a .NET/macOS version of monotouch-test.
I made a macOS version of monotouch-test instead of a .NET version of xammac tests,
so that one day we might have only one test suite for all our API tests.
* Add a project file for .NET/macOS
* Fix some code to handle the fact that we're called 'monotouchtest' on macOS (but
only on .NET).
* Ignore exception marshalling tests, those aren't working yet.
* [xharness] Add support for .NET/macOS and add a macOS version of monotouch-test to our tests
* [dotnet-linker] Skip libSystem.Net.Security.Native and libSystem.Native when collecting native methods to preserve for .NET/macOS.
* [tests][sampletester] Add nuget.org single feed to sampletester
Since we no longer upstream to nuget.org our sampletester is not
able to find packages so we create a nuget config file with a single
source to nuget.org to fix it and still be compliant.
* [tests][sampletester] Remove ConferenceVision sample, it no longer exists
* [tests][sampletester] Double TimeOut for a couple of tests
* [dotnet] Fixes builds for iOS physical devices from Windows
- We need to create output files for the AOTCompile task on Windows and copy the AOT Compiler to the Mac since it is part of a NuGet package that will not exist on the Mac
- The EmbedProvisionProfile task needs to be run remotely so the embedded.mobileprovision file is included in the app bundle
- When copying input files to the Mac for LinkNativeCode we should skip files that already exist on the Mac because those on Windows are empty. If we copy those we are essentially replacing the real files by the empty ones from Windows.
* Bumps Xamarin.Messaging
* Fixes spacing on LinkNativeCode
Changes the HintPath to the Messaging assembly to use OutputPath instead, otherwise the build fails when that property is different than `bin\$(Configuration)\netstandard2.0`
This required fixing the override code so that all (not just one) the
parameter types would match. Fixes
```
build/maccatalyst/reference/Xamarin.iOS.cs(11036,50): error CS0115: 'ARSCNView.HitTest(CGPoint, ARHitTestResultType)': no suitable method found to override
build/maccatalyst/reference/Xamarin.iOS.cs(11703,50): error CS0115: 'ARSKView.HitTest(CGPoint, ARHitTestResultType)': no suitable method found to override
```
Follow up to https://github.com/xamarin/xamarin-macios/pull/10658 and
https://github.com/xamarin/xamarin-macios/pull/10678
* [dotnet] Stops merging Messaging into Xamarin.iOS.Tasks
- Creates a separate Xamarin.Messaging project that will produce a single assembly after merging all the Xamarin Messaging dependencies.
- Stops merging Messaging into Xamarin.iOS.Tasks to be able to reference it from the Windows specific pack.
- Refactors the ILMerge.targets to reuse common code from ILMerge.Messaging.targets.
* [dotnet] Moves Windows specific tasks to the Windows tasks project
* [dotnet] Adds Xamarin.Messaging.dll to the different packages
* [msbuild] Add logic to build & install Xamarin.Messaging.dll.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Follow up to https://github.com/xamarin/xamarin-macios/pull/10658
This includes a `.ctor` chaining fix for the forwarder tool which
resulted in several errors like:
```
build/dotnet/maccatalyst/ref/Xamarin.iOS.cs(12640,17): error CS1729: 'UIScene' does not contain a constructor that takes 0 arguments
```
There's two different issues blocking ARKit and AddressBookUI that
will be solved in different PR.
When used with Xamarin.MacCatalyst we must still consider Xamarin.iOS.dll
as a platform assembly (and not user code) so the linker will remove more
code (that usual).
This is even more important as the stubs are unusable - so we do not want
to keep any extra pieces there since they would not work anyway.
* Bump .NET to 6.0.100-preview.2.21114.3.
* [dotnet-linker] Several steps are now gone, so load our custom step before the new first step (MarkStep).
* [dotnet-linker] Dump the current steps if we fail to call InsertBefore/InsertAfter.
* [dotnet-linker] Load the CollectAssembliesStep as the first step, and make it load every assembly.
* [dotnet] Set InvariantGlobalization=true because that's the only thing .NET supports for now.
* [dotnet-linker] Use recommended workaround for linker's inability to do load assemblies in custom step.
* [tests] Bump version of MSBuild.StructuredLogger to get support for new log version.
Otherwise this happens in tests that read binary logs:
System.NotSupportedException : Unsupported log file format. Latest supported version is 9, the log file has version 10.
* [introspection] Ignore P/Invokes to QCall for LogThreadPool* P/Invokes.
* [dotnet-linker] Inject a dummy implementation of mono_config_parse_memory as a temporary solution for mono's removal of the same method.
This fixes at least some variations of this failure:
* Protocol_17579: Add
Expected: Success
But was: DuplicateItem
In this test we try to delete any existing keychain items, but it seems that
may fail if the keychain item in question was created by a different app, in
which case we wouldn't have permission to delete it (but adding a new one
would still fail with a duplicate item error). Cleaning up any added keychain
items by the same test (and process) that added them avoids the permissions
problem.
Also clean up in other tests as well, to avoid filling up our keychain with
test stuff.
These will soon be used to build a .NET version of libxamarin (we need the
dylibs shipped with the runtime packs to link libxamarin.dylib).
We also write out the version of the runtime packs
(BundledNETCorePlatformsPackageVersion) so that we can use the version later
in our Makefiles.
* The manifest is gone, now we create an on the fly "manifest" using the "vsts-devdiv artifacts" json file
* Points VSMac to the selected Xcode path
* Switch to templated Xcode provisioning
* Turn Xcode symlinks into actual Xcode installations
Those show up with only `!unknown-*` inside extrospection tests.
There's a few more frameworks to disable but they require some changes
inside `src/generate-type-forwarders/Program.cs` and are better done in
separate pull-requests.
This does not have a huge impact (e.g. size) by itself. However it helps
to find duplicates in non-generated (manual) bindings and that will (in
future PR) remove them, which means less (manual) work to update the
attributes for net6.
Before (iOS)
> [FAIL] Duplicates: 555 API with members duplicating type-level attributes
After (iOS)
> [FAIL] Duplicates : 64 API with members duplicating type-level attributes
Notes
* The above test will be added in a PR, one that has 0 failure :)
* Ideally the duplicated entries would be removed from binding files (as
they are not needed, just noise) but that more work and a common source
of merge conflicts
* Some dupes exists due to protocol members inlining (and we might want
to fix this later)
* Bots are not produce the generator diff right now. Here's a manually
generated link to that diff
26915a5ad1/gistfile1.txt
That's a special case since filters are generated differently.
At this point it might makes sense to bite the rest of the bullet and
fix up the _general_ inlining of protocols... but that will be a
separate PR
* [dotnet-linker] Compute per-assembly linker flags.
This way we link with any system frameworks referenced by P/Invokes.
* [dotnet] Don't try to link with the Carbon framework unless we're on a Mac.
I'm not really sure we should handle this at all (it's System.Drawing.Common
package that tries to do this), but we'll see what happens.
The default was changed to be hybrid suspend, and due to bugs in Mono that
crashes:
https://github.com/dotnet/runtime/issues/47121
In the meantime we can go back to the older GC mode until Mono has fixed any
issues with the hybrid suspend mode.