-1

I run the code sample that is included on GitHub for GitHub OpenDNP3 with the most recent NuGet package of this library and the sample seems to do not work as expected.

I start the outstation. Then I start the master. The result of the master is constantly polling the outstation. It never stops. I thought it could do one integrity poll (or not) and wait for me to press a key, but I can't. The screen is always dumping the state of the outstation.

Is OpenDNP3 working properly and/or is the sample bugged?

Output of master

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119
  • Please review *[Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/)* (e.g., *"Images should only be used to illustrate problems that* ***can't be made clear in any other way,*** *such as to provide screenshots of a user interface."* (it covers terminal output as well) ) and [do](https://stackoverflow.com/posts/72801993/edit) the right thing. – Peter Mortensen Jun 30 '22 at 11:27
  • @PeterMortensen, Thanks a lot Peter for the information. Without knowging exactly that, I usually try to use text instead of image for the same reasons explained. In this case, I intentionaly chosen to use a screen shot instead of text to make it obvious that is an screen output. That is not code or anything useful that could require a cut and paste. If I only had pasted the text, it would have prevent the user to see quickly it is a screen output (cmd line output). Does it still appear that I should have used pasted text? – Eric Ouellet Jun 30 '22 at 14:14

1 Answers1

0

I just found my solution. The sample can't be run as is; it should be included into a console application. The problem arise when you take the code and include it into a Windows application (any, like a WPF application). When you do so, Console.ReadLine will not stop waiting for the user to press "Enter" like in a console app because the standard input device for a Windows application is not the keyboard. See documentation: Console.ReadLine Method

'If the standard input device is the keyboard, the ReadLine method blocks until the user presses the Enter key.'

But it does not stop and wait in a Windows application.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119