This makes it easier to figure out problems in consuming code, since it makes
it easier to identify where things start to go wrong.
Fixes https://github.com/xamarin/maccore/issues/2539.
AudioUnit needs a GCHandle in the input callback, which means we have to create it
when SetInputCallback is called (like we already do for SetRenderCallback).
Fixes https://github.com/xamarin/xamarin-macios/issues/13637.
* [ObjCRuntime] Fix the DisposableObject.Owns property to return the correct value. Fixes#13646.
Ops...
Also add tests to avoid more oopses.
Fixes https://github.com/xamarin/xamarin-macios/issues/13646.
* Update tests/monotouch-test/AudioToolbox/AudioConverterTest.cs
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst, because they don't
apply for a Mac Catalyst app (which is neither a simulator environment, nor a
device environment).
This means that code using these APIs will have to be re-evaluated to
determine what's the correct behavior for Mac Catalyst.
Also update our tests accordingly.
Fixes https://github.com/xamarin/xamarin-macios/issues/10312.
The supposed handle for system sounds is an uint, which does not match the
IntPtr handle INativeObject uses, so remove the INativeObject interface from
the SystemSound class.
* [monotouch-test] Check a few more permissions that sometimes make the app crash due to a TCC violation on Mac Catalyst.
* [monotouch-test] Adjust CaptureDeviceTest to only verify camera permission for Audio+Video, any other value is not supported by the OS.
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
* [monotouch-test] Use TestRuntime.RunAsync instead of AppDelegate.RunAsync so that the system sound tests work on macOS as well.
* [AudioToolbox] Don't use a generic Action type in a P/Invoke, CoreCLR doesn't support it.
Fixes these test failures:
[FAIL] FromFile : System.Runtime.InteropServices.MarshalDirectiveException : Cannot marshal 'parameter #4': Non-blittable generic types cannot be marshaled.
at AudioToolbox.SystemSound.AudioServicesAddSystemSoundCompletion(UInt32 soundId, IntPtr runLoop, IntPtr runLoopMode, Action`2 completionRoutine, IntPtr clientData)
at AudioToolbox.SystemSound.AddSystemSoundCompletion(Action routine, CFRunLoop runLoop) in Xamarin.Mac.dll:token 0x600bfd4+0x2b
at MonoTouchFixtures.AudioToolbox.SystemSoundTest.FromFile() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 40
[FAIL] TestCallbackPlayAlert : System.ArgumentException : The specified Type must not be a generic type. (Parameter 'delegate')
at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal(Delegate d)
at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(Delegate d) in System.Private.CoreLib.dll:token 0x6004586+0xe
at ObjCRuntime.BlockLiteral.SetupBlockImpl(Delegate trampoline, Delegate userDelegate, Boolean safe, String signature) in Xamarin.Mac.dll:token 0x6001306+0xb
at ObjCRuntime.BlockLiteral.SetupBlock(Delegate trampoline, Delegate userDelegate, Boolean safe) in Xamarin.Mac.dll:token 0x6001305+0x5e
at ObjCRuntime.BlockLiteral.SetupBlockUnsafe(Delegate trampoline, Delegate userDelegate) in Xamarin.Mac.dll:token 0x6001307+0x0
at AudioToolbox.SystemSound.PlayAlertSound(Action onCompletion) in Xamarin.Mac.dll:token 0x600bfc8+0x20
at MonoTouchFixtures.AudioToolbox.SystemSoundTest.<>c__DisplayClass3_1.<<TestCallbackPlayAlert>b__0>d.MoveNext() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 93
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) in System.Private.CoreLib.dll:token 0x6002d4d+0x0
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in Xamarin.Mac.dll:token 0x6016560+0x0
--- End of stack trace from previous location ---
at ObjCRuntime.Runtime.InvokeMethod(MethodBase method, Object instance, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d1+0x274
at ObjCRuntime.Runtime.InvokeMethod(MonoObject* methodobj, MonoObject* instanceobj, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d0+0x0
at ObjCRuntime.Runtime.bridge_runtime_invoke_method(MonoObject* method, MonoObject* instance, IntPtr parameters, IntPtr& exception_gchandle) in Xamarin.Mac.dll:token 0x6001124+0x26
at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1)
at TestRuntime.RunAsync(DateTime timeout, Action action, Func`1 check_completed, NSImage imageToShow) in xamarin-macios/tests/common/mac/TestRuntime.macos.cs:line 18
at MonoTouchFixtures.AudioToolbox.SystemSoundTest.TestCallbackPlayAlert() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 92
[FAIL] TestCallbackPlaySystem : System.ArgumentException : The specified Type must not be a generic type. (Parameter 'delegate')
at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal(Delegate d)
at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(Delegate d) in System.Private.CoreLib.dll:token 0x6004586+0xe
at ObjCRuntime.BlockLiteral.SetupBlockImpl(Delegate trampoline, Delegate userDelegate, Boolean safe, String signature) in Xamarin.Mac.dll:token 0x6001306+0xb
at ObjCRuntime.BlockLiteral.SetupBlock(Delegate trampoline, Delegate userDelegate, Boolean safe) in Xamarin.Mac.dll:token 0x6001305+0x5e
at ObjCRuntime.BlockLiteral.SetupBlockUnsafe(Delegate trampoline, Delegate userDelegate) in Xamarin.Mac.dll:token 0x6001307+0x0
at AudioToolbox.SystemSound.PlaySystemSound(Action onCompletion) in Xamarin.Mac.dll:token 0x600bfca+0x20
at MonoTouchFixtures.AudioToolbox.SystemSoundTest.<>c__DisplayClass2_1.<<TestCallbackPlaySystem>b__0>d.MoveNext() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 74
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) in System.Private.CoreLib.dll:token 0x6002d4d+0x0
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in Xamarin.Mac.dll:token 0x6016560+0x0
--- End of stack trace from previous location ---
at ObjCRuntime.Runtime.InvokeMethod(MethodBase method, Object instance, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d1+0x274
at ObjCRuntime.Runtime.InvokeMethod(MonoObject* methodobj, MonoObject* instanceobj, IntPtr native_parameters) in Xamarin.Mac.dll:token 0x60011d0+0x0
at ObjCRuntime.Runtime.bridge_runtime_invoke_method(MonoObject* method, MonoObject* instance, IntPtr parameters, IntPtr& exception_gchandle) in Xamarin.Mac.dll:token 0x6001124+0x26
at ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1)
at TestRuntime.RunAsync(DateTime timeout, Action action, Func`1 check_completed, NSImage imageToShow) in xamarin-macios/tests/common/mac/TestRuntime.macos.cs:line 18
at MonoTouchFixtures.AudioToolbox.SystemSoundTest.TestCallbackPlaySystem() in xamarin-macios/tests/monotouch-test/AudioToolbox/SystemSoundTest.cs:line 73
* Fix system version checks to work properly on Mac Catalyst (which uses the macOS
version as its system version).
* Add the framework-specific defines to the build for monotouch-test.csproj (using
the generated response files), this way we can use them in the tests.
* Sprinkle conditionals in numerous places - I tried using either framework-specific
or XAMCORE_3_0 whenever that made since (instead of using Mac Catalyst as a condition).
* Updated a few tests to use non-deprecated API (because the deprecated API often
doesn't exist in Mac Catalyst).
* Also a few minor API fixes to make any corresponding tests compile.
Some of the tests fail because the assert is looking at the wrong iOS
version. Looking at the API definitions:
* UIStackView - Available in iOS 9, not iOS 8.
* AudioServicesPlayAlertSoundWithCompletion - Available in iOS 9, not
iOS 8.
All the other tests reported in the issue pass.
Issue: https://github.com/xamarin/xamarin-macios/issues/4437
* Fix many version checks to be based on Xcode version instead of iOS version.
* Added/fixed a few expected values according to platform version to match behavior in older macOS versions.
When we fail to create an InputAudioQueue, we need to free the local GCHandle
we previously created, not the instance GCHandle where we'd put the local
GCHandle in case of success.
This fixes bug #59911 to throw the correct (invalid parameter) exception (and
not leak the local GCHandle either).
https://bugzilla.xamarin.com/show_bug.cgi?id=59911
* [monotouch-test] Optionally ignore tests that show permission dialogs.
* [xharness] Add support for excluding tests that require permission dialogs.
* [xharness] Ignore introspection tests if we don't want permission dialogs.
Ignore introspection tests for now if we don't want permission dialogs, since
figuring out which API requires permissions is a tedious process (which we'll
eventually have to do though).
In a6b9c28975 I fixed SystemSoundTest.FromFile
to not crash randomly, and at the same time I added an assert to ensure that
the playback completion handler is called properly, with a 10s timeout.
Which won't work, because the audio file is 23s long.
There's no need for a 23s audio file, so the fix is simple: cut the audio file
to 0.3s instead.
https://bugzilla.xamarin.com/show_bug.cgi?id=54236
SystemSoundTest.FromFile was requesting to be called back when the sound
completed playback. This causes problems when the sound is disposed after it
has started playing, because in that case disposing it won't prevent the
callback from being called, but instead random InvalidCastExceptions / crashes
would occur.
https://bugzilla.xamarin.com/show_bug.cgi?id=52903
* SystemSound.PlaySystemSound doesn't work in the simulator.
https://stackoverflow.com/a/24973240/183422