Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application freezes when an authenticated method is called #11

Closed
alexemme opened this issue May 3, 2018 · 3 comments
Closed

Application freezes when an authenticated method is called #11

alexemme opened this issue May 3, 2018 · 3 comments

Comments

@alexemme
Copy link

alexemme commented May 3, 2018

i'm doing some tests with my application,

when i set the api credentials, and call, for istance, GetWalletsAsync()
the entire application hangs and get stuck,
i noticed it worked fine just the first time.

apparently it get stucks on this line :
using (var stream = request.GetRequestStream().Result)
on BitfinexClient.cs , line 852

i checked my api key on the website and it seems to be working fine.

the code is the same you provided:

BitfinexClient.SetDefaultOptions(new BitfinexClientOptions(){
    ApiCredentials = new ApiCredentials("APIKEY", "APISECRET")
});
using(var client = new BitfinexClient())
{
    var walletResult = client.GetWallets();
    if(!walletResult.Success)
       Console.WriteLine("Error: " + walletResult.Error);
    else
    {
        foreach(var wallet in walletResult.Data)
            Console.WriteLine(wallet.Currency + ": " + wallet.Balance);
    }
}

please help me, what i have to check?

@JKorf
Copy link
Owner

JKorf commented May 4, 2018

Hi,
I assume the freeze happens because you are calling it from the UI-thread. You can fix this by wrapping the code in a task:

Task.Run(()=>{
    // Code
});

Note that this is a little bug on the library side and it will be fixed in the next release, after which the separate task isn't needed anymore

@JKorf
Copy link
Owner

JKorf commented May 4, 2018

Released a new version, should be fixed there. Let me know if you have any issues.

@JKorf JKorf closed this as completed May 4, 2018
@alexemme
Copy link
Author

alexemme commented May 4, 2018

Yes, it works fine now,

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants