My team’s Bitrise build is failing after I made changes to our Xamarin codebase that leverage the updated overload resolution in C# 6 (described here: https://stackoverflow.com/a/37746488). Specifically, I added extension-method overloads that differ based on the type of callback parameter they accept: one takes an
Action, while another takes a
Func<Task>, like so:
public static void OnClick(this View view, object host, Action eventHandler) public static void OnClick(this View view, object host, Func<Task> eventHandler)
Thanks to the improved overload resolution in C# 6, I should not need to give these methods different names, as the compiler will determine the appropriate overload to use based on the type of the provided callback argument.
However, while these changes compile successfully in Xamarin Studio 6.1.5 w/ Mono 4.8.1 as well as Rider EAP 22, they cause CS0121 errors in Bitrise’s Xamarin Archive step similar to the following:
error CS0121: The call is ambiguous between the following methods or properties: 'OnClick(View, object, Action)' and 'OnClick(View, object, Func<Task>)'
The only solution thus far has been to rename one of the overloads, but I would like to avoid this if possible.
Stack: Xamarin Stable with XCode 8, on macOS 10.12 (Sierra)
The issue occurs in the Xamarin Archive step, v1.4.2, using either xbuild or msbuild.
- Does a “Rebuild” help? NO
- Does upgrading the build Step to the latest version help? NO
(Sent via email)