EasyModbusTCP.NET icon indicating copy to clipboard operation
EasyModbusTCP.NET copied to clipboard

VB.Net. Trying to use EasyModbus events gives a "Ambiguous Name" compile error.

Open YvesLev opened this issue 6 years ago • 4 comments

For exemple, For VB, coilsChanged event is ambiguous with CoilsChanged (Case Sensitive).

So I have not been able yet to implement the coilsChanged and holdingRegistersChanged Events in VB.Net. Always gives me compile error: ('' is ambiguous because multiple kinds of members with this name exist in '')

But I'm quite new to this I admit, and I might not use it correctly in vb.net...

YvesLev avatar Mar 03 '18 18:03 YvesLev

I just realized that I duplicated your issue with #7. I forked this project and added "Handler" to all delegates. That removes the ambiguity for VB.NET.

I'll push my latest branch so you can try it out from my repository.

scottpage avatar Mar 23 '18 05:03 scottpage

See if this forked commit ed7c8c0 works for you.

scottpage avatar Mar 23 '18 05:03 scottpage

I downloaded this "forked" version and built it.

Yes the resultant DLL works in VB.Net now!

Thank you!

YvesLev avatar Mar 24 '18 02:03 YvesLev

However, just noticed that when I issue the StopListening() method, I receive an exception in Visual Studio. It does not seem to stop my application though. I tried this fork in C# and same thing happens. But the previous version, the one I took from sourceforge, is working fine for the StopListening.

Here is the exception text from the Output window during debug of my application:

Exception levée : 'System.NullReferenceException' dans EasyModbus.dll Exception levée : 'System.ObjectDisposedException' dans System.dll System.ObjectDisposedException: Impossible d'accéder à un objet supprimé. Nom de l'objet : 'System.Net.Sockets.Socket'. à System.Net.Sockets.Socket.EndAccept(IAsyncResult asyncResult) à System.Net.Sockets.TcpListener.EndAcceptTcpClient(IAsyncResult asyncResult) à EasyModbus.TCPHandler.AcceptTcpClientCallback(IAsyncResult asyncResult) dans F:\Downloads\Modbus\EasyModbusTCP_Source\EasyModbus\ModbusServer.cs:ligne 112 'Lego70909MB.exe' (CLR v4.0.30319: Lego70909MB.exe) : Chargé 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_fr_b77a5c561934e089\System.resources.dll'. Le module a été généré sans symboles. Exception levée : 'System.InvalidOperationException' dans System.dll System.InvalidOperationException: Pas à l'écoute. Vous devez appeler la méthode Start() avant d'appeler cette méthode. à System.Net.Sockets.TcpListener.BeginAcceptTcpClient(AsyncCallback callback, Object state) à EasyModbus.TCPHandler.AcceptTcpClientCallback(IAsyncResult asyncResult) dans F:\Downloads\Modbus\EasyModbusTCP_Source\EasyModbus\ModbusServer.cs:ligne 131 Le programme '[4268] Lego70909MB.exe' s'est arrêté avec le code 0 (0x0).

YvesLev avatar Mar 26 '18 00:03 YvesLev