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

15101 Коммитов

Автор SHA1 Сообщение Дата
dotnet-maestro[bot] dffdf2231d
[main] Update dependencies from dotnet/installer (#17137)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer
- **Subscription**: 50c9492e-4671-4d1d-7920-08dabd1031a2
- **Build**: 20230103.11
- **Date Produced**: January 4, 2023 1:47:28 AM UTC
- **Commit**: e0c95ad21e5eac311e454c65335008161b3e4763
- **Branch**: refs/heads/release/7.0.1xx

- **Updates**:
- **Microsoft.Dotnet.Sdk.Internal**: [from 7.0.102-servicing.22609.1 to
7.0.103-servicing.23053.11][6]

[6]: 3c4322d...e0c95ad

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <github-actions@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2023-01-10 08:05:41 +01:00
Rolf Bjarne Kvinge 72257f427a
[generator] Add run configuration in csproj to run/debug the maccatalyst version. (#17124) 2023-01-09 17:50:27 +01:00
github-actions[bot] fcb1de1312
[Localization] Pulling New Localization Translations $GITHUB_RUN_ID (#17150)
Automated PR. Bring new translated changes in the lcl files for
OneLocBuild to create translated resx files.

Co-authored-by: csigs <csigs@users.noreply.github.com>
Co-authored-by: CSIGS <csigs@outlook.com>
2023-01-09 09:20:39 -06:00
Steve Hawley f54009ca3c
[dotnet] replace strings in pinvokes (#17151)
handled security pinvokes
2023-01-09 09:44:02 -05:00
Rolf Bjarne Kvinge 5e72799e28
[Foundation] Add missing fields in NSAttributedStringDocumentReadingOptionKey. (#17112) 2023-01-09 11:38:19 +01:00
dotnet-maestro[bot] 123f7f763c
[main] Update dependencies from dotnet/runtime (#17146)
This pull request updates the following dependencies

## From https://github.com/dotnet/runtime
- **Subscription**: 38d2313f-22d5-4062-c8e1-08dabd6d8c77
- **Build**: 20230104.16
- **Date Produced**: January 5, 2023 8:39:14 AM UTC
- **Commit**: a79086876caca5e38693e0a2ebfefdedf5d9b915
- **Branch**: refs/heads/release/7.0

- **Updates**:
  - **Microsoft.NETCore.App.Ref**: [from 7.0.2 to 7.0.3][4]

[4]: 8ac3832...a790868

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2023-01-09 10:57:41 +01:00
Rolf Bjarne Kvinge d09d147718
[ObjCRuntime] Enable nullability in Runtime.CoreCLR.cs (#17114)
And fix the resulting build errors+warnings.
2023-01-09 10:44:32 +01:00
Rolf Bjarne Kvinge d1aaf8e1c0
[tests] Make the helper makefiles for .NET tests more helpful. (#17122)
Make the helper makefiles for .NET tests more helpful by adding support for
universal apps, and also document the most relevant targets.
2023-01-09 10:43:45 +01:00
Rolf Bjarne Kvinge ab0294169f
[xharness] Bump the timeout for the .NET tests. (#17110)
We keep adding more and more tests...
2023-01-09 10:42:09 +01:00
Rolf Bjarne Kvinge a26e3c57f4
[tests] Enable some of the asserts in the Cecil.Tests.ApiAvailabilityTest.AttributeConsistency test. (#17113)
They're passing now.
2023-01-09 10:40:57 +01:00
Rolf Bjarne Kvinge f0644579c4
[XKit] Remove incorrect availability attribute. (#17119)
NSCocoaVersionDocumentAttribute has always been available on macOS.
2023-01-09 10:40:35 +01:00
TJ Lambert eae0930fcb
[Localization] Change the line endings to use LF instead of CRLF (#17155)
Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
2023-01-09 10:28:08 +01:00
Steve Hawley 6e1ba31bae
[dotnet] CoreGraphics convert strings in pinvokes (#17135)
converted all pinvokes in CoreGraphics to use `IntPtr` instead of
`string`.
2023-01-06 11:24:22 -05:00
VS MobileTools Engineering Service 2 a6c71fec74
Localized file check-in by OneLocBuild Task: Build definition ID 17751: Build ID 7141571 (#17131)
This is the pull request automatically created by the OneLocBuild task
in the build process to check-in localized files generated based upon
translation source files (.lcl files) handed-back from the downstream
localization pipeline. If there are issues in translations, visit
https://aka.ms/ceLocBug and log bugs for fixes. The OneLocBuild wiki is
https://aka.ms/onelocbuild and the localization process in general is
documented at https://aka.ms/AllAboutLoc.
2023-01-05 10:11:06 -06:00
Steve Hawley 8e0bb5d3f1
[dotnet] blitable network pinvokes (#17071)
fix all pinvokes in the Network package that use strings
2023-01-03 10:45:00 -05:00
Rolf Bjarne Kvinge 491c5c979c
[src/tests] Fix consistency between ObsoletedOSPlatform and UnsupportedOSPlatform attributes. (#17104)
* If there's both an UnsupportedOSPlatform and ObsoletedOSPlatform attribute with
  the same version, then remove the UnsupportedOSPlatform attribute. This is because
  in the past we used [UnsupportedOSPlatform] + [Obsolete] to indicate that an API
  is obsolete, but then the [ObsoletedOSPlatform] attribute was added, and we replaced
  the [Obsolete] attributes with [ObsoletedOSPlatform] attributes, which makes the
  [UnsupportedOSPlatform] attributes redundant/incorrect.
* If there's [UnsupportedOSPlatform] with a version or [ObsoletedOSPlatform] with
  a version, then also add [SupportedOSPlatform] in a few cases.
* If there's an [UnsupportedOSPlatform] with a version for API that's obsolete/non-working,
  then remove the version.
2022-12-22 12:40:04 +01:00
Timothé Larivière 3b73bb658b
Add an additional F# template for Microsoft.iOS.iOSApp (#16823)
Closes #16822 

This PR adds an F# template to the basic Microsoft.iOS.iOSApp template.
This should allow being able to do either:

```
dotnet new ios -lang C# -n MyApp
dotnet new ios -lang F# -n MyApp
```

I had to move the C# template into a `csharp` folder.
Also added the `groupIdentity` `Microsoft.iOS.iOSApp` and set the identity for both C# and F# respectively to `Microsoft.iOS.iOSApp.CSharp` and `Microsoft.iOS.iOSApp.FSharp`

Co-authored-by: Timothé LARIVIERE <timothe.lariviere@fundourselves.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-12-22 12:04:36 +01:00
Rolf Bjarne Kvinge 2268a81bc2
[AppKit] Try to make NSWindow.ReleasedWhenClosed work. Fixes #8606. (#17105)
NSWindow.ReleasedWhenClosed is a rather annoying API, because it interferes with
reference counting. In effect it behaves kind of like autoreleasing does, except
that the object (window) is released at a different time (when the window is closed,
as opposed to when the autorelease pool drains).

We've tried to fix this in the past in several ways:

* Forcefully disable ReleasedWhenClosed in all the constructors, and if it's set
  in the Close method, then add an extra Retain call to offset the imminent extra
  release. The unfortunate side-effect is that we also call Dispose, which might
  be too early (see #8606).

* Rewrite the code to correctly override the native 'close' method, so we get the
  supposedly correct semantics (our special Close code is called) when the window
  is closed by Objective-C (for instance when the user hits the red X to close the
  window). This doesn't really solve the previous problem (we're calling Dispose
  too early), and it doesn't work for non-subclassed NSWindows (see #8717).

So I'm trying another approach: track the value of ReleasedWhenClosed, and call Retain/Release
when the value switches between true/false. This way we don't need any special logic
in the Close method.

I've also:

* Marked the ReleasedWhenClosed property as obsolete, and added a DangerousReleasedWhenClosed
  property, to match how we bind the other reference counting methods (retain ->
  DangerousRetain, release -> DangerousRelease, etc.).

* Added a ReleaseWhenClosed(bool) method, to be called instead of the ReleasedWhenClosed
  property, and this method will call DangerousRetain/DangerousRelease as described
  above when the ReleasedWhenClosed property changes value.

This new tracking behavior is opt-in for now, but will become opt-out in .NET 9,
and hopefully we'll be able to make it the only behavior at some point (in .NET 10
maybe?).

Fixes https://github.com/xamarin/xamarin-macios/issues/8606.
Fixes https://github.com/xamarin/xamarin-macios/issues/8607.

Ref: https://github.com/xamarin/xamarin-macios/pull/8717.
2022-12-22 08:16:18 +01:00
Andoni Morales Alastruey efad190de9
[msbuild] Validate OutputType property (#16871)
Fixes #16865

```
➜  test dotnet build  -bl:msbuild.binlog
MSBuild version 17.3.2+561848881 for .NET
/usr/local/share/dotnet/sdk/6.0.403/MSBuild.dll -bl:msbuild.binlog -consoleloggerparameters:Summary -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/local/share/dotnet/sdk/6.0.403/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/local/share/dotnet/sdk/6.0.403/dotnet.dll -maxcpucount -restore -verbosity:m ./test.csproj
  Determining projects to restore...
  All projects are up-to-date for restore.
/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/12.3.471/targets/Xamarin.Shared.Sdk.targets(284,3): error : WinExe is not a valid output type for macOS [/Users/andoni/Downloads/test/test.csproj]

Build FAILED.

/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/12.3.471/targets/Xamarin.Shared.Sdk.targets(284,3): error : WinExe is not a valid output type for macOS [/Users/andoni/Downloads/test/test.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.14
```

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-12-22 07:36:04 +01:00
dustin-wojciechowski b94f1c3de5
[tests] Created Test to find Getters that throw Exceptions directly. (#16923)
Added GetterExceptionTest, which examines IL of Property Getters for exceptions.

Fixes #16669

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2022-12-21 09:34:13 -08:00
Rolf Bjarne Kvinge 322ce2d412
[Foundation] Remove workaround for broken thread pool in Mono. Fixes #7080. (#17082)
Completely remove a workaround for an issue with the thread pool in Mono.
We've previously turned this workaround off by default, and we got no reports
of any problems.

Fixes https://github.com/xamarin/xamarin-macios/issues/7080.
2022-12-21 18:17:15 +01:00
Rolf Bjarne Kvinge 376081f611
[Foundation] Unify NSAttributedStringDocumentReadingOptionKeys and NSAttributedStringDocumentReadingOptionKey. (#17093)
Move the remaining field in NSAttributedStringDocumentReadingOptionKeys into
NSAttributedStringDocumentReadingOptionKey to share more code, and update code
accordingly.

Also remove redundant [Internal] attributes on
NSAttributedStringDocumentReadingOptionKey fields, because the type itself is
[Internal].

This has no effect on public API, because it's all internal.
2022-12-21 18:16:55 +01:00
Rolf Bjarne Kvinge 67607853aa
[src/tests] Improve the cecil test checking for obsolete API. (#17091)
* Hide all obsolete API using the EditorBrowsable atribute.
* Iterate over everything with availability attributes in the test.
2022-12-21 18:15:43 +01:00
Rolf Bjarne Kvinge 834bb92cb0
[tests] Update .NET tests to cope with updated min OS version and no more 32-bit iOS support. (#17088) 2022-12-21 18:15:28 +01:00
Rolf Bjarne Kvinge 37594bd8b9
[tests] Remove duplicated Import to fix build warning. (#17100)
Fixes:

    xamarin-macios/tests/framework-test/dotnet/shared.csproj(43,3): warning MSB4011: "xamarin-macios/tests/nunit.framework.targets" cannot be imported again. It was already imported at "xamarin-macios/tests/common/shared-dotnet.csproj (69,2)". This is most likely a build authoring error. This subsequent import will be ignored.
2022-12-21 18:15:02 +01:00
Rolf Bjarne Kvinge b765cf90a3
[tests] Update MTouch tests to cope with potentially higher min OS version and no 32-bit iOS support. (#17087) 2022-12-21 18:14:46 +01:00
Rolf Bjarne Kvinge 6c04f7621a
[tools] Update SdkVersions.cs after the latest Xcode 14.2 bump. (#17101)
* Update `SdkVersions.cs` after the latest Xcode 14.2 bump.
* Rename `[SdkVersions|ProductConstants].cs.in` to `[SdkVersions|ProductConstants].in.cs`.
  This way the autoformatter makes sure it's formatted correctly.
2022-12-21 17:44:27 +01:00
Rolf Bjarne Kvinge e99c71ad36
[tests] Fix a few nullability issues in cecil-tests and the .NET tests. (#17095)
Also make any nullability warnings show up as errors.
2022-12-21 10:19:13 +01:00
Alex Soto a7502b2b8d
[main] Bump bindings to Xcode 14.2 (#17037) 2022-12-21 08:39:03 +01:00
Rolf Bjarne Kvinge 68a08ad217
[Foundation] Make NSAttributedStringDocumentType a strongly-typed enum. (#17094)
This simplifies our code somewhat, and in XAMCORE_5_0 we can simplify
even more.

Ref: https://github.com/xamarin/xamarin-macios/issues/14489
2022-12-21 07:45:56 +01:00
Rolf Bjarne Kvinge fe5abf4d2d
[AppKit] Add missing fields to the NSKey enum. Fixes #17085. (#17086)
Fixes https://github.com/xamarin/xamarin-macios/issues/17085.
2022-12-21 07:44:51 +01:00
Rolf Bjarne Kvinge 43170cb37e
[tests] Add cecil-test to verify that the obsolete messages are identical between platforms for a given API. (#17089) 2022-12-21 07:44:15 +01:00
Rolf Bjarne Kvinge d9bae59f69
[src/generator/tests] Verify that availability attributes don't include useless version information. Fixes #11029. (#17090)
* Change the generator to not write the version in SupportedOSPlatform
  attributes unless it's greater than min OS version.
* Fix a few redundant Mac Catalyst availability versions.
* Uncomment the test to verify that availability attributes don't include
  useless version information.

Fixes https://github.com/xamarin/xamarin-macios/issues/11029.
2022-12-21 07:44:02 +01:00
Rolf Bjarne Kvinge 83b0727967
[tests] Port and improve the availability attribute test from introspection. (#17083)
Port the availability attribute test from introspection to cecil-tests. It's much
easier and faster to test attributes using Cecil using a desktop executable than
having to execute a test app on each target platform.

This also means that we can make the ApiAvailabilityTest in introspection
legacy-only.

Ref: https://github.com/xamarin/xamarin-macios/issues/10834
2022-12-20 12:46:06 +01:00
Rolf Bjarne Kvinge a227b77402
[generator] tvOS attributes aren't implied from iOS attributes. (#17057)
This hasn't been a problem until now because we've always had tvOS attributes on
most API, but when bumping min OS versions for .NET 8, we'll also remove a lot of
redundant availability attributes. This would break a case where a type is unavailable
on all platforms except tvOS (but without any tvOS availability attribute), and then
we'd get the (implied) iOS (un)availability attribute.
2022-12-20 07:29:19 +01:00
Rolf Bjarne Kvinge e10e5e51aa
[MapKit] Move MKOverlayView.MKRoadWidthAtZoomScale to MKOverlayRenderer. (#17078)
MKRoadWidthAtZoomScale is a P/Invoke we decided to put in the MKOverlayView
class a long time ago.

This is problematic, because the P/Invoke is available on more platforms than
MKOverlayView (and the MKOverlayView class is deprecated, while the P/Invoke
is not), which it impossible to get the availability attributes right.

So instead move the P/Invoke to the MKOverlayRenderer class (but keep the old
code around until XAMCORE_5_0 for backwards compat reasons). The
MKOverlayRenderer class is the replacement for the deprecated MKOverlayView
class, and it's also available on all the platforms the P/Invoke is available,
so the availability attributes are now trivial.
2022-12-19 20:58:43 +01:00
Rolf Bjarne Kvinge 968f9d1214
[WebKit] Merge WKWebKit into WebKit. (#17062)
A long time ago, Apple created WebKit bindings for macOS, and we bound those in the webkit.cs and WebKit/*.cs files. These were later deprecated in macOS 10.14.

A bit later (iOS 8.0 / macOS 10.10) Apple created new (and severely limited) WebKit API for both iOS and macOS, and since these were quite different/new, we bound them in wkwebkit.cs and WKWebKit/*.cs files.

However, the actual namespace for both is WebKit, which leaves us with a few special-cases in our code to handle the fact that we've bound the same namespace in different files/directories.

Unifying these implementations in webkit.cs and WebKit/*.cs, makes it possible to avoid these special cases.

I've also explicitly added No* availability attributes to the old and deprecated macOS bindings for all other platforms than macOS, in order to avoid more special-casing when it comes to availability attributes (and that logic is already complicated enough as it is).
2022-12-19 18:37:53 +01:00
Rolf Bjarne Kvinge 01123bfb0e
[tests] Fix the AppWithNativeDynamicLibrariesInPackageReference to work when not all platforms are enabled. (#17081) 2022-12-19 18:37:10 +01:00
Rolf Bjarne Kvinge e06f49dd90
[dotnet] We no longer need to add the entry assembly as a root assembly for the linker. (#17026)
It's automatically done in the linker's MSBuild logic.

Not only is it no longer necessary (hasn't been for a while), it'll be wrong
in .NET 8 after https://github.com/dotnet/linker/pull/3124.
2022-12-19 18:36:54 +01:00
Rolf Bjarne Kvinge 65f362a115
[dotnet] Add [SupportedOSPlatformGuard] attributes to UIDevice.CheckSystemVersion. Fixes #16250. (#16513)
This requires the fix for https://github.com/dotnet/roslyn-analyzers/issues/6204
to be shipped in .NET 7 first. This will likely happen in .NET 7.0.200, which we'll
likely ship from main, thus I'm merging this into main.

Fixes https://github.com/xamarin/xamarin-macios/issues/16250.
2022-12-16 17:22:41 +01:00
Rolf Bjarne Kvinge d6cb31402f
[tools] Split tools/common/SdkVersions.cs in two files. (#17067)
We need parts of tools/common/SdkVersions.cs when building tests on Windows.
In order to simplify our Windows-life, we're going to check in the generated
SdkVersions.cs file, that way it won't have to be re-generated on Windows (the
logic is very make-based, and not easily executed on Windows).

However, parts of SdkVersions.cs would change every commit, which would make
the above solution rather annoying. So split out those parts into a new file
(ProductConstants.cs), which is still generated during the build (and not
checked in).
2022-12-16 15:25:53 +01:00
Rolf Bjarne Kvinge e69d361c11
[Foundation] Unify the source code for NSAttributedStringDocumentAttributes. (#17069)
Unify the source code for NSAttributedStringDocumentAttributes between
iOS and maOS.

As a result, we're now exposing a few APIs on macOS that were previously
only exposed on iOS.

This PR might be easier to review commit-by-commit.
2022-12-16 15:23:24 +01:00
Rolf Bjarne Kvinge 574031059d
[tests] Improve the Bug35176 generator test. (#17070)
Make it assert on the exact list of attributes we're expecting. This makes it
much easier to see what changed.
2022-12-16 15:20:06 +01:00
Andoni Morales Alastruey 4cfccff38e
Fix libs reidentification deployed in a subdirectory (#16706)
Dynamic libraries might be deployed in subdirectories such as libclrjit.dylib from the nuget package cefglue.common:
Contents/MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

The library ID for that library should be: @executable_path/../MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

Instead of: @executable_path/../MonoBundle/libclrjit.dylib

Beside the library ID being wrong, when it's combined with the nuget package microsoft.netcore.app.runtime.osx-x64 providing a library with the same name, both uses the same `ReidentifiedPath`, which can cause a failure in the InstallNameTool tasks that are run in parallel operating on the same temporary file.

The following patch uses the `RelativePath` for the tempory file used by `InstallNameTool` so that there are no clashes with other files with the same name deployed in other directories. It also uses the `RelativePath` to create the correct library id: @executable_path/../../Contents/MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

Partially fixes https://github.com/xamarin/xamarin-macios/issues/15173 for this scenario
2022-12-16 09:17:01 +01:00
Rolf Bjarne Kvinge fc487c2f59
[src] Remove unnecessary versions in .NET availability attributes. (#17061)
There's no need to specify versions earlier than the earlier OS version we support.

This was done with a bit of sed:

    # SupportedOSPlatform ("ios7.0") -> SupportedOSPlatform ("ios")
    sed -i '' -E 's/SupportedOSPlatform [\(]"ios7[.]0"[\)]/SupportedOSPlatform ("ios")/' ./*.cs ./*/*.cs

    # SupportedOSPlatform ("tvos9.0") -> SupportedOSPlatform ("tvos")
    sed -i '' -E 's/SupportedOSPlatform [\(]"tvos9[.]0"[\)]/SupportedOSPlatform ("tvos")/' ./*.cs ./*/*.cs

    # SupportedOSPlatform ("macos10.(7|8|9|10|11|12|13).*") -> SupportedOSPlatform ("macos")
    # SupportedOSPlatform ("macos10.(7|8|9|10|11|12|13") -> SupportedOSPlatform ("macos")
    # SupportedOSPlatform ("macos10.14.0") -> SupportedOSPlatform ("macos")
    # SupportedOSPlatform ("macos10.14") -> SupportedOSPlatform ("macos")
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.](7|8|9|10|11|12|13)[.][0-9]*"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.](7|8|9|10|11|12|13)"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.]14[.]0"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.]14"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
2022-12-16 08:21:32 +01:00
Rolf Bjarne Kvinge eeb5e50d0f
[CloudKit] Update availability attributes for CKShareParticipantType. (#17066)
* The iOS attribute is incorrect (iOS 10.10 doesn't exist), so fix that
  according to headers (should be iOS 10.0).
* When looking at the header, I realized the enum is deprecated, so fix that
  too.
2022-12-16 08:13:51 +01:00
Rolf Bjarne Kvinge 9f1d9e6d38
[src] Remove a few more old availability attributes. (#17068) 2022-12-16 08:13:24 +01:00
Rolf Bjarne Kvinge aee3f88ae8
[msbuild/dotnet] Use a more unique property name than _AOTCompiler. (#17049)
Use a more unique property name than _AOTCompiler (use _XamarinAOTCompiler
instead) to try to prevent any problems if somebody else tries to use
'_AOTCompiler' somewhere.

Ref: https://github.com/xamarin/xamarin-macios/pull/17033#discussion_r1047823981
2022-12-16 07:22:51 +01:00
Rolf Bjarne Kvinge 9bf322525e
Bump Xamarin.MacDev. (#17056)
This requires a few nullability updates in our code as well.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@14d5361 Enable nullability in PListObject.cs

Diff: ac2647b643..14d53612d4
2022-12-16 07:22:37 +01:00
GitHub Actions Autoformatter 697bfa06c6 Auto-format source code 2022-12-15 15:43:16 +00:00