mkjeff / secs4net

SECS-II/HSMS-SS/GEM implementation on .NET
https://mkjeff.github.io/secs4net/
MIT License
443 stars 195 forks source link

core folder in secs4net project SECSGEM.cs use error #26

Closed kyunggyuyeol closed 5 years ago

kyunggyuyeol commented 5 years ago

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?

kyunggyuyeol commented 5 years ago

-----------------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

a-v-kalabuhov commented 5 years ago

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.

nevernet commented 4 years ago

@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

nevernet commented 4 years ago

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