Bug 17890 - Xamarin.iOS has become less flexible at inferring generic types from method arguments.
Summary: Xamarin.iOS has become less flexible at inferring generic types from method a...
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2014-02-19 15:38 UTC by Damon Bohls
Modified: 2014-09-29 11:17 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Damon Bohls 2014-02-19 15:38:48 UTC
Just as one example, we have some code which calls the following method:

   public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length, IComparer<TKey> comparer)

in System.Array. Our call previously looked like this:

   Array.Sort(keys, traits, startIndex, length, this);

so TKey and TValue were inferred from the arguments. I'm not sure when things changed, but for newer versions of Xamarin Studio threw these errors:

Error CS1502: The best overloaded method match for `System.Array.Sort(System.Array, System.Array, int, int, System.Collections.IComparer)' has some invalid arguments (CS1502) (!Common.MT.2010)

Error CS1503: Argument `#5' cannot convert `NationalInstruments.DataInfrastructure.Internal.TraitStructuralComparer' expression to type `System.Collections.IComparer' (CS1503) (!Common.MT.2010)

and required that we change the code as follows:

   Array.Sort<IndexedTrait, Trait>(keys, traits, startIndex, length, this);
Comment 1 Marek Safar 2014-02-19 15:58:56 UTC
This looks like compiler issue. Could you crete self contained repro? Type inference can behave quite differently based on used types and their dependencies.
Comment 2 Damon Bohls 2014-02-19 18:38:07 UTC
Make take me awhile, but I'll find time to whittle it down into an app we can share.
Comment 3 Marek Safar 2014-09-29 11:17:41 UTC
No response