Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorate all APIs with correct SupportedOSPlatform attributes #10170

Closed
2 of 3 tasks
Tracked by #44736
marek-safar opened this issue Nov 27, 2020 · 26 comments
Closed
2 of 3 tasks
Tracked by #44736

Decorate all APIs with correct SupportedOSPlatform attributes #10170

marek-safar opened this issue Nov 27, 2020 · 26 comments
Assignees
Labels
dotnet An issue or pull request related to .NET (6) dotnet-pri0 .NET 6: required for stable release enhancement The issue or pull request is an enhancement iOS Issues affecting iOS macOS Issues affecting macOS
Milestone

Comments

@marek-safar
Copy link
Contributor

marek-safar commented Nov 27, 2020

As part of netcore migration, we need to correctly annotate all APIs with .NET 6 to work correctly with existing tooling (primary existing analyzers). The attributes already exist in .NET5 and could be extended if necessary.

Available attributes are listed at https://github.com/dotnet/designs/blob/main/accepted/2020/platform-checks/platform-checks.md#attributes

Required Actions

  • Generator: read existing attributes but generate the new ones for dotnet
  • Manual bindings: Add new attributes under a #if NET and hide existing ones under #else -> in progress
  • Update introspection tests to use the new attributes when doing the checks -> done, but parts disabled until manual bindings updates are completed

Time estimate: 2 weeks.

@rolfbjarne rolfbjarne added dotnet An issue or pull request related to .NET (6) iOS Issues affecting iOS macOS Issues affecting macOS labels Nov 27, 2020
@rolfbjarne rolfbjarne added this to the .NET 6 milestone Nov 27, 2020
@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Nov 27, 2020
@spouliot spouliot self-assigned this Jan 27, 2021
@spouliot spouliot added enhancement The issue or pull request is an enhancement and removed bug If an issue is a bug or a pull request a bug fix labels Jan 28, 2021
@spouliot
Copy link
Contributor

spouliot commented Feb 1, 2021

Beside the two issues above the migration means we lose the helper messages, usually the alternative API to use for obsolete/deprecated attributes. E.g. bindings

