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

[AudioToolbox] Update API to xcode 12 beta 6. #9603

Merged

Conversation

mandel-macaque
Copy link
Member

The most important changes in the API are ignored until we fix issue #9602

The most important changes in the API are ignored until we fix issue xamarin#9602
@monojenkins
Copy link
Collaborator

Build failure
Build failed or was aborted

🔥 Build failed 🔥

@monojenkins
Copy link
Collaborator

Build success
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
Test run succeeded

@@ -342,6 +351,13 @@ public UIKit.UIImage GetIcon (float desiredPointSize)
return AudioComponentGetLastActiveTime (handle);
}
}

[Watch (7,0), TV (14,0), iOS (14,0)]
public UIImage CopyIcon () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor

  • style, { on the next line
  • maybe GetIcon since we don't have to follow the ObjC copy rule/convention

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a GetIcon, either we ignore the method of we use Copy

public AppKit.NSImage CopyIcon () {
var ptr = AudioComponentCopyIcon (handle);
return ptr == IntPtr.Zero ? null : new AppKit.NSImage (ptr);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can merge both method if you add using NSImage = UIKit.UIImage; in the #if MONOMAC on top of the file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some extra ugliness, but sure, can be done.

@@ -342,6 +351,13 @@ public UIKit.UIImage GetIcon (float desiredPointSize)
return AudioComponentGetLastActiveTime (handle);
}
}

[Watch (7,0), TV (14,0), iOS (14,0)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API diff for watchOS is empty so this code is not included in the platform assembly
Either it's available and should be added or the [Watch (7,0)] attribute should be removed (here and elsewhere).
Considering that there was no xtro file updated for the watchOS profile I suspect it's the former.

[Watch (7,0), TV (14,0), iOS (14,0)]
public UIImage CopyIcon () {
var ptr = AudioComponentCopyIcon (handle);
return ptr == IntPtr.Zero ? null : new UIImage (ptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AudioComponentCopyIcon returns a retained handle, and it can also be an existing UIImage (for which we have a managed instance), so:

Suggested change
return ptr == IntPtr.Zero ? null : new UIImage (ptr);
return (UIImage) Runtime.GetNSObject (ptr, true);

@rolfbjarne
Copy link
Member

And most importantly: manual API need manual tests!

Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After feedback is addressed 👍

@monojenkins
Copy link
Collaborator

Build failure
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

3 tests failed, 73 tests passed.

Failed tests

  • xammac tests/Mac Modern/Debug: Failed (Test run failed.)
  • xammac tests/Mac Modern/Release: Failed (Test run failed.)
  • xammac tests/Mac Modern/Release: Failed (Test run failed.)

@mandel-macaque mandel-macaque added the note-highlight Worth calling out specifically in release notes label Sep 9, 2020
@mandel-macaque
Copy link
Member Author

Failures are unrelated, but lets kick it again (that msbuild issue is starting to happy more often).

@mandel-macaque
Copy link
Member Author

build

@monojenkins
Copy link
Collaborator

Build failure
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

3 tests failed, 73 tests passed.

Failed tests

  • xammac tests/Mac Modern/Debug: Failed (Test run failed.)
  • xammac tests/Mac Modern/Release: Failed (Test run failed.)
  • xammac tests/Mac Modern/Release: Failed (Test run failed.)

@rolfbjarne
Copy link
Member

The failures are very much related:

1) CopyIconTest (MonoTouchFixtures.AudioUnit.AudioUnitTest.CopyIconTest)
     Expected: No Exception to be thrown
  But was:   (AudioComponentCopyIcon assembly:<unknown assembly> type:<unknown type> member:(null))
  at (wrapper managed-to-native) AudioUnit.AudioComponent.AudioComponentCopyIcon(intptr)
  at AudioUnit.AudioComponent.CopyIcon () [0x00001] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.99.0.255/src/Xamarin.Mac/AudioUnit/AudioComponent.cs:339 
  at MonoTouchFixtures.AudioUnit.AudioUnitTest+<>c__DisplayClass2_0.<CopyIconTest>b__0 () [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/AudioUnit/AudioUnitTest.cs:67 
  at NUnit.Framework.Constraints.VoidInvocationDescriptor.Invoke () [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/external/guiunit/src/framework/Constraints/ThrowsConstraint.cs:208 
  at NUnit.Framework.Constraints.ExceptionInterceptor.Intercept (System.Object invocation) [0x00050] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/external/guiunit/src/framework/Constraints/ThrowsConstraint.cs:163 
  at MonoTouchFixtures.AudioUnit.AudioUnitTest.CopyIconTest () [0x00042] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/AudioUnit/AudioUnitTest.cs:66 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395 

[Test]
public void CopyIconTest ()
{
AudioComponentDescription cd = new AudioComponentDescription () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need a version check here to only run on Xcode 12+ OSes.

Comment on lines +66 to +68
Assert.DoesNotThrow ( () => {
var icon = component.CopyIcon (); // ensuring that the manual binding does not throw, we do not care about the result
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could do something like this:

Assert.IsNotNull (component.CopyIcon (), "CopyIcon");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be null, there is no guarantee, I much prefer to make sure it does not crash.

@@ -342,6 +361,7 @@ public UIKit.UIImage GetIcon (float desiredPointSize)
return AudioComponentGetLastActiveTime (handle);
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace!

@@ -353,6 +373,7 @@ public AppKit.NSImage GetIcon ()
{
return new AppKit.NSImage (AudioComponentGetIcon (handle));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And more whitespace 😄

@monojenkins
Copy link
Collaborator

Build success
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
Test run succeeded

@mandel-macaque mandel-macaque merged commit 5a9139b into xamarin:xcode12 Sep 11, 2020
@mandel-macaque mandel-macaque deleted the audiotools-xcode12-beta-4 branch September 11, 2020 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
note-highlight Worth calling out specifically in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants