GNOME Bugzilla – Bug 639626
GStreamerSharp player engine will not build when using System.Linq extension method in GetSubtitleDescription
Last modified: 2011-01-17 20:35:04 UTC
The following error is encountered when building ``Banshee.GStreamerSharp``:: 'Gst.List' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'Gst.List' could be found (are you missing a using directive or an assembly reference?) in banshee\src\Backends\Banshee.GStreamerSharp\Banshee.GStreamerSharp\PlayerEngine.cs Line 182, Column 14 The FirstOrDefault extension method is provided by System.Linq (from the System.Core assembly), which is correctly referenced by the project. Replacing the ``GetSubtitleDescription`` method of the ``PlayerEngine`` class with a loop allows the project to build correctly. Gst.List tag_list = playbin.GetTextTags (index) .GetTag (Gst.Tag.LanguageCode); foreach(string tag in tag_list) { if (tag != null) { return tag; } } return default(string); Another suggestion was to explicitly cast the list contents to ``string`` to allow the project to build:: return playbin.GetTextTags(index) .GetTag(Gst.Tag.LanguageCode) .Cast<string>() .FirstOrDefault(t => t != null);
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report. I went with the second solution, because we love Linq ;)