[Deprecated (PlatformName.iOS, 7, 0, message : "Use 'UbiquitousItemDownloadingStatusKey' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 9, message : "Use 'UbiquitousItemDownloadingStatusKey' instead.")]
[Field ("NSMetadataUbiquitousItemIsDownloadedKey")]
NSString UbiquitousItemIsDownloadedKey { get; }

becomes

[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
static NSString? _UbiquitousItemIsDownloadedKey;
[Field ("NSMetadataUbiquitousItemIsDownloadedKey",  "Foundation")]
[UnsupportedOSPlatform ("ios7.0")]
[UnsupportedOSPlatform ("macos10.9")]
public static NSString UbiquitousItemIsDownloadedKey {
...
}

@marek-safar
Copy link
Contributor Author

You could consider using ObsoleteAttribute for that (extended in .net5).

https://github.com/dotnet/designs/blob/main/accepted/2020/better-obsoletion/better-obsoletion.md

@spouliot
Copy link
Contributor

spouliot commented Feb 2, 2021

Unlike both [SupportedOSPlatform] and [UnsupportedOSPlatform] the [Obsolete] attribute is not allowed multiple times - but it does allow to use our Message property where it's the most useful.

We can use conditionals to work around that limit. That would look like:

[SupportedOSPlatform ("macos10.12.2")]
[SupportedOSPlatform ("watchos5.0")]
#if __WATCHOS__
[Obsolete ("API obsoleted in 'watchos7.0': Removed in Xcode 12.")]
#endif
[SupportedOSPlatform ("tvos14.0")]
public unsafe partial class MPMediaEntity : NSObject, INSCoding, INSSecureCoding {
...
}

The new Url and DiagnosticId could be used. That would allow developers to ignore the Apple obsoletion warnings (per platform?) independently of other normal obsolete.

Note that we might have case where .NET [Obsolete] and Xamarin [Obsoleted] (d suffix) were both used. That should not be common since they were used to indicate different things.

@spouliot
Copy link
Contributor

spouliot commented Feb 3, 2021

The attribute messages are quote with ' but I think we can get something that's understandable with our normalized messages (or when there's none).

.../Xamarin.iOS.cs(449,46): warning BI1234: 'CTTelephonyNetworkInfo' is obsolete: 'Starting with ios14.0 Use the 'CallKit' API instead.'
.../Xamarin.iOS.cs(601,46): warning BI1234: 'IAdPreroll' is obsolete: 'Starting with ios12.0'

Also having a single [Obsolete] attribute reduce the platform assemblies sizes.

Before

-rw-r--r--  1 poupou  staff  19930624  2 Feb 20:07 _build//Microsoft.iOS.Runtime.ios-x64/runtimes/ios-x64/lib/net6.0/Xamarin.iOS.dll
-rw-r--r--  1 poupou  staff  22490624  2 Feb 20:04 _build//Microsoft.macOS.Runtime.osx-x64/runtimes/osx-x64/lib/net6.0/Xamarin.Mac.dll
-rw-r--r--  1 poupou  staff  13635072  2 Feb 20:06 _build//Microsoft.tvOS.Runtime.tvos-x64/runtimes/tvos-x64/lib/net6.0/Xamarin.TVOS.dll
-rw-r--r--  1 poupou  staff   8311296  2 Feb 20:03 _build//Microsoft.watchOS.Runtime.watchos-x86/runtimes/watchos-x86/lib/net6.0/Xamarin.WatchOS.dll

After

-rw-r--r--  1 poupou  staff  19801600  2 Feb 20:56 _build//Microsoft.iOS.Runtime.ios-x64/runtimes/ios-x64/lib/net6.0/Xamarin.iOS.dll
-rw-r--r--  1 poupou  staff  22390784  2 Feb 20:56 _build//Microsoft.macOS.Runtime.osx-x64/runtimes/osx-x64/lib/net6.0/Xamarin.Mac.dll
-rw-r--r--  1 poupou  staff  13563904  2 Feb 20:54 _build//Microsoft.tvOS.Runtime.tvos-x64/runtimes/tvos-x64/lib/net6.0/Xamarin.TVOS.dll
-rw-r--r--  1 poupou  staff   8262656  2 Feb 20:53 _build//Microsoft.watchOS.Runtime.watchos-x86/runtimes/watchos-x86/lib/net6.0/Xamarin.WatchOS.dll

even if the linker will remove all of them inside the final/release bundles.

@rolfbjarne rolfbjarne added the dotnet-pri0 .NET 6: required for stable release label Feb 3, 2021
spouliot added a commit to spouliot/xamarin-macios that referenced this issue Feb 4, 2021
This moves our current/legacy attributes to the ones added in dotnet 5 [1].

Short Forms (only in bindings)

| Old                                   | New                                 |
|---------------------------------------|-------------------------------------|
| [iOS (7,0)]                           | [SupportedOSPlatform ("ios7.0")]    |
| [NoIOS]                               | [UnsupportedOSPlatform ("ios")]     |

Long Forms

| Old                                   | New                                 |
|---------------------------------------|-------------------------------------|
| [Introduced (PlatformName.iOS, 7,0)]  | [SupportedOSPlatform ("ios7.0")]    |
| [Obsoleted (PlatformName.iOS, 12,1)]  | [Obsolete (...)]                    |
| [Deprecated (PlatformName.iOS, 14,3)] | [UnsupportedOSPlatform ("ios14.3")] |
| [Unavailable (PlatformName.iOS)]      | [UnsupportedOSPlatform ("ios")]     |

Other changes

* `[SupportedOSPlatform]` and `[UnsupportedOSPlatform]` are not allowed on `interface` [2] which means they cannot be used for protocols. This is currently handled by inlining the existing attributes on all members.
* `[ObsoletedInOSPlatform]` was removed in net5 RC. This PR is now mapping the existing attributes to `[Obsolote]`, however multiple ones cannot be added so they need to be platform specific.

Still Missing

* [ ] Generator deduplication of type/members attributes for interfaces (due to [2])
* [ ] Manual bindings
* [ ] Introspection tests updates

References

* [1] xamarin#10170
* [2] dotnet/runtime#47599
* [3] dotnet/runtime#47601
spouliot added a commit that referenced this issue Apr 10, 2021
…te` (#10580)

This moves our current/legacy attributes to the ones added in dotnet 5 [1].

Short Forms (only in bindings)

| Old                                   | New                                 |
|---------------------------------------|-------------------------------------|
| [iOS (7,0)]                           | [SupportedOSPlatform ("ios7.0")]    |
| [NoIOS]                               | [UnsupportedOSPlatform ("ios")]     |

Long Forms

| Old                                   | New                                 |
|---------------------------------------|-------------------------------------|
| [Introduced (PlatformName.iOS, 7,0)]  | [SupportedOSPlatform ("ios7.0")]    |
| [Obsoleted (PlatformName.iOS, 12,1)]  | [Obsolete (...)]                    |
| [Deprecated (PlatformName.iOS, 14,3)] | [UnsupportedOSPlatform ("ios14.3")] |
| [Unavailable (PlatformName.iOS)]      | [UnsupportedOSPlatform ("ios")]     |

Other changes

* `[SupportedOSPlatform]` and `[UnsupportedOSPlatform]` are not allowed on `interface` [2] which means they cannot be used for protocols. This is currently handled by inlining the existing attributes on all members.
* `[ObsoletedInOSPlatform]` was removed in net5 RC. This PR is now mapping the existing attributes to `[Obsolote]`, however multiple ones cannot be added so they need to be platform specific.

Remaining work (manual bindings update) tracked in #11055

References

* [1] #10170
* [2] dotnet/runtime#47599
* [3] dotnet/runtime#47601
@rolfbjarne
Copy link
Member

It seems we need to generate the SupportedOSPlatform attribute if there are attributes for other platforms, because otherwise it's implied that the lack of an SupportedOSPlatform attribute means the API isn't available.

Ref: https://discord.com/channels/732297728826277939/732297808148824115/859501966349565992

@dotMorten
Copy link
Contributor

dotMorten commented Jun 29, 2021

Here's the list I have so far:

warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.StopUpdatingHeading()' is only supported on: 'macOS/OSX' 11.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.RequestWhenInUseAuthorization()' is only supported on: 'macOS/OSX' 11.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.StartUpdatingHeading()' is only supported on: 'macOS/OSX' 11.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIApplication.StatusBarOrientation.get' is unsupported on: 'ios' 9.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIApplication.StatusBarOrientation' is unsupported on: 'ios' 9.0 and later, 'macOS/OSX' 10.14 and later, 'maccatalyst' 13.1 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.AuthorizationStatus.get' is only supported on: 'macOS/OSX' 11.0 and later, 'tvos' 14.0 and later, 'ios' 14.0 and later, 'maccatalyst' 14.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.AuthorizationStatus' is only supported on: 'macOS/OSX' 11.0 and later, 'tvos' 14.0 and later, 'ios' 14.0 and later, 'maccatalyst' 14.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.Status.get' is unsupported on: 'ios' 14.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.Status' is unsupported on: 'ios' 14.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLFloor.Level' is only supported on: 'macOS/OSX' 10.15 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Floor.get' is only supported on: 'macOS/OSX' 10.15 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Floor' is only supported on: 'macOS/OSX' 10.15 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Course' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Course.get' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLFloor.Level' is only supported on: 'macOS/OSX' 10.15 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Floor.get' is only supported on: 'macOS/OSX' 10.15 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Floor' is only supported on: 'macOS/OSX' 10.15 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Speed.get' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Speed' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Course' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Course.get' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Speed' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocation.Speed.get' is only supported on: 'tvos' 13.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.HeadingAvailable.get' is only supported on: 'macOS/OSX' 11.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'CLLocationManager.HeadingAvailable' is only supported on: 'macOS/OSX' 11.0 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIStringDrawing.StringSize(NSString, UIFont, nfloat, UILineBreakMode)' is unsupported on: 'ios' 7.0 and later, 'macOS/OSX' 10.14 and later, 'maccatalyst' 13.1 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIKey.ModifierFlags' is only supported on: 'ios' 13.4 and later, 'tvos' 13.4 and later, 'maccatalyst' 13.4 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIStringDrawing.StringSize(NSString, UIFont, nfloat, UILineBreakMode)' is unsupported on: 'ios' 7.0 and later, 'macOS/OSX' 10.14 and later, 'maccatalyst' 13.1 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIKey.CharactersIgnoringModifiers' is only supported on: 'ios' 13.4 and later, 'tvos' 13.4 and later, 'maccatalyst' 13.4 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIStringDrawing.StringSize(NSString, UIFont, nfloat, UILineBreakMode)' is unsupported on: 'ios' 7.0 and later, 'macOS/OSX' 10.14 and later, 'maccatalyst' 13.1 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIStringDrawing.StringSize(NSString, UIFont, nfloat, UILineBreakMode)' is unsupported on: 'ios' 7.0 and later, 'macOS/OSX' 10.14 and later, 'maccatalyst' 13.1 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIPress.Key.get' is only supported on: 'ios' 13.4 and later, 'tvos' 13.4 and later, 'maccatalyst' 13.4 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIPress.Key' is only supported on: 'ios' 13.4 and later, 'tvos' 13.4 and later, 'maccatalyst' 13.4 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIScrollTypeMask.Continuous' is only supported on: 'ios' 13.4 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIPanGestureRecognizer.AllowedScrollTypesMask.set' is only supported on: 'ios' 13.4 and later.
warning CA1416: This call site is reachable on: 'iOS' 13.0 and later. 'UIPanGestureRecognizer.AllowedScrollTypesMask' is only supported on: 'ios' 13.4 and later.

@spouliot
Copy link
Contributor

hmm... I thought it would fall back to the assembly-level attribute

from src/MinimumVersions.cs.in

[assembly: SupportedOSPlatform ("ios@DOTNET_MIN_IOS_SDK_VERSION@")]

into src/MinimumVersions.cs

[assembly: SupportedOSPlatform ("ios10.0")]

@rolfbjarne
Copy link
Member

A user reported this:

/Users/Hamish/Projects/MandelbrotMakerTest/MandelbrotMakerTest.MacOSWindow/ViewController.cs(205,16): warning CA1416: This call site is reachable on: 'macOS/OSX' 10.14 and later. 'NSSavePanel' is unsupported on: 'macOS/OSX' 10.15 and later. [/Users/Hamish/Projects/MandelbrotMakerTest/MandelbrotMakerTest.MacOSWindow/MandelbrotMakerTest.MacOSWindow.csproj]
/Users/Hamish/Projects/MandelbrotMakerTest/MandelbrotMakerTest.MacOSWindow/ViewController.cs(195,8): warning CA1416: This call site is reachable on: 'macOS/OSX' 10.14 and later. 'NSFileHandle.WriteData(NSData)' is unsupported on: 'macOS/OSX' 10.15 and later. 

which is a bit weird, because neither NSSavePanel nor NSFileHandle have any availability attributes, which means they should get the assembly-level default.

Ref: https://discord.com/channels/732297728826277939/732297808148824115/886792528697901057

@spouliot
Copy link
Contributor

spouliot commented Sep 13, 2021

which is a bit weird,

@rolfbjarne not really :) it's right there

		[Deprecated (PlatformName.MacOSX, 10,15, message: "Use 'Write (out NSError)' instead.")]
		[Deprecated (PlatformName.iOS, 13,0, message: "Use 'Write (out NSError)' instead.")]
		[Deprecated (PlatformName.WatchOS, 6,0, message: "Use 'Write (out NSError)' instead.")]
		[Deprecated (PlatformName.TvOS, 13,0, message: "Use 'Write (out NSError)' instead.")]
		[Export ("writeData:")]
		void WriteData (NSData data);

That becomes an [UnsupportedOSPlatform ("macos10.15")] which gave the correct warning

That attribute does not allow us to tell why (the string part) so that should be generated as a separate [Obsolete] attribute

wrt SavePanel

		[Advice ("You must use 'SavePanel' method if the application is sandboxed.")]
		[Deprecated (PlatformName.MacOSX, 10, 15, message: "All save panels now run out-of-process, use 'SavePanel' method instead")]
		[Export ("init")]
		IntPtr Constructor ();

so I guess the code is trying to instance the type, which is not something it should do (anymore), and the default .ctor gets mapped to the type (for the compiler warning).

chamons added a commit to chamons/xamarin-macios that referenced this issue Jan 6, 2022
- The tool I wrote to convert attributes [mellite](https://github.com/chamons/mellite) does single pass through each file
- This means files that define Foo and !Foo, each with availability attributes inside can not be proccessed
- These 2 locations were easy to fix by moving defines inside binding definations, so I did that
- About 10 other locations were not so easy, so those will be worked around by hand in the conversion process.

Part of xamarin#10170
chamons added a commit that referenced this issue Jan 7, 2022
- The tool I wrote to convert attributes [mellite](https://github.com/chamons/mellite) does single pass through each file
- This means files that define Foo and !Foo, each with availability attributes inside can not be proccessed
- These 2 locations were easy to fix by moving defines inside binding definations, so I did that
- About 10 other locations were not so easy, so those will be worked around by hand in the conversion process.

Part of #10170
chamons added a commit to chamons/xamarin-macios that referenced this issue Jan 14, 2022
- Disable check "[FAIL] Both '{t}' and '{m}' are marked with `{s}`." type and member on that type in NET
- Due to the behavior of NET6 style attributes, we are forced to duplicate availability attributes in many cases
- See xamarin#10170 for details
chamons added a commit that referenced this issue Jan 18, 2022
- Disable check "[FAIL] Both '{t}' and '{m}' are marked with `{s}`." type and member on that type in NET
- Due to the behavior of NET6 style attributes, we are forced to duplicate availability attributes in many cases
- See #10170 for details
@rolfbjarne
Copy link
Member

I have a new proposal:

Availability attribute mapping between legacy Xamarin and .NET

Suggestion:

Current Dotnet (planned)
[Introduced (PlatformName.iOS, 7,0)] [SupportedOSPlatform ("ios7.0")]
[Obsoleted (PlatformName.iOS, 12,1)] [UnsupportedOSPlatform ("ios12.1")] + [Advice ("Starting in iOS 12.1, use XYZ instead.")]
[Deprecated (PlatformName.iOS, 14,3)] [UnsupportedOSPlatform ("ios14.3")] + [Obsolete ("Starting in iOS 14.3, use XYZ instead.")]
[Unavailable (PlatformName.iOS)] [UnsupportedOSPlatform ("ios")]

The main problem is the following scenario:

  1. Developer needs to keep their app working an older iOS version, say iOS 14.
  2. Apple obsoleted some API in iOS 15, providing an alternative.

If we want to provide a good message to the user when they use the old API (telling them about the new API in iOS 15), we currently have to use the Obsolete attribute.

However, this means that the user have to do something like this to have a warning-free build:

#pragma warning disable 618
    CalliOS14API ();
#pragma warning restore 618

adding a version check won't change anything:

    if (checkForiOS15) {
        CalliOS15API ();
    } else {
#pragma warning disable 618
        CalliOS14API ();
#pragma warning restore 618
    }

We need improvements in the .NET API to be able to handle this better.

The suggestion above has the advantage that if .NET 7 adds additional API
(such as a Message property on UnsupportedOSPlatformAttribute, or a new
ObsoleteInPlatformAttribute( we should be able to convert our .NET 6 to the
new .NET 7 hotness, because we have enough information to go backwards.

Ref: dotnet/runtime#47601
Ref: dotnet/runtime#40945
Ref: #10170

@rolfbjarne
Copy link
Member

I've started a discussion about improving this in .NET 7: dotnet/runtime#68557

@chamons
Copy link
Contributor

chamons commented Apr 26, 2022

So I looked into implementing Rolf's suggestion, (though I think you flipped the advice/obsolete in the table) and I've run into a major problem:

error CS0579: Duplicate 'Advice' attribute

You can only have one Advice per item. Now for our attributes, that's "fine", as I can generate a #if array around the defines, just like we are today with Obsolete.

However, a number of our bindings are using Advice directly:

                [Advice ("Use 'UTType' constructor overloads.")]
                [DesignatedInitializer]
                [Export ("initWithURL:inMode:")]
                NativeHandle Constructor (NSUrl url, UIDocumentPickerMode mode);

or indirectly:

	[AttributeUsage (AttributeTargets.Method, AllowMultiple = false)]
	public sealed class RequiresSuperAttribute : AdviceAttribute {
		public RequiresSuperAttribute ()
			: base ("Overriding this method requires a call to the overriden method.")
		{
		}
	}

And thus mixing a Deprecated (or Obsolete if we aren't flipped) with one of those is non-obvious a compile error.

@rolfbjarne
Copy link
Member

You can only have one Advice per item

My vote is for changing the Advice attribute to AllowMultiple=true.

I think you flipped the advice/obsolete in the table)

My thinking was that the Deprecated attribute is "stronger" than the Obsoleted attribute (in that if something is [Deprecated] Apple might reject your app, while [Obsoleted] is just a recommendation for the future), and in the same vein [Obsolete] is "stronger" than [Advice].

I'm fine with either way though.

That said, I'm not really sure we really need the distinction between [Deprecated] and [Obsoleted], we seem to use it somewhat interchangeably in the bindings. That's probably a discussion for the future though, this is whole attribute conversion is already complicated enough.

@spouliot
Copy link
Contributor

AFAIK the [Advice] was only shown in the old/legacy adding for VS and VSfM. IOW those messages are not visible/helpful unless support for the attribute is present inside the IDE.

@chamons
Copy link
Contributor

chamons commented May 4, 2022

I'm going to finally, after like 5 months of work, call this good enough and done.

There are some clean up tasks for the future, but the known work is done, and I was able to test 4 NET sample and a large MAUI app and saw no spurious availability warnings.

@chamons chamons closed this as completed May 4, 2022
@dotMorten
Copy link
Contributor

What version is this in? With RC2 I'm still seeing lots of warnings in:

LocationManager.StartUpdatingHeading
LocationManager.RequestWhenInUseAuthorization
LocationManager.StopUpdatingHeading
CLLocation.Speed
CLLocation.Course
CLLocation.Floor
CLLocation.Floor.Level
CMGyroData.RotationRate
CMMagnetometerData.MagneticField
CMAccelerometerData.Acceleration

image
image

@chamons
Copy link
Contributor

chamons commented May 16, 2022

Apologies for the delay in response.

This only landed 12 days ago (#14877), so I'm not surprised it didn't make it to you 5 days after landing.

Let me look into when it should be available publicly.

@chamons
Copy link
Contributor

chamons commented May 16, 2022

Sorry for the trouble, the fix won't hit public until MAUI’s stable release, which will be "soon".

@dotMorten
Copy link
Contributor

@chamons thanks for following up and sorry for being "too" eager :-) I was just really happy I could re-instate all my platforms warnings only to find I couldn't... patience... ugh 😁

@chamons
Copy link
Contributor

chamons commented May 18, 2022

🤞 that it's fixed for you soon @dotMorten - This was one of the most difficult fixes I've made since starting at Xamarin, and required writing custom tools and manually fixing hundreds of locations.

If after MAUI stable release you are seeing warnings unnecessarily, please open a new issue.

@dotMorten
Copy link
Contributor

@chamons Glad you're getting to do challenging and VERY MUCH APPRECIATED work :-)

@ghost ghost locked as resolved and limited conversation to collaborators Jun 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dotnet An issue or pull request related to .NET (6) dotnet-pri0 .NET 6: required for stable release enhancement The issue or pull request is an enhancement iOS Issues affecting iOS macOS Issues affecting macOS
Projects
None yet
Development

No branches or pull requests

7 participants