doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
729 stars 125 forks source link

System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. #245

Closed marcus-j-davies closed 2 years ago

marcus-j-davies commented 2 years ago

So,

I have installed the latest version of Visual Studio for Mac (started up a .net standard 2.0 project.) All seem to be going fine until I tried to connect, at which point I get.

I am using 3.0.4

Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
  at SocketIOClient.Messages.MessageFactory.CreateMessage (System.Int32 eio, System.String msg) [0x00058] in <f16be1a5927042488396184b3d892181>:0 
  at SocketIOClient.Routers.Router.OnTextReceived (System.String text) [0x00022] in <f16be1a5927042488396184b3d892181>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_1 (System.Object state) [0x00000] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <92218043474744ea9d64d27064c35dcb>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
  at SocketIOClient.Messages.MessageFactory.CreateMessage (System.Int32 eio, System.String msg) [0x00058] in <f16be1a5927042488396184b3d892181>:0 
  at SocketIOClient.Routers.Router.OnTextReceived (System.String text) [0x00022] in <f16be1a5927042488396184b3d892181>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_1 (System.Object state) [0x00000] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <92218043474744ea9d64d27064c35dcb>:0 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <92218043474744ea9d64d27064c35dcb>:0 
marcusdavies@Marcuss-Mac-mini netcoreapp3.1 % mono test.exe

I have pinpointed to this system.text.json having a mismatched reference with system.memory. So I attempted to use the newtonsoft serializer, but this lib is still try to call system.text.json 🤷

Any help will be greatful as I have not been able to test this yet

marcus-j-davies commented 2 years ago

No idea why, but it seems as if I had some cache issues going on.