Change the [NotImplemented] attribute to something more descriptive: [ReadOnly]
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Sometimes Apple provides an immutable class and a mutable subclass. Example: `AVMetadataItem` and `AVMutableMetadataItem`. If a developer creates an instance of an `AVMetadataItem` and tries to set a property, a NotImplementedException will be thrown:
```csharp
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
public virtual NSString? MetadataIdentifier {
[Export ("identifier")]
get {
...
}
[NotImplemented ()]
set {
throw new NotImplementedException ();
}
}
```
This is confusing for developers, every now and then we get bug reports about it:
* https://github.com/xamarin/xamarin-macios/issues/8480
Idea: change the generated code to throw something else with a better description:
```csharp
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
public virtual NSString? MetadataIdentifier {
[Export ("identifier")]
get {
...
}
[NotImplemented ()]
set {
throw new NotSupportedException ("This member is read-only. Use an instance of the mutable subclass AVMutableMetadataItem instead.");
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.