2

I'm trying to use the json deserializer in my VS2008 C# Windows service program and am getting the above error as soon as a client sends data to the service via TCP. The error always occurs on:

protected virtual void OnDataReceived(DataEventArgs e)
{
EventHandler<DataEventArgs> handler = DataReceived;
  if (handler != null)
  {
    handler(this, e);   <-- error happens here
  }
}

I've include ServiceStack.Text as a reference in my solution and used the statement using ServiceStack.Text; The only code I'm using is:

o = JsonSerializer.DeserializeFromString <Dictionary<string, string>>(sAry[2]);

Any advice or direction would be greatly appreciated.

kmatyaszek
  • 19,016
  • 9
  • 60
  • 65
Velocedge
  • 43
  • 1
  • 5
  • A little more info... The subscriber of the OnDataReceived event is where the serialization takes place. Something happened above to the format of the line in question. It should be: o = JsonSerializer.DeserializeFromString >(sAry[2]); which I copied from the web somewhere. – Velocedge Oct 03 '12 at 16:19
  • See my attempted answer here: http://stackoverflow.com/a/23716548/430885 – Frederik Struck-Schøning May 17 '14 at 22:16

1 Answers1

2

Please search for "fusion log viewer" and use it to investigate assembly loading failures.

Most likely you are not copying DLL to bin folder during build (Should be "Copy local=true" in properties) OR that assembly have dependencies on other files that you are not copying/installing correctly.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • I got nothing in the log viewer running it from the VS command prompt as admin. I even changed each of the options and got the error, but nothing in the log. I did verify that the .dll is in the bin/debug directory with service. I copied all ServiceStack .dll's there too just to make sure I had everything of theirs. – Velocedge Oct 03 '12 at 16:48
  • Ok, you had the basic problem. This is a Windows Service and to debug it you have to install it. So, I installed it in another directory (production), not bin/debug. So I copied the ServiceStack.Text.dll to the production directory and it worked. – Velocedge Oct 03 '12 at 16:59
  • To find the fusion log viewer check out this article https://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx as it's location and name are not obvious (Fuslogvw.exe) – The Senator Feb 24 '16 at 09:44