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

[bgen] Add support for binding static members in protocols. #20645

Merged
merged 3 commits into from
May 31, 2024

Conversation

rolfbjarne
Copy link
Member

Add support for binding static members in protocols.

Given the following API definition:

[Protocol]
public interface Protocol {
    [Abstract]
    [Static]
    [Export ("requiredStaticMethod")]
    void RequiredStaticMethod ();

    [Static]
    [Export ("optionalStaticMethod")]
    void OptionalStaticMethod ();

    [Abstract]
    [Static]
    [Export ("requiredStaticProperty")]
    IntPtr RequiredStaticProperty { get; set; }

    [Static]
    [Export ("optionalStaticProperty")]
    IntPtr OptionalStaticProperty { get; set; }
}

we're binding it like this:

[Protocol ("Protocol")]
public interface IProtocol : INativeObject {
    [Export ("requiredStaticMethod")]
    public static void RequiredStaticMethod<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Export ("optionalStaticMethod")]
    public static void OptionalStaticMethod<T> () where T: NSObject, IProtocol { /*  implementation */ }

    [Property ("RequiredStaticProperty")]
    [Export ("requiredStaticProperty")]
    public static IntPtr GetRequiredStaticProperty<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Property ("RequiredStaticProperty")]
    [Export ("setRequiredStaticProperty:")]
    public static void SetRequiredStaticProperty<T> (IntPtr value) where T: NSObject, IProtocol { /* implementation */ }

    [Property ("OptionalStaticProperty")]
    [Export ("optionalStaticProperty")]
    public static IntPtr GetOptionalStaticProperty<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Property ("OptionalStaticProperty")]
    [Export ("setOptionalStaticProperty:")]
    public static void SetOptionalStaticProperty<T> (IntPtr value) where T: NSObject, IProtocol { /* implementation */ }
}

Also add documentation and tests.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 21 tests failed, 149 tests passed.

Failures

❌ interdependent-binding-projects tests

3 tests failed, 4 tests passed.
  • interdependent-binding-projects/iOS Unified 64-bits - simulator/Debug: HarnessException (Harness exception for 'interdependent-binding-projects': System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted() at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.ExecuteCommandAsync(String filename, IList1 args, ILog log, ILog stdout, ILog stderr, TimeSpan timeout, Dictionary2 environmentVariables, Nullable1 cancellationToken)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext()
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.RunAsyncInternal(Process process, ILog log, ILog stdout, ILog stderr, Action2 kill, Func3 getChildProcessIds, Nullable1 timeout, Dictionary2 environmentVariables, Nullable1 cancellationToken, Nullable1 diagnostics)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.WaitForExitAsync(Process process, Nullable1 timeout) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.Common.Utilities.Extensions.TimeoutAfter[T](Task1 task, TimeSpan timeout)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at System.Threading.Tasks.Task.TwoTaskWhenAnyPromise1.Invoke(Task completingTask) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Diagnostics.Process.OnExited() at System.Diagnostics.Process.RaiseOnExited() at System.Diagnostics.Process.CompletionCallback(Object waitHandleContext, Boolean wasSignaled) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.PortableThreadPool.CompleteWait(RegisteredWaitHandle handle, Boolean timedOut) at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback() --- End of stack trace from previous location --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted()
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult()
    at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453
    at Xharness.Jenkins.TestTasks.RunSimulator.RunTestAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunSimulator.cs:line 128
    at Xharness.Jenkins.TestTasks.RunTest.ExecuteAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunTest.cs:line 113
    at Xharness.Jenkins.TestTasks.TestTasks.RunInternalAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/TestTask.cs:line 269)
  • interdependent-binding-projects/tvOS - simulator/Debug: HarnessException (Harness exception for 'interdependent-binding-projects': System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted() at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult() at Microsoft.DotNet.XHarness.iOS.Shared.CrashSnapshotReporter.EndCaptureAsync(TimeSpan timeout) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.DelayPromise.CompleteTimedOut() at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool) at System.Threading.TimerQueue.FireNextTimers() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback() --- End of stack trace from previous location --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted()
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult()
    at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453
    at Xharness.Jenkins.TestTasks.RunSimulator.RunTestAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunSimulator.cs:line 128
    at Xharness.Jenkins.TestTasks.RunTest.ExecuteAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunTest.cs:line 113
    at Xharness.Jenkins.TestTasks.TestTasks.RunInternalAsync() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/TestTask.cs:line 269)
  • interdependent-binding-projects/watchOS 32-bits - simulator/Debug: Crashed

