I sometimes work on a laptop locally and sometimes remote into a desktop machine.
Both have the same OS and version:
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.19045 N/A Build 19045
But when I run a project that runs as a console application, I get different results depending on whether the solution is on the laptop or the desktop machine.
On my desktop machine running the project where there is a loop with this code:
System.Console.Write($"{vbCr}{"".PadLeft(Console.CursorLeft, " "c)}")
System.Console.Write($"{vbCr}Getting info for table: {tbl.Name}")
causes that line to get overwritten (as intended), on my laptop, that works as effectively a writeline (not what I want).
Why? And what do I do so that it works correctly on the laptop?
Thanks to a hint by Dai, I was able to fix the problem. Apparently Console.CursorLeft isn't updated in real time, by adding System.Console.Out.Flush() before the write's, it is now acting correctly on my laptop. Buffer size was the same on both machines.
Still not quite sure of why this was happening (I would have expected different behavior if CursorLeft was zero or some other value), but it does fix my immediate problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With