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

15 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 34f58bbed4
[runtime] Use calloc instead of malloc. (#20692)
It's safer, since the returned memory is zero-initialized.

Also add tests.
2024-06-07 16:56:54 +02:00
Rolf Bjarne Kvinge 36af029204
Change all null checking expressions to use 'is' and 'is not'. (#18176)
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.
2023-05-05 17:52:19 +02:00
Rolf Bjarne Kvinge f06c4f2df1
[tests] Remove ignore due to custom code that's been gone for almost two years. (#17027)
We had custom code with Console.WriteLine for macOS 10.12 for a while, but that was removed here:

a93bcdec34

So there's no need to skip the test that verifies we don't call Console.WriteLine anymore.
2022-12-15 14:28:51 +01:00
Rolf Bjarne Kvinge e3f549fc7e
[tests] Improve cecil-tests's member filtering API. (#17001)
* Improve these methods to find members inside nested types as well.
* Simplify their implementation somewhat.
* Make the filter method optional to allow enumerating everything.
* Rename these methods to Enumerate* to better express what they do.
* Make them extension methods on AssemblyDefinition to make them more
  discoverable and easier to use.
2022-12-13 17:09:45 +01:00
Rolf Bjarne Kvinge 081505b173
[tests] Improve perf in cecil-tests by only loading assemblies once. (#16997)
Improve perf in cecil-tests by caching loaded assemblies, and thus only
loading them once. The gain isn't all that much - it saves about 3s of ~2m on
my machine, so ~1.5% faster - but it'll be more and more important as we write
more tests. Also the code becomes slightly simpler too.
2022-12-13 09:23:25 +01:00
Rolf Bjarne Kvinge deb0faa4f2
Autoformat cecil-tests.csproj. (#16103)
All other changes should be blank space only.

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2022-09-26 21:00:28 +02:00
Rolf Bjarne Kvinge a020f09979
[tests] Update the cecil tests to run on .NET assemblies. (#15969)
And not legacy assemblies if the legacy build is disabled.
2022-09-19 11:52:23 +02:00
Rolf Bjarne Kvinge 82482edc70
[cecil-tests] Improve these tests a bit. (#14994) 2022-05-13 20:50:02 +02:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Rolf Bjarne Kvinge 01dfd6f2f5
[cecil-tests] Fix string composition (#10781) 2021-03-04 16:40:53 +01:00
Sebastien Pouliot 11cec5096a
[tests][cecil] Check for absence of `[NoX]` (Unavailable) in platform assemblies. Fix #4835 (#9686)
It's way too easy to forget that attributes like `[NoiOS]` means the code
is not generated (for bindings) on that platform but that they will be
compiled for _manual_ bindings (not run thru the generator).

This can expose types (and API) that are not usable on some platforms.
This new test checks that the `[No*]` and `[Unavailable]` attributes
are not in their respective platform assemblies.

For compatibility (existing mistakes) we ignore the check on API that
are decorated with `[Obsolete]` attributes.

Changes in the bindings are fix such mistakes - mostly adding the
`[Obsolete]` attribute.

Fix https://github.com/xamarin/xamarin-macios/issues/4835
2020-09-30 07:56:48 -04:00
Sebastien Pouliot 76a61f1290
[runtime] Remove internal memcpy p/invoke (#8890)
* Replace `memcpy` with `Buffer.MemoryCopy`
* Add cecil-based test to make sure we're not p/invoke into it again (nor any other MS banned API)
* Remove `memcpy` from xtro ignore file
2020-06-19 09:41:54 -04:00
Sebastien Pouliot 4cc33f4d80
[src] Use `Runtime.NSLog` instead of `System.Console.WriteLine` (#8626)
inside the product assemblies [1]. The latter brings a lot [2] of the BCL
into the application for, eventually, ending up back to `NSLog` anyway

Also include a, cecil-based, test to ensure we don't regress.

[1] except for Xamarin.Mac.dll since there's a workaround for a
Sierra (only) bug

[2] https://gist.github.com/spouliot/c63343c1a76f4e49248be3a2c7aa25ed
2020-05-20 13:38:44 -04:00
Sebastien Pouliot ac01b522f0
[generator] Add missing `EnsureUIThread` for generated `init` and `initWithCoder` (#8250)
Fix https://github.com/xamarin/xamarin-macios/issues/8249
2020-03-31 17:20:44 -04:00
Sebastien Pouliot 7cbf90c5c6
[tests] Add cecil-based unit tests (#7825)
Only one to start... it's been discussed before but we generally
found other ways to do them. Let's continue to pick the best place
but we now have more options :)
2020-02-10 17:23:12 -05:00