Html Report (VSDrops) Download

❌ linker tests

7 tests failed, 58 tests passed.
  • link all/Mac Modern/Debug: Failed (Test run crashed (exit code: 134).
    No test log file was produced)
  • link sdk/iOS Unified 64-bits - simulator/Debug: HarnessException (Harness exception for 'link sdk': System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted() at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.ExecuteCommandAsync(String filename, IList1 args, ILog log, ILog stdout, ILog stderr, TimeSpan timeout, Dictionary2 environmentVariables, Nullable1 cancellationToken)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.SetExistingTaskResult(Task1 task, TResult result)
    at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.RunAsyncInternal(Process process, ILog log, ILog stdout, ILog stderr, Action2 kill, Func3 getChildProcessIds, Nullable1 timeout, Dictionary2 environmentVariables, Nullable1 cancellationToken, Nullable1 diagnostics)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.WaitForExitAsync(Process process, Nullable1 timeout) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.Common.Utilities.Extensions.TimeoutAfter[T](Task1 task, TimeSpan timeout)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at System.Threading.Tasks.Task.TwoTaskWhenAnyPromise1.Invoke(Task completingTask) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Diagnostics.Process.OnExited() at System.Diagnostics.Process.RaiseOnExited() at System.Diagnostics.Process.CompletionCallback(Object waitHandleContext, Boolean wasSignaled) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.PortableThreadPool.CompleteWait(RegisteredWaitHandle handle, Boolean timedOut) at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback() --- End of stack trace from previous location --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted()
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult()
    at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453
    at Xharness.Jenkins.TestTasks.RunSimulator.RunTestAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunSimulator.cs:line 128
    at Xharness.Jenkins.TestTasks.RunTest.ExecuteAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunTest.cs:line 113
    at Xharness.Jenkins.TestTasks.TestTasks.RunInternalAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/TestTask.cs:line 269)
  • link sdk/iOS Unified 64-bits - simulator/Release: HarnessException (Harness exception for 'link sdk': System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted() at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.ExecuteCommandAsync(String filename, IList1 args, ILog log, ILog stdout, ILog stderr, TimeSpan timeout, Dictionary2 environmentVariables, Nullable1 cancellationToken)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.SetExistingTaskResult(Task1 task, TResult result)
    at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.RunAsyncInternal(Process process, ILog log, ILog stdout, ILog stderr, Action2 kill, Func3 getChildProcessIds, Nullable1 timeout, Dictionary2 environmentVariables, Nullable1 cancellationToken, Nullable1 diagnostics)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.WaitForExitAsync(Process process, Nullable1 timeout) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.Common.Utilities.Extensions.TimeoutAfter[T](Task1 task, TimeSpan timeout)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread)
    at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
    at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
    at System.Threading.Tasks.Task.TwoTaskWhenAnyPromise1.Invoke(Task completingTask) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Diagnostics.Process.OnExited() at System.Diagnostics.Process.RaiseOnExited() at System.Diagnostics.Process.CompletionCallback(Object waitHandleContext, Boolean wasSignaled) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.PortableThreadPool.CompleteWait(RegisteredWaitHandle handle, Boolean timedOut) at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback() --- End of stack trace from previous location --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted()
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult()
    at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453
    at Xharness.Jenkins.TestTasks.RunSimulator.RunTestAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunSimulator.cs:line 128
    at Xharness.Jenkins.TestTasks.RunTest.ExecuteAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunTest.cs:line 113
    at Xharness.Jenkins.TestTasks.TestTasks.RunInternalAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/TestTask.cs:line 269)
  • link sdk/tvOS - simulator/Debug: HarnessException (Harness exception for 'link sdk': System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted() at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.iOS.Shared.CrashSnapshotReporter.EndCaptureAsync(TimeSpan timeout) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.DelayPromise.CompleteTimedOut() at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool) at System.Threading.TimerQueue.FireNextTimers() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback() --- End of stack trace from previous location --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted()
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult()
    at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453
    at Xharness.Jenkins.TestTasks.RunSimulator.RunTestAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunSimulator.cs:line 128
    at Xharness.Jenkins.TestTasks.RunTest.ExecuteAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunTest.cs:line 113
    at Xharness.Jenkins.TestTasks.TestTasks.RunInternalAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/TestTask.cs:line 269)
  • link sdk/tvOS - simulator/Release: HarnessException (Harness exception for 'link sdk': System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted() at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.iOS.Shared.CrashSnapshotReporter.EndCaptureAsync(TimeSpan timeout) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.DelayPromise.CompleteTimedOut() at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool) at System.Threading.TimerQueue.FireNextTimers() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback() --- End of stack trace from previous location --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted()
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult()
    at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453
    at Xharness.Jenkins.TestTasks.RunSimulator.RunTestAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunSimulator.cs:line 128
    at Xharness.Jenkins.TestTasks.RunTest.ExecuteAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunTest.cs:line 113
    at Xharness.Jenkins.TestTasks.TestTasks.RunInternalAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/Jenkins/TestTasks/TestTask.cs:line 269)
  • link sdk/watchOS 32-bits - simulator/Debug: Crashed
  • link sdk/watchOS 32-bits - simulator/Release: Crashed

