Use NSLog instead of Console.WriteLine for tracing, because this makes it easier to trace what happens during a test run:
* NUnit will capture anything written to Console.Out/Console.Error during a
test run.
* Nothing will be printed if the process crashes during a test run.
* NSLog statements will be printed as they are executed, which makes it much
better for figuring out what happened just before a crash when running unit
tests.
Also make nullability warnings errors, so we don't add any more nullability issues.
Fixes:
src/bgen/Filters.cs(215,9): warning CS8602: Dereference of a possibly null reference.
src/bgen/Filters.cs(242,23): warning CS8604: Possible null reference argument for parameter 'str' in 'string StringExtensions.Capitalize(string str)'.
src/bgen/BindingTouch.cs(528,29): warning CS8604: Possible null reference argument for parameter 'item' in 'bool List<string>.Contains(string item)'.
This check is passing a remote url to an API that wants a url to a local file
(file:// url), and this is supposed to fail (it's not a network hiccup if it
fails).
However, sometimes it doesn't fail... for unknown reasons. So instead change
the test's expectations so that it passes whether using a remote url fails
with an error or not.
MidiCIDeviceIdentification isn't blittable ((yet)[1]), so exporting it makes
the AOT compiler complain. Use a different (but blittable) type instead in the
test.
[1]: 03f0a35012
This adds a managed static registrar, which is a variation of the static registrar
that takes advantage of a few new features in C# and the runtime, as well as avoiding
metadata tokens, which NativeAOT doesn't support.
This registrar will generate most of the trampoline/interop code as managed code
using Cecil, and the Objective-C part is as small as possible.
Fixes https://github.com/xamarin/xamarin-macios/issues/17324.
When using the managed static registrar, we register types with the static registrar
before the linker does its work, so we need to follow-up after the linker has figured
out what will be trimmed away to remove any such types from the list of registered types.
It's not needed until later anyway.
This way we can add code for the managed static registrar (which does not need the
token reference, in fact creating a token reference for a method won't be possible
with the managed static registra) in the correct location in the code.
The managed static registrar will add code to the processed assemblies, which means
it must run before the trimmer sweeps unused code.
This means we have to split the current registrar logic in two:
1. First we process all the assemblies.
2. Then we write out the results.
When not using the managed static registrar, these two steps happens right after
oneanother (like they do now), while when using the managed static registrar, the
processing is done before the trimmer sweeps (where we'll also generate all the new
IL code), and then the generated native code will be done at the end of the build
process (like for the old-school static registrar).