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

Crash in signalr.exe ghp #4128

Closed
sliekens opened this issue Jun 3, 2018 · 14 comments
Closed

Crash in signalr.exe ghp #4128

sliekens opened this issue Jun 3, 2018 · 14 comments

Comments

@sliekens
Copy link

sliekens commented Jun 3, 2018

I'm following a tutorial that teaches the usage of the CLI tool.
https://www.nuget.org/packages/Microsoft.AspNet.SignalR.Utils/

I don't know exactly what is going on but the tool doesn't work on my machine.

Expected behavior

It shouldn't crash?

Actual behavior

SignalR Utility Version: 2.2.3.0
Creating temp directory C:\Users\Steven\AppData\Local\Temp\ddf6edcf-d533-4cd0-a970-7eff83f6b120

Warning: Could not load file or assembly 'Microsoft.DiaSymReader.Native.amd64.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

Warning: Could not load file or assembly 'Microsoft.DiaSymReader.Native.x86.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Microsoft.AspNet.SignalR.DefaultDependencyResolver.RegisterDefaultServices()
at Microsoft.AspNet.SignalR.DefaultDependencyResolver..ctor()
--- End of inner exception stack trace ---

Server stack trace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.JavaScriptGenerator.GenerateProxy(String path, String url, Action`1 warning)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.JavaScriptGenerator.GenerateProxy(String path, String url, Action`1 warning)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.OutputHubs(String path, String url, String outputPath)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.Execute(String[] args)
at Microsoft.AspNet.SignalR.Utils.Program.Main(String[] args)

image

Steps to reproduce

I don't know, basically install the tool and try to run it.

..\packages\Microsoft.AspNet.SignalR.Utils.2.2.3\tools\signalr.exe ghp /url:http://localhost:60946/

@analogrelay
Copy link
Contributor

analogrelay commented Jun 26, 2018

The core error is coming from your server (the other messages are warnings). It looks like there's a dependency conflict with the version of JSON.NET you are using: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.

Could you post which version of Newtonsoft.Json is in your packages.config file? Or, better yet, post your project to GitHub and share it so we can review it to see if we can find the issue?

@analogrelay
Copy link
Contributor

Also if you could link to the tutorial you're following that would help, as we can see if we can reproduce the issue by following the same steps.

@sliekens
Copy link
Author

Also if you could link to the tutorial you're following that would help, as we can see if we can reproduce the issue by following the same steps.

It's from a PluralSight so you'll need a subscription there
https://app.pluralsight.com/player?course=signalr-introduction&author=christian-weyer&name=signalr-introduction-m4-clients&clip=3&mode=live

Christian explains how to install and run the signalr CLI somewhere in the second half of SignalR Clients --> Demo: jQuery Clients 1

I followed all the steps that lead up to this video except I used VS2017 with the newest web templates.

@sliekens
Copy link
Author

Could you post which version of Newtonsoft.Json is in your packages.config file?

I don't have access to my home computer right now but it was probably version 11. But definitely something newer than 6.

@analogrelay
Copy link
Contributor

Ok. SignalR depends on Newtonsoft.Json 6.0.0, which is where that version number is coming from.

However, NuGet should have installed a binding redirect in to your web.config file to tell the runtime to allow version 11 to be substituted in whenever an older version is requested, but maybe something went wrong there. Can you post your project file, package.config and web.config files (make sure to remove any sensitive info like URLs, connection strings or credentials) to a gist and link it here so I can see if something is missing? Please don't post the files inline, they are quite large and hard to review in a comment post 😉

@sliekens
Copy link
Author

However, NuGet should have installed a binding redirect in to your web.config file to tell the runtime to allow version 11 to be substituted in whenever an older version is requested, but maybe something went wrong there.

That doesn't sound right. NuGet wouldn't automatically add binding redirects for the utils package because it doesn't declare that it depends on Newtonsoft.Json 6.

This package has no dependencies.

https://www.nuget.org/packages/Microsoft.AspNet.SignalR.Utils/

But even if I add binding redirects to my Web.config manually, I still wouldn't expect it to work. The signalr.exe utility should have its working dir set to ..\packages\Microsoft.AspNet.SignalR.Utils.2.2.3\tools\ which doesn't contain a config file with binding redirects. I'd be surprised if it somehow knew to use the Web.config file from my project directory.

@analogrelay
Copy link
Contributor

analogrelay commented Jun 27, 2018

It's the server that has the binding failure. The Utils package gives you the tool, but when running the tool it connects to your SignalR server in order to gather data about the Hubs in order to generate proxies. Can you post more information about your server project? That's where the error is occurring.

@sliekens
Copy link
Author

Hmm but how does that work? I get the same error even when my site is down, and even when I leave off the /url part entirely.

image

Project files available here: https://github.com/StevenLiekens/ghpcrash

Running the generate-proxy.ps1 script always crashes for me.

@analogrelay
Copy link
Contributor

Well that's interesting. I'll have to take a look. It's possible I'm misreading the stack trace.

@analogrelay
Copy link
Contributor

Hrm, I'm not getting that error at all, I just get this:

SignalR Utility Version: 2.3.0.0
Creating temp directory C:\Users\anurse\AppData\Local\Temp\50a7581c-b77c-4ef6-ad49-b723236ff374

Can you try on a different machine? I wonder if maybe you have something installed on the machine that's causing problems.

@sliekens
Copy link
Author

sliekens commented Jul 6, 2018

Diffferent machine, same error... can you try on a different machine?

@CGX106
Copy link

CGX106 commented Jul 13, 2018

I have updated SignalR from v2.2.2 to v2.3.0. The config file of "signalr.exe" ("signalr.exe.config") seems to be missing in the "Microsoft.AspNet.SignalR.Utils" NuGet package in v2.3.0. In v2.2.2 the config file is shipped with the NuGet package.

The generation seems to work if "signalr.exe.config" from v2.2.2 is copied in the directory of "signalr.exe" from v2.3.0.

@analogrelay
Copy link
Contributor

Thanks @CGX106 , I'll take a look at this. Glad there's a temporary workaround for you

@analogrelay
Copy link
Contributor

This is the same issue as #4152 . Closing this issue so we only have one issue tracking the work :).

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

3 participants