Change all null checking expressions to use 'is null' and 'is not null'
instead of '== null' and '!= null'.
This was mostly done with sed, so code can probably be improved in many
other ways with manual inspection, but that will come over time.
Also add code to the autoformat script to automatically fix these issues in the future.
The Xamarin.MacDev.Tasks.sln solution is built with dotnet, while other projects
are still built with msbuild. This becomes a problem when generating Errors.designer.cs,
because depending on the runtime the output is different.
This means that the Errors.designer.cs will sometimes randomly change (depending
on which project re-generated the file), leaving the file modified in git. This is
quite annoying, but it also breaks the api comparison, which depends on the build
not leaving modified files behind. So for now, we generate Errors.designer.cs separately
for Xamarin.MacDev.Tasks.sln to not conflict with the mtouch version.
Also fix capitalization in numerous places to be consistent (it's Errors.designer.cs,
not Errors.Designer.cs).
* ensure that outside invocations of IntPtr constructors will work correctly
* Remove E0017 and ignore such constructors instead of hard erroring, they exist in real life
- This change rewrite the IL instruction stream of newobj calls into NSObject derived ctors to convert the IntPtr to a NativeHandle via the implicit ctor
- Integration tests will come later as we execute a subset of the nugets we convert.
- Also fix a minor issue in showing E0016 as it was missing an argument in the error string.
- Fixes https://github.com/xamarin/xamarin-macios/issues/15133
Make our local .NET the default .NET (in the root's global.json), and then if
a directory wants to use the system .NET, then that directory would have to
opt-in (using its own global.json).
This way we don't have to copy global.json/NuGet.config files around to run
tests with the correct .NET setup.
* [nnyeah] Remove NNYEAH_IN_PROCESS on IntegrationExamples.cs as it was cursed due to global caching in nuget tool install
* [nnyeah] Simplify test API
* [nnyeah] Map NSObject ctors with IntPtr to NativeHandle
- Fixes https://github.com/xamarin/xamarin-macios/issues/15120
This required a significant amount of refactoring:
- To resolve the base type of objects, we need to invoke cecil's Resolve
- Resolve requires all assemblies to be loaded in memory, whcih requires a custom resolver to find them all
- Note: This requires customer assemblies to include all non-platform dependencies to be next to the input
- This extra state prompted a refactor of Program.cs to create a tool 'AssemblyConverter' with instance variables to reduce param passing
- The ctor mapping logic is isolated to ConstructorTransforms to reduce the growth of Reworker.cs and make limited unit testing possible
- Turns out the flat removal of the platform assembly from the import list was wrong, as it caused all platform references, such as NSObject to
be resolved from System.Runtime, which is wrong. So replace in place with the new platform assembly instead.
- Due to https://github.com/microsoft/vstest/issues/3658 it is not possible to test code that exits the process on error
- Create a base class for nnyeah exceptions that we want to explicitly report (and not crash), ConversionException
- Move Main to Main2 and wrap it in a try/catch for this exception
- 'Error while attempting to map member System.IntPtr Foundation.NSObject::get_Handle() in old assembly'
- Also fix a strange directory name created by Cache.CreateTemporaryDirectory being called from async test method
Clean up usage of modules in the app.
the var 'module' gets used all over the place. I'm going to refactor to fix up usage of imports and this will make things much easier to track.
In addition, there are a number of types that get used from module.TypeSystem.SomeType which I put into locals just to tidy up.