Bug 44323 - Type 'System.Array' does not contain a member 'Cst' and the best extension method overload 'System.Linq.Enumerable.Case<T>(this System.Collections.IEnumerable)' requires an insance of type 'System.Collections.IEnumerable' (CS1929)
Summary: Type 'System.Array' does not contain a member 'Cst' and the best extension me...
Status: RESOLVED DUPLICATE of bug 44402
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.6.0 (C8)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2016-09-14 19:34 UTC by Nick Berardi
Modified: 2016-09-18 17:54 UTC (History)
6 users (show)

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

Simple solution including System.Reactive.Linq (3.78 MB, application/zip)
2016-09-16 09:08 UTC, Jock Findlay

Description Nick Berardi 2016-09-14 19:34:54 UTC
# Steps to reproduce

using System;
using System.Linq;

enum Test { A, B }
var list = Enum.GetValues(typeof(Test)).Cast<Test>().ToList();

# Expected behavior
It compiles.

# Actual behavior
Compile time error.

Type 'System.Array' does not contain a member 'Cast' and the best extension method overload 'System.Linq.Enumerable.Case<T>(this System.Collections.IEnumerable)' requires an insance of type 'System.Collections.IEnumerable' (CS1929)

# Supplemental info (logs, images, videos)

# Test environment (full version information)
Comment 1 Nick Berardi 2016-09-14 19:52:14 UTC

I am still working out the exact cause however I started getting this compile issue after upgrading from 2.8.

Comment 2 Sebastien Pouliot 2016-09-14 20:00:26 UTC
If this happens from the `csharp` command then it's not related to Xamarin.Mac, as this ships with Mono (and it works fine for me using the latest XM and an older Mono 4.4.x).

The error itself sounds like System.Core.dll is not referenced.
Comment 3 Sebastien Pouliot 2016-09-14 20:02:32 UTC
-> Compilers (magic mouse tricked me)
Comment 4 Brendan Zagaeski (Xamarin Support) 2016-09-15 02:19:33 UTC
## Note to the Mono team

This seems closely related to Bug 43838, which includes a confirmed way to reproduce very similar looking errors at least on Xamarin.Android.  That might come in handy since I was unable to reproduce the reported error using just the csharp shell as in Comment 0 (at least in my environment).

## Confirmation status: unable to confirm so far

The "Steps to reproduce" as listed in Comment 0 did not produce an error for me on Mono 4.6.0 (mono-4.6.0-branch/746756c).  Here's a transcript of my attempt to reproduce the error in the interactive csharp prompt:

> Mono C# Shell, type "help;" for help
> Enter statements below.
> csharp> enum Test { A, B }
> csharp> var list = Enum.GetValues(typeof(Test)).Cast<Test>().ToList();
> csharp> list
> { A, B }
> csharp>
Comment 5 Marek Safar 2016-09-15 12:05:34 UTC
I cannot reproduce the issue either. The error is most likely cause by missing or wrong System.Core.

You can try to manually load it using

>> LoadAssembly("System.Core");

if that makes any difference to you.
Comment 6 Brendan Zagaeski (Xamarin Support) 2016-09-15 21:09:22 UTC
## Tallying one more report of this error message for bookkeeping

2016/09/15 - http://forums.xamarin.com/discussion/77758/does-anyone-have-any-feedback-on-a-system-array-does-not-have-a-member-cast-xcode8-xs-update/p1

(This report appears to be from Xamarin.iOS as compared to Xamarin.Mac in Comment 0.)
Comment 7 Jock Findlay 2016-09-16 09:08:05 UTC
Created attachment 17532 [details]
Simple solution including System.Reactive.Linq

This solution will not compile with 

package-id: com.xamarin.mono-MDK.pkg
version: 4.6.0

but does compile with

package-id: com.xamarin.mono-MDK.pkg
version: 4.4.2
Comment 8 Jock Findlay 2016-09-16 09:52:57 UTC
Comment on attachment 17532 [details]
Simple solution including System.Reactive.Linq

System.Reactive.Linq is from the NuGet package 'Reactive Extensions - Query Library' version is 3.0.0
Comment 9 Marek Safar 2016-09-16 11:07:46 UTC

*** This bug has been marked as a duplicate of bug 44402 ***
Comment 10 Nick Berardi 2016-09-18 17:54:05 UTC
This definitely wasn't a rookie mistake like forgetting System.Core.  Because the only thing that didn't compile was the mentioned exception, every other LINQ statement worked.

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