question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working on Xamarin.android

See original GitHub issue

Hello ! I’m using the nuget package version 2.3.0 and while the library works fine in a normal console application, i cant get the library to work consistently on xamarin android,

I’m using latest xamarin.android, made an android unit test app compiling using API 25 target, and min sdk 16, running on 21 emulator( Genymotion ) using visual studio 2015 on windows 10 x64 .

I made an xamrain.android unit tester to test it after it failed in my application:

using NUnit.Framework;
using YoutubeExplode;

namespace UnitTestYoutubeExplode
{
    [TestFixture]
    public class TestsSample
    {

        public string[] ids = { "PMivT7MJ41M"};

        [Test, TestCaseSource("ids")]
        public async void TestMethod(string id)
        {
            using(var client = new YoutubeClient())
            {
                Assert.True(YoutubeClient.ValidateVideoId(id));      //This passed fine all the time
                Assert.True(await client.CheckVideoExistsAsync(id)); //This passed fine all the time

                var playlistItemInfo = await client.GetVideoInfoAsync(id);
                Assert.IsNotNull(playlistItemInfo.Title);
            }
        }

    }
}

All ids are valid. Originally the test had more ids, but i couldn’t get it to pass even with one. Here are the exceptions i was getting at await client.GetVideoInfoAsync(id) :

TestMethod("h--P8HzYZ74") [FAIL] : System.Exception : Could not get video info
		  at YoutubeExplode.YoutubeClient+<CheckVideoExistsAsync>d__7.MoveNext () [0x000dd] in <9d4dbb3394174337b21bfdc5e06fc022>:0 

TestMethod("papuvlVeZg8") [FAIL] : System.Exception : Could not get video context
		  at YoutubeExplode.YoutubeClient+<GetVideoInfoAsync>d__8.MoveNext () [0x000f4] in <9d4dbb3394174337b21bfdc5e06fc022>:0 

TestMethod("gL-WVjvzu34") [FAIL] : System.Exception : Could not parse sts
		  at YoutubeExplode.Internal.Parser.VideoContextFromHtml (System.String rawHtml) [0x00066] in <9d4dbb3394174337b21bfdc5e06fc022>:0 
		  at YoutubeExplode.YoutubeClient+<GetVideoInfoAsync>d__8.MoveNext () [0x000ff] in <9d4dbb3394174337b21bfdc5e06fc022>:0 


I tried with or without reference to System.Net.Http, different httpclient implementations (Default, Managed,AndroidClientHandler) , debug and release build and nothing make it work consistently.

About 1 in a 10 would work fine, while in the regular console application, i had no problem running 50+ one after another.

The library stated it targets .NET Standard 1.1, which xamarin.android supports, so it should work.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Tyrrrzcommented, Mar 24, 2017

Updated

1reaction
Tyrrrzcommented, Mar 22, 2017

Gonna push a new package on friday

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Xamarin.Forms
Fix: Remove all packages, and re-add Xamarin.Forms ... If the Xamarin.Android.Support packages have been updated to incompatible versions, the ...
Read more >
breakpoint not working on Xamarin PCL but working fine ...
1) Reboot mac. This ensures any old adb.exe is gone. · 2) In Solution Explorer, rt-click on the Xamarin PCL project, select Properties...
Read more >
Issues · xamarin/xamarin-android
Developer Options - Don't Keep Activities in the On position can cause problems when exiting/quitting an app Area: App Runtime. needs-triage. ...
Read more >
Xamarin and Android deploy problem
I'm using VS2017 and developing and Android Enterprise App in Xamarin. This is one of the first Xamarin apps that was in full...
Read more >
Common Problems In Xamarin.Android And Their Solutions
The main disadvantage of this is, the learning slope is really very slippery - not just steep. Most of the beginners leave out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found