Html Report (VSDrops) Download

❌ mmp tests

2 tests failed, 0 tests passed.
  • mmptest/macOS/Debug: Failed (Execution failed with exit code 4)
  • MMP Regression Tests/Mac: Failed

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

2 tests failed, 9 tests passed.
  • monotouch-test/iOS Unified 64-bits - simulator/Debug: HarnessException (Harness exception for 'monotouch-test': System.AggregateException: One or more errors occurred. (A task was canceled.)
    ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.get_TestExecutionStarted() at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult() at Xharness.AppRunner.RunAsync() in /Users/builder/azdo/_work/2/s/xamarin-macios/tests/xharness/AppRunner.cs:line 453 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at Microsoft.DotNet.XHarness.Common.Execution.ProcessManager.ExecuteCommandAsync(String filename, IList1 args, ILog log, ILog stdout, ILog stderr, TimeSpan timeout, Dictionary2 environmentVariables, Nullable1 cancellationToken)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.AsyncStateMachineBox1.MoveNext(Thread threadPoolThr\n\nThe message from CI is too large for the GitHub comments. You can find the full results here.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Add support for binding static members in protocols.

Given the following API definition:

```cs
[Protocol]
public interface Protocol {
    [Abstract]
    [Static]
    [Export ("requiredStaticMethod")]
    void RequiredStaticMethod ();

    [Static]
    [Export ("optionalStaticMethod")]
    void OptionalStaticMethod ();

    [Abstract]
    [Static]
    [Export ("requiredStaticProperty")]
    IntPtr RequiredStaticProperty { get; set; }

    [Static]
    [Export ("optionalStaticProperty")]
    IntPtr OptionalStaticProperty { get; set; }
}
```

we're binding it like this:

```cs
[Protocol ("Protocol")]
public interface IProtocol : INativeObject {
    [Export ("requiredStaticMethod")]
    public static void RequiredStaticMethod<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Export ("optionalStaticMethod")]
    public static void OptionalStaticMethod<T> () where T: NSObject, IProtocol { /*  implementation */ }

    [Property ("RequiredStaticProperty")]
    [Export ("requiredStaticProperty")]
    public static IntPtr GetRequiredStaticProperty<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Property ("RequiredStaticProperty")]
    [Export ("setRequiredStaticProperty:")]
    public static void SetRequiredStaticProperty<T> (IntPtr value) where T: NSObject, IProtocol { /* implementation */ }

    [Property ("OptionalStaticProperty")]
    [Export ("optionalStaticProperty")]
    public static IntPtr GetOptionalStaticProperty<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Property ("OptionalStaticProperty")]
    [Export ("setOptionalStaticProperty:")]
    public static void SetOptionalStaticProperty<T> (IntPtr value) where T: NSObject, IProtocol { /* implementation */ }
}
```

Also add documentation and tests.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

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.

Perfect! ❤️it!

@dalexsoto
Copy link
Member

I really wish we had extension properties in C#

@vs-mobiletools-engineering-service2

This comment has been minimized.

1 similar comment
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11) passed 💻

All tests on macOS M1 - Mac Big Sur (11) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
.NET (No breaking changes)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 1a2d4f6903377a0f36ccd0d30c1ef306d1a5ff82 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 1a2d4f6903377a0f36ccd0d30c1ef306d1a5ff82 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 170 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ install-source: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 7 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker: All 65 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ mac-binding-project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 6 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 7 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 8 tests passed. [attempt 3] Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (watchOS): All 4 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: [PR build]

@rolfbjarne rolfbjarne merged commit 7b3ad09 into xamarin:main May 31, 2024
62 of 64 checks passed
@rolfbjarne rolfbjarne deleted the protocol-static-members branch May 31, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants