* [generator] Fixes WrapAttribute usage with interface protocols
Fixesxamarin/xamarin-macios#3869
We need to support the scenario where `WrapAttribute` is used
to wrap an interface protocol type declaration like:
```csharp
[Wrap ("WeakDelegate")]
[NullAllowed]
ICLSDataStoreDelegate Delegate { get; set; }
[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
NSObject WeakDelegate { get; set; }
```
We generated invalid code for the setter that needed an explicit cast
and ended up with a CS0266 compiler error:
Bad generated code:
```csharp
[CompilerGenerated]
public ICLSDataStoreDelegate Delegate {
get {
return WeakDelegate as ICLSDataStoreDelegate;
}
set {
WeakDelegate = value;
}
}
```
Good generated code:
```csharp
[CompilerGenerated]
public ICLSDataStoreDelegate Delegate {
get {
return WeakDelegate as ICLSDataStoreDelegate;
}
set {
var rvalue = value as NSObject;
if (value != null && rvalue == null)
throw new ArgumentException ("The object passed of type " + value.GetType () + " does not derive from NSObject");
WeakDelegate = rvalue;
}
}
```