C
C#15mo ago
Statharas

❔ Can't create Singleton terminal for dll output debugging

I need to create a CLI to output some debugging information from a DLL, but I am having some issues and I can't tell what's wrong, because on my current setup, I am unable to debug normally. (VSC on MacOS, building a .net standard 2.0 dll for an x86, 4.8.1 application running on VM Windows) I was expecting this to work, but it doesn't
cs
using System;
using System.Diagnostics;
using System.IO;

namespace Paradigm
{
public class DebugConsole
{
private static DebugConsole instance = null;
private static readonly object lockObject = new object();
ProcessStartInfo psi;
StreamWriter sw;
StreamReader sr;
private DebugConsole()
{
psi = new ProcessStartInfo("cmd.exe")
{
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false
};
Process p = Process.Start(psi);

sw = p.StandardInput;
sr = p.StandardOutput;

}

public static DebugConsole Instance
{
get
{
lock (lockObject)
{

cs
using System;
using System.Diagnostics;
using System.IO;

namespace Paradigm
{
public class DebugConsole
{
private static DebugConsole instance = null;
private static readonly object lockObject = new object();
ProcessStartInfo psi;
StreamWriter sw;
StreamReader sr;
private DebugConsole()
{
psi = new ProcessStartInfo("cmd.exe")
{
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false
};
Process p = Process.Start(psi);

sw = p.StandardInput;
sr = p.StandardOutput;

}

public static DebugConsole Instance
{
get
{
lock (lockObject)
{

returning from lunch in ~30 minutes
8 Replies
arion
arion15mo ago
There are many logging frameworks you can use, you could use Serilog or you can use PInvoke to allocate a console via Kernel32.AllocConsole there could also be other ways of debugging into a vm, one could be to attach a debugger while within the vm
phaseshift
phaseshift15mo ago
Wdym "it doesn't work"?
Statharas
StatharasOP15mo ago
I get no command prompt
Omnissiah
Omnissiah15mo ago
just to be sure, which type of project is this?
arion
arion15mo ago
my guess is Framework winforms
Statharas
StatharasOP15mo ago
Standard 2.0 library
Omnissiah
Omnissiah15mo ago
so are you saying you don't see the cmd you are executing? are you running this how, a test project?
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server