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

PlatformNotSupportedException #335

Open
hedihadi opened this issue Aug 14, 2023 · 2 comments
Open

PlatformNotSupportedException #335

hedihadi opened this issue Aug 14, 2023 · 2 comments

Comments

@hedihadi
Copy link

hedihadi commented Aug 14, 2023

hello, i'm using .NET 6.0 on Windows 10, when i call this function

        private async void Form1_Load(object sender, EventArgs e)
        {
            socketConnectionChanged(false);
            socketio= new SocketIO("http://192.168.0.107:5000");
            socketio.OnConnected += async (sender, e) =>
            {
                socketConnectionChanged(true);
            };
            socketio.OnDisconnected += async (sender, e) =>
            {
                socketConnectionChanged(false);
            };
            await socketio.ConnectAsync();

in the following line

await socketio.ConnectAsync();

i get this error

System.PlatformNotSupportedException: 'Operation is not supported on this platform.'

this is the details

System.PlatformNotSupportedException
  HResult=0x80131539
  Message=Operation is not supported on this platform.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Action`1.BeginInvoke(T obj, AsyncCallback callback, Object object)
   at WebSocketSharp.WebSocket.open()
   at WebSocketSharp.WebSocket.Connect()
   at SocketIOClient.NetFx.WebSocketClient.WebSocketSharpClient.<ConnectAsync>d__10.MoveNext()
   at SocketIOClient.SocketIO.<ConnectCoreAsync>d__88.MoveNext()
   at SocketIOClient.SocketIO.<ConnectAsync>d__87.MoveNext()
   at HeatFusion.Form1.<Form1_Load>d__5.MoveNext() in C:\Users\Hedi\source\repos\HeatFusion\HeatFusion\Form1.cs:line 209

i'm a python/flutter/javascript developer, i recently went into C# so i honestly have no idea what's going on, i'd appreciate some help on this.

@hedihadi
Copy link
Author

i did some more test, when the socketio server is offline, i get the following error instead

SocketIOClient.Exceptions.ConnectException: 'Timeout, please see innerException.'

inner exception:
WebSocketException: Unable to connect to the remote server.

@LevyShang
Copy link

use .net framework or .net standard

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