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

71 Коммитов

Автор SHA1 Сообщение Дата
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 d52fd8ddc8
[tests] Assert that we don't have any private IntPtr constructors in cecil-tests. (#17055) 2022-12-15 13:13:21 +01:00
Rolf Bjarne Kvinge 1c0f4e9c3c
[Network] Fix constructors in NWPathMonitor. (#16977)
* Call _SetUpdatedSnapshotHandler from the (NativeHandle, bool) constructor,
  this way it's called from all constructors.
* Call the (NativeHandle, bool) constructor from all other constructors to
  ensure a consistent instance.
* Remove the internal (IntPtr) constructor, it's no longer used. This also
  fixes a memory leak, because the (IntPtr) constructor would just create a
  new nw_path_monitor instance instead of using the passed-in handle
  (effectively forgetting about it and leaking it).
2022-12-15 08:03:20 +01:00
Rolf Bjarne Kvinge ffad05b9a3
[tests] Use .NET to build cecil-tests. (#17028)
Use .NET to build cecil-tests, using the appropriate verbosity, and creating a
binlog as well.
2022-12-14 22:35:50 +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 0ba8d7e0e2
[tests] Fix potential NullReferenceException in cecil-tests. (#16998)
Fixes this compiler warning:

    tests/cecil-tests/MarshalAsTest.cs(91,8): warning CS8602: Dereference of a possibly null reference.
2022-12-12 17:14:29 +01:00
Rolf Bjarne Kvinge 660ff60ad5
[tests] Improve performance a bit in Cecil.Tests.GenericPInvokesTest. (#16999)
Improve performance in Cecil.Tests.GenericPInvokesTest by creating fewer
strings.

This saves about 1m07s seconds on my machine, from 2m10s to 1m03s, so ~52%
faster.
2022-12-12 15:29:47 +01:00
Rolf Bjarne Kvinge cc5c1bb4bf
[tests] Adjust cecil-tests to not test 32-bit iOS assemblies unless 32-bit iOS architectures are enabled. (#16989) 2022-12-07 18:24:14 +01:00
Rolf Bjarne Kvinge 7f2d7dcce5
[tests] We don't want exceptions to the obsolete test to apply anymore in XAMCORE_5_0 in cecil-tests. (#16991)
That's the time to fix those exceptions.
2022-12-07 17:42:11 +01:00
Steve Hawley 3c512a8331
[net8.0] added a test for blittability of pinvokes, partial #15684 (#16525)
This adds a unit test to check for blittability of arguments to
pinvokes.
2022-12-06 14:35:16 -05:00
Haritha Mohan 51afd316cc
[tests] Ensure proper capitalization in API (#16840)
Use reflection to detect incorrectly capitalized public methods, fields,
properties, and events.
Fixes #15733

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-11-28 12:11:27 -08:00
Rolf Bjarne Kvinge e7653c5cde
[tests] Adjust the NoAvailabilityOnError cecil test to look in and work with .NET assemblies as well. (#16891)
Also remove some unnecessary null-checking code.
2022-11-28 18:03:47 +01:00
Israel Soto d910c1ba60
[GameController] Added support to Xcode 14.1 b1 (#16094)
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-10-13 11:42:52 -04:00
Israel Soto 9543d817f4
[MapKit] Add support for Xcode 14 beta 1 & 2 & 5 (#15562) 2022-10-12 12:10:01 -04:00
Rolf Bjarne Kvinge c7badeacf1 Merge main into xcode14.1. 2022-10-04 16:21:54 +02:00
Alex Soto 27e6958b0a
[xcode14.1] Bump to Xcode 14.1 Beta 3 (#16010)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-10-03 17:24:41 +02:00
Rolf Bjarne Kvinge 7e6edcbc36
[Network] Fix a few issues with the callbacks in NWPath. Fixes #13772. (#16138)
* Change EnumerateGateways to use the 'static_EnumerateGatewaysHandler'
  callback. It looks like this was a c&p error, since the
  'static_EnumerateGatewaysHandler' callback was implemented, just never
  referenced anywhere.
* Add an overload to EnumerateGateways and EnumerateInterfaces that takes a
  callback that returns a bool indicating whether the enumeration should
  continue. This mirrors the native API.
* Obsolete the EnumerateGateways and EnumerateInterfaces overloads that take a
  void callback (and remove in XAMCORE_5_0).
* Add a test for EnumerateGateways that works (the previous failed, but never
  asserted the failure, so it would just silently time out).

Fixes https://github.com/xamarin/xamarin-macios/issues/13772.
2022-10-03 12:11:52 +02:00
GitHub Actions Autoformatter 14f7a23833 Auto-format source code 2022-09-26 20:49:33 +00:00
Rolf Bjarne Kvinge 9c3458dc33 Merge main into xcode14.1. 2022-09-26 22:46:59 +02: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 f4d5e6eeab Merge main into xcode14.1. 2022-09-22 07:50:58 +02:00
Rolf Bjarne Kvinge 8e92e9e5c5
[tests] Ignore tests that require platforms not included in the current build. (#16000) 2022-09-22 07:33:42 +02:00
Steve Hawley ea3f7d28dc
[.NET] added cecil tests for generic pinvokes and generic delegates. Fix for #11771 (#15974) 2022-09-20 10:23:53 -04:00
Rolf Bjarne Kvinge b230ef3601 Merge remote-tracking branch 'origin/main' into bump-main-in-xcode14.1-2022-09-16 2022-09-19 14:11:45 +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
Manuel de la Pena b99f35a800
[AuthenticationServices] Add support for Xcode 14 beta 4. (#15604)
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
2022-09-07 11:11:34 -04:00
Manuel de la Pena e95ae331e3
[Mediaplayer] Add support for xcode14 beta 4. (#15654)
Co-authored-by: Alex Soto <alex@alexsoto.me>
2022-08-26 10:38:21 -04:00
Chris Hamons 3c359f5838
[foundation] Xcode 13 & Xcode 14 beta 1-3 bindings (#15579)
- Xcode 13 section Based upon https://github.com/xamarin/xamarin-macios/pull/13328- 
- Some disabled due to https://github.com/xamarin/maccore/issues/2608
2022-08-01 10:22:39 -05:00
Rolf Bjarne Kvinge 9b991f2c0b [tests] We've started adding obsolete API to our .NET profiles now. 2022-06-28 21:40:53 +02:00
Manuel de la Pena b1ea4b51aa
[CI] Allow tests to be ran in parallel. (#15322)
This allows the CI to run ALL the tests that the project has in
parallel. This is divided in two main changes:

1. Xharness - We move away from using boolenas to use a flag that states
   the tests to run.
2. yaml - We have move the code to use a template per label. This new
   jobs all run in parallel and the results are later collected by a
   funel job
3. pwsh - Added a new class that understands that we have several mark
   downs with the tests results. The classes parses them and them writes
   a single comment (and example can be found here: https://github.com/xamarin/xamarin-macios/pull/15201#issuecomment-1162366240

The changes gives the following advantages vs how we used to run tests:

1. The CI run for all tests moves from taking 13 hours to 3/4 hours
   (depending on the number of bots in the pool).
2. The download needed to verify the results on a case of failure is
   smaller. Rather than downloading several GBs we now just download
   that part of the html that we are interested in.
3. Better bot utlization. Bots are just used to a max of 2 hours, this
   means that we can use the bots better since they are fragmented.
4. Less VMs. VSDrops has added support for macOS and Linux, we take
   advanges of that here.


Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-06-23 08:54:21 -04:00
Rolf Bjarne Kvinge 82482edc70
[cecil-tests] Improve these tests a bit. (#14994) 2022-05-13 20:50:02 +02:00
Chris Hamons 1dcefc9c56
[NET Attribute Conversion][generator] Generate NET style attributes (#14779)
This PR teaches our code generator to generate .NET 6 style availability attributes, adds a 4th Cecil test to verify our generated attributes, and a metric ton of API changes to satisfy that test.

The generator work is the core of this PR, and includes:

- Hacking out chunks of generator.cs that "helpfully" remove duplicate attributes, which are no longer duplicate in the new order that NET6 attributes force upon us. See changes in FilterMinimumVersion and PrintPlatformAttributes
- Prevent a crash when the generator processes availability attributes with no version included (example: introduced on iOS but no version). See Is64BitiOSOnly.
- The meat, GetPlatformAttributesToPrint, which synthesizes many attributes "out of thing air" from:
        - The parent context
        - Implied introduced just because the class exists on a given framework at all
        - Implied Catalyst because iOS exists
- A few cludgy hacks PrintPlatformAttributesNoDuplicates and GenerateProperty because the existing PrintPlatformAttributes did not pass down parent context down, and the refactor was dangerous/too time consuming given time pressure.

There are two intended API changes introduced by the reviews in this PR:

- GetCurrentInputDevice was obviously intended by availability attributes to exist on Catalyst but due to define confusion was excluded. It is an addition in Microsoft.MacCatalyst.dll only.
- The NEAppRule constructors were mis-marked on platforms, and were showing up incorrectly on Mac/Catalyst. I corrected the Catalyst one unconditionally, as we have not shipped Catalyst yet, but Mac is only fixed in NET6.

There is a lot of follow up work in https://github.com/xamarin/xamarin-macios/issues/14802 to do to remove a number of hard coded test failures, but this should be almost all of the remaining work in NET6 attributes.

🤞 this doesn't break too much for future us.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-05-02 09:44:25 -05:00
Chris Hamons cf77b790cb
[NET Attribute Conversion] Add missing attributes in code-behind by re-running conversion (#14660)
* [NET Attribute Conversion] Chip Framework
* [NET Attribute Conversion] Rerun with many fixes
* Fix generator crash when compiling attributes with no introduced version
* Test changes for availability re-run. One new test
2022-04-07 10:46:15 -05:00
Rolf Bjarne Kvinge 6af4b9607c
[tools] Make the TargetFramework.DotNet* variables version-agnostic. (#14669)
This minimizes the code changes required for .NET 7.
2022-04-06 21:33:46 +02:00
Rolf Bjarne Kvinge 0887599ccb
[cecil-tests] Enable previously disabled tests. (#14587)
Looks like these might be fixed now.

Fixes https://github.com/xamarin/maccore/issues/2547.
2022-04-01 07:22:27 +02:00
Manuel de la Pena e07b7bef79
[CI] Move tests outside of the build machine. (#14105)
Move the execution of tests to a diff bot to be compliant with the latests EO.
2022-03-10 23:36:37 -05:00
Rolf Bjarne Kvinge df491ed4b3
[cecil-tests] Improve the obsolete member test. Fixes #13621. (#14258)
* Check implementation assemblies instead of reference assemblies.
* Try to print the source code location for failing API (this required processing
  the implementation assemblies, because the reference assemblies don't have debug
  information where the source code location is stored).
* Don't report API that has [EditorBrowsable (None)] attributes, presumably we
  decided to keep these for compatibility, while highly discouraging their
  continued use. Also stop doing this for the next time we can do a breaking
  change, maybe we can remove these APIs then.
* Don't report API that has [UnsupportedOSPlatform ("...#.#") attributes (with
  a version number), presumably this is API that is still valid for some OS
  versions.
* Enable the test for all APIs (no ignores anymore). It's green!

Fixes https://github.com/xamarin/xamarin-macios/issues/13621.
2022-02-28 11:26:44 +01:00
Rolf Bjarne Kvinge e25163f573
[.NET] Rename our product assemblies. Fixes #13748. (#13847)
Rename our product assemblies to:

* Microsoft.iOS.dll
* Microsoft.tvOS.dll
* Microsoft.macOS.dll
* Microsoft.MacCatalyst.dll

This makes it easy to distinguish between legacy Xamarin and .NET whenever the
product assembly is mentioned, and I've also chosen the platform part of the
name to match how the platforms are named elsewhere (this also makes it
possible to simplify our build logic, since we can remove a lot of special
casing).

Fixes https://github.com/xamarin/xamarin-macios/issues/13748.
2022-02-16 21:30:32 +01:00
Stephane Delcroix f36606e654
[C] Clear OpenTK namespace (#13767)
fixes #13160

- remove unused types
- use System.Numerics when possible
- move own created types from OpenTK namespace to CoreGraphics
- create missing types in CoreGraphics namespace

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-02-14 18:50:23 +01:00
Chris Hamons 39d52ba64f
[tests] Add disabled NET6 availability attribute test (#14106) 2022-02-11 09:11:02 -06:00
Rolf Bjarne Kvinge a34ca54cc2
[src] Make sure the (IntPtr/NativeHandle, bool) ctor is always preserved (conditionally) for types that subclass NativeObject. Fixes #13699. (#13708)
Also add test to make sure we never forget again.

Fixes https://github.com/xamarin/xamarin-macios/issues/13699.
2022-01-14 15:26:23 +01:00
Rachel Kang 304048a965
Add cecil test for verifying obsoleted apis (#13590)
* First version cecil test

* Add missing net6 platform assemblies

* Make it work for Catalyst

* Add namespace switch and clean up code

* Update based on feedback

* Update based on feedback

* Update based on feedback

* Make test pass by default

* Fix bgen tests by fixing GetRefNuGetName

* Update based on feedback

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2022-01-12 09:47:46 -05:00
Rolf Bjarne Kvinge d7d2409dc0 [tests] Adjust cecil-tests according to nint/nuint changes. 2021-12-03 18:36:36 +01:00
Rolf Bjarne Kvinge b92f79fe1b [tests][cecil-tests] Add new test to verify the constructors we expose.
Verifies that:

* There shouldn't be any (IntPtr) or (IntPtr, bool) constructors.
* The (NativeHandle) or (NativeHandle, bool) constructors should not be public.
* The constructors correctly chain to the base constructor according to our usual
  pattern: the (IntPtr) ctor must chain to the self/base (IntPtr, bool) constructor
  passing 'false' for the owns parameter.
* The constructors don't have any extra code in them (barring a few exceptions).
2021-11-26 14:25:21 +01:00
Manuel de la Pena 339936f457
[Tests] Fix cecil tests. (#12853)
-  Added the marshaling attr and a test to ensure it is ok.
- Fix the cecil MarshalAs test to not skip over types when checking.
    This revealed multiple tests failures that needed fixing.

fixes: https://github.com/xamarin/maccore/issues/2519

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-09-28 08:09:23 -04: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
dotnet-maestro[bot] 68476989f4
[main] Update dependencies from dotnet/installer (#12245)
* Update dependencies from https://github.com/dotnet/installer build 20210727.4

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-rc.1.21376.3 -> To Version 6.0.100-rc.1.21377.4

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21370.1 -> To Version 6.0.100-preview.6.21376.2 (parent: Microsoft.Dotnet.Sdk.Internal

* Bump Mono.Cecil from 0.11.3 to 0.11.4.

* [dotnet-linker] Reference Mono.Cecil 0.11.4 directly.

Works around https://github.com/mono/linker/issues/2173.

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-07-28 09:46:36 +02:00
Rolf Bjarne Kvinge d9b71dcd37
Turns out we need MarshalAs for characters as well. (#10785)
The default marshalling size for characters in .NET is a single byte, and that
is potentially lossy (and causes tests to fail for non-ascii characters).
2021-03-05 07:22:14 +01:00
Rolf Bjarne Kvinge 01dfd6f2f5
[cecil-tests] Fix string composition (#10781) 2021-03-04 16:40:53 +01:00