Console App - Setting a target for debug?

Hello all,

I am working on a console app, developing on a Windows 10 machine. I need to check something in my app that only runs when compiled to Linux (Target Linux). Is there a way to use a Pragma statement or similar to tell the app to run on windows but pretend be running on Linux?

Thanks,
Tim

What kind of issue are you troubleshooting? It’s very, very unlikely that you’ll be able to reproduce the issue on Windows if it is only happening on Linux. They’re completely different in thousands of fundamental ways, any of which might be contributing to the problem.

Since it sounds like you don’t have access to a Linux machine for testing, why not set one up in a virtual machine?

You can use the remote debugger. Install the debug stub on the Linux machine and select remote debug from the Windows IDE.

1 Like

or start from terminal and output informations if started with command line arguments /test as example.
helpful is CurrentMethodName and the output from try catch exception message
or use a special condition where you need the output information.
or write a log file.
a matter of what is less effort.

I haven’t tried this, but you may be able to run the Linux stub on the same machine using the Windows Linux Subsystem and then “remote debug” to 127.0.0.1 or localhost. Technically it’s just an Ubuntu VM so it might work.

1 Like