code builds but hangs while running

code: https://paste.pythondiscord.com/KTVQ when i build it in release, everything works fine. but when i run in release, it just hangs and does nothing, even though all i'm doing is this:
class Program
{
// ... <- nothing up here is run

static void DisplayHelp()
{
string help = """
This is a test help screen.

What do you think?
""".Trim();

Console.WriteLine(help);
}

static void Main()
{
DisplayHelp();
}
}
class Program
{
// ... <- nothing up here is run

static void DisplayHelp()
{
string help = """
This is a test help screen.

What do you think?
""".Trim();

Console.WriteLine(help);
}

static void Main()
{
DisplayHelp();
}
}
97 Replies
Angius
Angius5w ago
Well, your Main() only calls DisplayHelp() So... that's what runs You never call Execute(), for example
Evyr
Evyr5w ago
What do you mean by hang? When I run the paste you sent it prints out the estring in DisplayHelp then exits
it’s raining outside
it just doesn't output:
No description
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
add logs.. how?
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
there is zero output did you read literally anything in the post
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
yes, of course
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
Execute() isn't called because it's for later yes of course i read that
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Evyr
Evyr5w ago
yeah there's nothing wrong with the code
No description
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
still no output
Evyr
Evyr5w ago
press enter
it’s raining outside
wtf is conhost
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
yeah i mentioned that in the post build works fine execution fails
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Evyr
Evyr5w ago
navigate to the bin/release folder and run the executable created by building it'll work fine
it’s raining outside
even stripping the entire file (singular C# file by the way) and writing this doesnt work:
Console.WriteLine("Hello world");
Console.WriteLine("Hello world");
yes i tried that too nope
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
pressing escape does nothing
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Angius
Angius5w ago
Try running it from Powershell or VS Code's built-in terminal
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
i'm using vscode's terminal i'll try powershell is conhost just cmd?
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
it hangs in PS too
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
:hmmHD:
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
ah i see
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
i'm not using the window then
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
integrated terminal it hangs there too
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
all i did was change .Main() to print hello world instead Ctrl+C doesn't work to stop the terminal surprisingly
Evyr
Evyr5w ago
click on the output tab
MODiX
MODiX5w ago
TeBeCo
add -v:diag
Quoted by
React with ❌ to remove this embed.
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
an absolute fuck ton of text is speeding through my terminal
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Evyr
Evyr5w ago
scratch that, debug console, not output
it’s raining outside
debug console is empty
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Evyr
Evyr5w ago
huh, odd
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
nope it stopped like i said building works fine
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Angius
Angius5w ago
And are there any others?
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
it's in a single file
it doesn't need to be Program.cs - it just needs a .Main() entry point
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX5w ago
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
it’s raining outside
the chess bot i'm making on the side has an entry point in it's UCI.cs file - there it has top-level statements, which are essentially the same as a .Main() entry point no which is why i'm confused as to why it's acting like this i swear to god if it's my anti-virus i'm uninstalling thsi thing
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
it is, yes
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
HOLY FUCK IT WAS MY ANTIVIRUS i fucking hate this thing
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Angius
Angius5w ago
Make some D:/MyProjects and use that
it’s raining outside
you can do that?
Angius
Angius5w ago
Uh, yeah?
it’s raining outside
how do you make a D drive?
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Angius
Angius5w ago
Or partition an existing one But yeah, C:/MyProjects or whatever will do as well I forgot not everybody has more than one drive lol
Evyr
Evyr5w ago
either install another storage device, or if you free up some space, shrink your C drive volume and make a new volume using the disk management tool
it’s raining outside
windows defender is better than other antiviruses i swear and it's free
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
a computer does what it's told to :shrug:
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
Angius
Angius5w ago
To be fair, the fact that OneDrive can cause such issues is... counterintuitive lol
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
yeah fair enough my antivirus is nearly done uninstalling on the bright side
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
:thumbsup:
Unknown User
Unknown User5w ago
Message Not Public
Sign In & Join Server To View
it’s raining outside
alright, will do
Evyr
Evyr5w ago
I'm curious why you're using these in conjunction with the ThrowException method that just prints out the parameters and calls Environment.Exit(0); instead of throwing IndexOutOfRangeException and OverflowException with the message as one string passed into their constructors
No description
it’s raining outside
i'd prefer not to use a stack trace, since it looks kinda ugly tbh
Evyr
Evyr5w ago
fair ig
it’s raining outside
i'd prefer to have just
OverflowError: cannot increment block value above 255.
OverflowError: cannot increment block value above 255.
than
System.Exception: OverflowError: cannot increment block value above 255.
at ...
at ...
at ...
at ...
System.Exception: OverflowError: cannot increment block value above 255.
at ...
at ...
at ...
at ...
Evyr
Evyr5w ago
though you shouldn't be using 0 as the argument for Environment.Exit in this case, since it isn't completing successfully
No description
it’s raining outside
what happens when you exit with 1?
Evyr
Evyr5w ago
🤷‍♂️ mess around with it and see
it’s raining outside
seems like the exit code doesn't matter
Want results from more Discord servers?
Add your server