mkjeff/secs4net

core folder in secs4net project SECSGEM.cs use error

kyunggyuyeol opened this issue · 4 comments

Hi.

I'm trying to use only the secs4net project in the core folder.
However, an error occurs. In the SecsGem.cs file, at line 430
'System.IO.FileNotFoundException' (Secs4net.dll)

An error occurs. Do you need to include other projects?

-----------------add --------------

SecsGem.cs line 430 in

MessageHeader create error

new MessageHeader(deviceId: 0xFFFF, messageType: msgType, systemBytes: systembyte).EncodeTo(new byte[10]);

EncodeTo(new byte[10])

Running this code will result in an error

i use visual studio 2017 and framework 4.7.1

However, an error occurs. In the SecsGem.cs file, at line 430
'System.IO.FileNotFoundException' (Secs4net.dll)

It's easy to fix. You just need to add System.Memory assembly to your project.

@a-v-kalabuhov @kyunggyuyeol

i got an issue which is that "system.memory version=4.0.1" could not be loaded.
details info as below:

System.IO.FileNotFoundException: could not load...“System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”
Filename:“System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”
   at Secs4Net.StreamDecoder.<.ctor>g__GetMessageHeader|23_1(Int32& length, Int32& need)
   at Secs4Net.StreamDecoder.<.ctor>g__GetTotalMessageLength|23_0(Int32& length, Int32& need)
   at Secs4Net.StreamDecoder.Decode(Int32 length)
   at Secs4Net.SecsGem.<.ctor>g__SocketReceiveEventCompleted|84_9(Object sender, SocketAsyncEventArgs e)

secs4net project info:
target framework: .Net Standard 2.0
vs 2017

please advice

the issue has been solved. we have to specify the System.Memory version in project "SecsDevice", and it will override the default System.Memory verson