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

Error with dotnet client #44

Closed
galgitron opened this issue Feb 8, 2018 · 25 comments
Closed

Error with dotnet client #44

galgitron opened this issue Feb 8, 2018 · 25 comments

Comments

@galgitron
Copy link

galgitron commented Feb 8, 2018

Using PusherClient 0.5.1 with WebSocket4Net 0.15.2.

After a pile of NuGet updates, my existing code now breaks when I try to Connect(). As below:

        var pusher = new Pusher("redacted");
        pusher.Connect();

Error is:

System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'Void WebSocket4Net.WebSocket..ctor(System.String, System.String, System.Collections.Generic.List1<System.Collections.Generic.KeyValuePair2<System.String,System.String>>, System.Collections.Generic.List1<System.Collections.Generic.KeyValuePair2<System.String,System.String>>, System.String, System.String, WebSocket4Net.WebSocketVersion, System.Net.EndPoint)'.
Source=PusherClient
StackTrace:
at PusherClient.Connection.Connect()
at PusherClient.Pusher.Connect()

@dunlavy
Copy link

dunlavy commented Mar 15, 2018

Are they watching their issues? Or is .NET pusher being neglected?

@imaji
Copy link
Contributor

imaji commented Mar 15, 2018

Hi,

When you say "a pile" of nuget updates, what else were you upgrading?

Cheers,
John

@galgitron
Copy link
Author

galgitron commented Mar 15, 2018

mostly version upgrades. websocket4net and Newtonsoft I think.

@imaji
Copy link
Contributor

imaji commented Mar 15, 2018

Any other packages that have a shared dependencies? I'm going to try try reproducing :)

@galgitron
Copy link
Author

The only other non .net package is SuperSocket.ClientEngine. All packages are the latest versions

@galgitron
Copy link
Author

I was able to remove SuperSocket.ClientEngine and reproduce the OP error, so disregard the SuperSocket

@imaji
Copy link
Contributor

imaji commented Mar 15, 2018

Cool, I'll try reproducing it tonight/tomorrow

@galgitron
Copy link
Author

If you can't reproduce, let me know and I'll try to put together a sample app

@imaji
Copy link
Contributor

imaji commented Mar 15, 2018

What version of .NET are you working against?

@galgitron
Copy link
Author

4.7

@imaji
Copy link
Contributor

imaji commented Mar 16, 2018

I've managed to reproduced it. It looks like Websocket4Net 15.0 has introduced a funny into it.

I've done some googling and found we're not the only library affected by the issue. There seem to be a few libraries out there having this problem. I've tested with 15.0, 15.1 & 15.2, and the all suffer from it.

As a short term fix whilst I fix it this side, can I recommend that you go back down to 14.1 of Websocket4Net?

@galgitron
Copy link
Author

Glad to hear the problem has been isolated! If it won't take too long to patch, I'd rather wait for your fix. I frequently update my nuget packages and I don't want to keep track of downversioning

@imaji
Copy link
Contributor

imaji commented Mar 16, 2018

Reproduced, but not isolated yet. As far as I can tell, this is happening inside of WebSocket4Net, so will probably be a bug raised on WebSocket4Net.

@galgitron
Copy link
Author

Are you taking the lead on pursuing that or should I?

@imaji
Copy link
Contributor

imaji commented Mar 16, 2018

Let me isolate it, then we'll take it from there :)

@martinsolovey
Copy link

I am running into the same issue, and going back to 0.14.1 was not a fix for me.

I'll stay tunned to this.

@imaji
Copy link
Contributor

imaji commented Mar 20, 2018

@martinsolovey You're getting the exact same problem with 0.14.1? You don't have any references to 0.15.x anywhere else in your code base?

Could you make a simple solution that reproduces it please? As I can reproduce it without problem in 0.15.x, but not 0.14.x

@martinsolovey
Copy link

martinsolovey commented Mar 20, 2018

Actually if I create a brand new project and install first WebSocket4Net 0.14.1 it works!

I will see how to fix that within my real sln, I probably have latest WebSocket4Net running on another class library project, do you know if it's possible to have them both working ?

EDIT:
Well, unfortunately I can't get this to work, in my real project I installed for all projects WebSocket4Net 0.14.1 .. and after that PusherClient .. and I get this on runtime.

An unhandled exception of type 'System.IO.FileLoadException' occurred in PusherClient.dll

Additional information: Could not load file or assembly 'WebSocket4Net, Version=0.15.2.11, Culture=neutral, PublicKeyToken=eb4e154b696bf72a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

@imaji
Copy link
Contributor

imaji commented Mar 20, 2018

You won't be able to load the two versions of the same named DLL into the same project, last write will win.

So that's telling you you have a reference to 0.15.2 somewhere. You'll need to remove that reference via the nuget manager, and if you still have a reference to 0.15.2, then it's been added as a reference to a project not via nuget. Delete that reference, and then re-add it with nuget.

@martinsolovey
Copy link

Found the wrong reference, killed it and now it's working !

Gonna use the WebSocket version 0.14.1 for now, keep us posted though, if it's possible to move to the latest will do!

thanks for everything! much appreciated

@galgitron
Copy link
Author

@imagi, how's the progress? Not trying to rush you, but do you have a rough ETA?

@imaji
Copy link
Contributor

imaji commented Mar 22, 2018

@galgitron Ok, so I've dug through the code as much as I can, and I don't think the problem is with the Pusher Client, this appears to be a problem with the WebSocket4Net library.

In the Pusher Client, we only use the following constructor:

var ws = new WebSocket("the pusher URL");

The error you're getting, and the one I've been able to replicate looks like this:

{"Method not found: 'Void WebSocket4Net.WebSocket..ctor(System.String, System.String, System.Collections.Generic.List1<System.Collections.Generic.KeyValuePair2<System.String,System.String>>, System.Collections.Generic.List1<System.Collections.Generic.KeyValuePair2<System.String,System.String>>, System.String, System.String, WebSocket4Net.WebSocketVersion, System.Net.EndPoint)'."}

Which is a CTOR we don't use. So I decompiled the WebSocket4Net DLL included with 0.15.2 and had a look, and found no matching CTOR.

It doesn't look like the Pusher Client is the only one affected by this problem. discord-net/Discord.Net#954

I think you're going to need to raise this on the WebSocket4Net repo.

I'm going to close this issue, as I think it's WebSocket4Net specific, yell if you object :)

@imaji imaji closed this as completed Mar 22, 2018
@galgitron
Copy link
Author

Appreciate the effort. I'll pursue it with WebSocket4Net then.

@kerryjiang
Copy link

Why the code can pass the build if they use a constructor which doesn't exist?

@rustybrick
Copy link

Is there any solution to this? I am running into the same issue and it's been a year after this post.

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

6 participants