JKorf/Kraken.Net

.NET Framework does not work even with Version 2.2.3

vburwitz3 opened this issue · 5 comments

Describe the bug
I created a empty .NET console project (.NET Core 2.2) in VS, installed Kraken.Net ("Install-Package KrakenExchange.Net"). The sample code works find.
I created a empty .NET Windows Forms project (.NET Framework 4.6.1, also tried 4.7), installed also Kraken.Net. On running I get the error message "PlatformNotSupportedException: Das WebSocket-Protokoll wird für diese Plattform nicht unterstützt." (PlatformNotSupportedException: the WebSocket-protocol is not supported for this plattform.)

This happened after "var subscribeResult=krakenSocketClient.SubscribeToTickerUpdatesAsync("BTC/USD", data => {});" when then accessing "subscribeResult.Result.Success".

To Reproduce
KrakenClient.SetDefaultOptions(new KrakenClientOptions() {
ApiCredentials=new ApiCredentials(krakenApiKey, krakenSecretKey),
});
KrakenClient krakenClient=new KrakenClient();

var client = new KrakenSocketClient(new KrakenSocketClientOptions()
ApiCredentials =new ApiCredentials(krakenApiKey, krakenSecretKey),
});
var subscribeResult =krakenSocketClient.SubscribeToTickerUpdatesAsync("BTC/USD", data => {
Console.WriteLine("BTC/USD: "+data.Data.LastTrade.Price);
});

if (!subscribeResult.Result.Success) {
// Subscription failed, check callResult.Error for more info
Console.WriteLine("startWebsocketStream: ERROR: SubscribeToTickerUpdatesAsync failed (Error:"+subscribeResult.Result.Error+")!");
}
else {
Console.WriteLine("startWebsocketStream: SubscribeToTickerUpdatesAsync successful.");
}

Expected behavior
It should work on both .NET Core and .NET Framework but it seems it does not. Anyway I use Binance.NET extensively and have no issues at all and pretty happy, now wanted to use the librabry for Kraken.NET but I do not get it to run. It seems a fundamental issue.
Help how to solve that would be great since I need to port a .NET Form App and therefore need .NET Framework!

Debug logging
As shown above.

JKorf commented

This is because websockets aren't natively supported on Windows 7 or lower. Running it from Windows 8 or up won't have this issue.

Thank you! Yes, the development machine is still Windows 7.
Any tipp how to get that support into Windows 7? Is there any installable update for that support?

JKorf commented

No sorry, since Windows 7 support has been dropped by Microsoft for a while I don't really want to invest too much time into supporting it, and there is no quick fix to get it working again with the latest version.

I would suggest updating your Windows ;) Else you're stuck with library versions which use a version of CryptoExchange.Net before version 4.0.0

For all the Windows 7 users there is a important information. Even if you will find lots of statements that websockets are not supported in Windows 7 that is interestingly not true at all.
Just install the newest Visual Sudio and you can create a .NET Core based project (even for Windows Forms). Since .NET Core is meant to be platform independet it brings nearly everything with it inhouse.
For an existing project that means some changes how the program is started but creating a new .NET Core based Forms project and pasting your old code into that is pretty much copy and paste with little migration work (Main and Dispose method are slightly different and located differently), GUI is 1:1 copied by copying the InitializeComponent() method.

Voila it works even on Windows 7 like on any other Windows with a .NET Core based project. And also with all the newest whatever version of your prefered library (at least I dont see why that should not work and it seemingly does work flawlessly).

JKorf commented

Yes right, the issue is the combination of .net framework with Windows 7. Upgrading to dotnet core will resolve the issue, as will updating to Windows 8 or higher. The exact support is a bit hard to figure out, but this omment from David Fowl does a good job explaining it:
dotnet/dotnet-api-docs#908 (comment)