Bug 44510 - Cannot cast array to IList in PCL projects
Summary: Cannot cast array to IList in PCL projects
Status: RESOLVED DUPLICATE of bug 44402
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2016-09-20 01:08 UTC by Adam
Modified: 2016-09-20 10:20 UTC (History)
2 users (show)

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


Description Adam 2016-09-20 01:08:53 UTC
I am using Xamarin Studio on a Mac, for iOS. My project contains a PCL (net45, profile78) project, and an iOS project.

In the iOS Project - this compiles:
IList list = (IList)new string[] { "DOES THIS CAST?" };

In the PCL project - this generates a compile error "cannot convert type 'string[]' to 'System.Collections.IList'" :
IList list = (IList)new string[] { "DOES THIS CAST?" };

Obviously, this code used to be perfectly fine.
I discovered this, because our application started crashing after updating Xamarin, because the following line:

// items is an array
var candidate = new NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Add, items, candidate.NewStartingIndex);

used to resolve to this method declaration
public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, IList changedItems, int startingIndex)

and NOW it's resolving to this one:
public NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction action, object changedItem, int index)

My "notify collection changed event" that is then fired, reports a collection of a collection! So my handlers puke...

This is a HUGE bug, HELP!!!!!
Comment 1 Marek Safar 2016-09-20 07:49:45 UTC

*** This bug has been marked as a duplicate of bug 44402 ***

Note You need to log in before you can comment on or make changes to this bug.