After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639626 - GStreamerSharp player engine will not build when using System.Linq extension method in GetSubtitleDescription
GStreamerSharp player engine will not build when using System.Linq extension ...
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: GStreamer
git master
Other Windows
: Normal normal
: 1.x
Assigned To: Banshee Maintainers
Banshee Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-15 22:40 UTC by Dustin C. Hatch
Modified: 2011-01-17 20:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dustin C. Hatch 2011-01-15 22:40:06 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);
Comment 1 Bertrand Lorentz 2011-01-17 20:35:04 UTC
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 ;)