VFP and .NET Interop
OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
Gravatar is a globally recognized avatar based on your email address. OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Alejandro A Sosa
  All
  Feb 20, 2017 @ 07:54am

Hello,

Trying to implement SignalR communication ran into the following error.

OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client: Method not found: 'Newtonsoft.Json.Linq.JValue Newtonsoft.Json.Linq.JValue.CreateNull()'...

Alex

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Rick Strahl
  Alejandro A Sosa
  Feb 20, 2017 @ 11:18am

Not sure without looking closer.

You might be missing the Newtonsoft.Json assembly in the folder.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Alejandro A Sosa
  Rick Strahl
  Feb 25, 2017 @ 03:05pm

I am not sure exactly how it was repaired, but it was. Among other things I restarted IIS. That is my leading hunch.

Thanks for the answer,

Alex

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Kathy
  Alejandro A Sosa
  Dec 1, 2017 @ 07:45am

Hello,
I have exactly the same issue but I'm not sure where the problem is.
I have Newtonsoft.Json in Fox folder.
I read somewhere that it could be because of the package version conflicts so I removed Newtonsoft.Json and updated it.
I also restart IIS.
None worked!
I alsoe tried to install Newtonsoft.Json verson 6.0.4 (in case the missing method has any issue in the latest version) but apparently it gets updated by Westwind.Utilities.

I would appreciate any help or any idea on this.
Thanks,
Kathy

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Rick Strahl
  Kathy
  Dec 2, 2017 @ 01:09pm

Most likely you're running into a versioning issue with the Newtonsoft.json.dll. YOu probably need an assembly version override in your .config file to redirect the version to the actual installed version of the Newtonsoft.Json.dll.

I think the SignalR assembly is linked to V6 and Web Connection/Client Tools now ship with V10 so all calls need to be forwarded to V10. In fact if you go to the SignalR Client on NuGet you can see the dependency on Newtonsoft.Json 6.0.4:

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

To override the assembly version:

Here's what I have in my vfp9.exe.config file that I was using for the SignalR demos at Southwest Fox:

<runtime>    
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
  </assemblyBinding>       
</runtime>

Note this is necessary only if you have some other component that uses the JSON features (like wwDotnetBridge). The reason that Alex's problem cleared most likely was due to the fact that when he recylced the first load of the DLL was caused by the newer version and so it found the right version. However if something else tries to load with a different version that's where things get screwed up. The assembly redirect avoids that always forcing a specific version.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Kathy
  Rick Strahl
  Dec 4, 2017 @ 08:49pm

Thank you so much for the detailed information.
I'm still trying to get it to work. I'm sorry if I should ask some basic questions on this, the VFP9.exe.config is new to me.
I updated Newtonsoft.Json to the latest version (10.0.3), I set all "specific version" to False and I added the VFP9.exe.config file but it looks like getting ignored! I'm not sure if I should address it by the -C switch or if it should be done in another way. Should I expect the commands in the command window to work or it'll work with .exe at runtime?
I get the same error right after:

loChat.joingroup("Rick","Markdown Monster")

I appreciate your help on this.
Kathy

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Kathy
  Kathy
  Dec 5, 2017 @ 08:02am

I copied vfp9.exe.config where the vfp9.exe is and I removed the -c switch and the error is gone.
I'm still not receiving the "Rick joined group..." yet but I think this is something else that I should deal with.
Thank you so much Rick.
Kathy

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Kathy
  Kathy
  Dec 5, 2017 @ 11:21am

I can see the messages now.
I had not noticed that I should Uncomment FUNCTION OnReceiveMessage(loMessage) in chatclient.prg.
There's no errors and everything is working perfectly.
Thanks again Rick.
Kathy

Gravatar is a globally recognized avatar based on your email address. re: OLE IDispatch exception code 0 from Microsoft.AspNet.SignalR.Client
  Rick Strahl
  Kathy
  Dec 5, 2017 @ 02:20pm

Nice...

The methods shouldn't have the Print code - that was just to demonstrate. Realistically you'll either BINDEVENT() those methods or put whatever custom code you need into them.

+++ Rick ---

© 1996-2018