Version 2.0 Issues

Jan 14, 2014 at 8:19 PM
I have tried to use WoWSharp 2.0, but I have yet to get it to work. Usually the threads will exit when using :
client.GetCharacterAsync("kazzak", "Grendiser", CharacterFields.All).Result
I also tried running the test cases for 2.0, but get an AggregateException on
TestWowClientAsync().Wait()
I haven't had any issues using 1.x of WoWSharp at all, just 2.x. Any help will be much appreciated
Jan 14, 2014 at 8:41 PM
After looking at the test case there are multiple exceptions being through like this:
Exception:Caught: "Failed to decrypt using provider 'BNetKeysContainer'. Error message from the provider: The RSA key container could not be opened." (System.Configuration.ConfigurationErrorsException)
A System.Configuration.ConfigurationErrorsException was caught: "Failed to decrypt using provider 'BNetKeysContainer'. Error message from the provider: The RSA key container could not be opened."
Time: 1/14/2014 3:39:15 PM
Thread:<No Name>[7332]
Coordinator
Jan 15, 2014 at 10:16 AM
Greetings

Thank you for your feedback.

There are two modes for API to work: Authenticated and Non-Authenticated. With authenticated you connect to API using public and private keys supplied to you by Blizzard. They are specified in app.config. In my case, the app.config is encrypted because I don't want to share the keys supplied to me by Blizzard.

So you can edit app.config file (after removing the encrypted part), and enter your own PublicKey/PrivateKey pairs or you can connect unauthenticated which the API also supports.

If you have any problems please let me know :)

Best regards,
Sherif
Jan 15, 2014 at 4:27 PM
You are very much correct Grendizer. I removed the use of the keys for testing, which did work, which is fantastic.

After that, I had an issue with the synchronous technique of something like:
Character character = client.GetCharacterAsync("kazzak", "Grendiser", CharacterFields.All).Result
return character;
For me, the application would just freeze at that point. I switched to using the asynchronous way though, which works great. I am guessing I was doing something wrong which made the use of ".Result" not work for me.
Coordinator
Jan 15, 2014 at 8:18 PM
Hello

Can you please tell me which framework you are using, version of visual studio, 32-bit or 64-bit, windows version, etc?

I cannot reproduce your problem in .NET Framework, but in Silverlight for example it would freeze since synchronous operations are not supported by the Silverlight runtime. But this is rather a limitation in Silverlight and not in the library and if I am not mistaken applies to Windows store apps and Windows phone as well.

If that's not the case, I would like to know more information about your environment so I can reproduce the problem in my side and eventually fix it.
Jan 16, 2014 at 12:05 AM
I am using a Windows Store application with Visual Studio 2013 Ultimate 32bit.

I created a new application, a console application, and tested and the below code works great. The only issue seems to be with a Windows Store application.
Character character = client.GetCharacterAsync("kazzak", "Grendiser", CharacterFields.All).Result
Coordinator
Jan 16, 2014 at 1:41 AM
It is recommended to use async pattern in Windows Store development, which is why most Windows Store classes have Async methods without sync equivalent. Declaring your method with async keyword and using await to get the result will make the code look similar to sync while actually being executed as async and not blocking UI.
var character = await client.GetCharacterAsync("Kazzak", "Grendiser", CharacterFields.All);
                
Jan 16, 2014 at 5:39 AM
Yea, that is how I am doing it now with the application. It was a very very easy change to get it working. It just seems that the synchronous way blocks indefinitely in the windows store development. At least that is what happened to when I and a friend tested it.

Everything is working wonderfully and I can see that the 2.0 version was a huge overhaul of the library, which is no small feat. Great job on it, I really do think it is wonderful work you have done.