question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NotImplementedException

See original GitHub issue

Hi,

I try to use this library instead an old libPLCTagWrapper that I have in one of our project. I downloaded the nuget and implement the method but I run a NotImplementedException on the NativeTagWrapper.coreLibEventCallback

I tried to find what’s wrong in the the source code, and it seems that the Event catched is not in the switch case of the method.

void coreLibEventCallback(int eventTagHandle, int eventCode, int statusCode)
        {

            var @event = (Event)eventCode;
            var status = (Status)statusCode;
            var eventArgs = new TagEventArgs() { Status = status };

            switch (@event)
            {
                case Event.ReadCompleted:
                    ReadCompleted?.Invoke(this, eventArgs);
                    break;
                case Event.ReadStarted:
                    ReadStarted?.Invoke(this, eventArgs);
                    break;
                case Event.WriteStarted:
                    WriteStarted?.Invoke(this, eventArgs);
                    break;
                case Event.WriteCompleted:
                    WriteCompleted?.Invoke(this, eventArgs);
                    break;
                case Event.Aborted:
                    Aborted?.Invoke(this, eventArgs);
                    break;
                case Event.Destroyed:
                    Destroyed?.Invoke(this, eventArgs);
                    break;
                case Event.Created:
                    Created?.Invoke(this, eventArgs);
                    break;
                default:
                    throw new NotImplementedException();
            }
        }

Maybe my implementation is not correct, find my code below. I run on VS 2019 and in .net framework 4.7.2

var myTag1 = new Tag<RealPlcMapper, float>()
  {
  Name = "testtag[0].myTag", //also tried with a tag like "testtag"
  Gateway = "192.0.0.0",
  Path = "1,0",
  PlcType = PlcType.ControlLogix,
  Protocol = Protocol.ab_eip,
  Timeout = TimeSpan.FromSeconds(5)
  };
  
  
  myTag1.Initialize();
  //Write value to PLC
  //This will call Initialize internally since it's the first use of this tag
  //myTag.Value = 3.75;
  //myTag.Write();
  rtxtABAnswer.Text += $"Write myTag" + Environment.NewLine;
  //Read value from PLC
  //Value will also be accessible at myTag.Value
  myTag1.Read() ;
  var result = myTag1.Value;
  rtxtABAnswer.Text += $"myTag value {result}" + Environment.NewLine;

I also tried to get all the project with example, compile it and run it on the computer who have access to the PLC but it did not work I have a message “Windows cannot access peripheric, file or path access” …

Thanks for your help

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
johncharriscommented, Jul 9, 2022

There was a new version of the libplctag C library released recently that causes a NotImplementedException . By downloading the dll for 2.5.0 and not using the NativeImport package I was able to get it working. @timyhac posted the link earlier. https://github.com/libplctag/libplctag.NET#developing-for-systems-with-immutable-application-directories

0reactions
Kevin138commented, Jul 9, 2022

I rolled back to NativeImport v1.0.30 (from 1.0.33). Seems to have solved my issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NotImplementedException Class (System)
The NotImplementedException exception indicates that the method or property that you are attempting to invoke has no implementation and therefore provides no ...
Read more >
c# - throw new NotImplementedException()
1 Answer 1 ... It means exactly what it says, Your method is not implemented yet. It doesn't do anything. It's only there...
Read more >
NotImplementedException (Apache Commons Lang 3.4 API)
Thrown to indicate that a block of code has not been implemented. This exception supplements UnsupportedOperationException by providing a more semantically ...
Read more >
NotImplementedException
A NotImplementedException indicates that the software is incomplete. You should remove all use "throw new NotImplementedException()" as your default method ...
Read more >
C# NotImplementedException
C# type notes. The NotImplementedException indicates in a clear way that the functionality being requested was simply not implemented. Exception.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found