unable to call main method
Hi my program stops one line before the main method causing it to not run any help would be appreciated
39 Replies
Program cannot stope before
Main()
because Main()
is the entry point of the program
It's quite literally the very first thing that gets executedWhy does nothing happen then
It seems you're in the debugger
you should step over using the debugger
Did you intend to run the debugger?
I wanted to run the program
Well, you ran the debugger
Can I run the program without compiling?
And probably placed a breakpoint or some such, which is why the code paused execution
No
C# is a compiled language
It needs to be compiled
The thing is it would always work int he compiler
Till today
What compiler?
Debugger*
Is it because I’m trying to perform file handling?
Unlikely
Oh my
I found the breakpoint
I see thank you
Didn’t know that was a thing
$debug
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
Here you can read more about the debugger
Breakpoints and all
But if you just want to run your code, you don't need to run it through the debugger
What’s the better way to donut
Do it
Compile it into an end?
Just... run it
Exe
No, run the code
Green arrow in the top toolbar
Ohhhh
Thank you
Or
F5
shortcut
Assuming you're using VS 2022F5 opens debugger for me
Ah,
Ctrl+F5
thenAlright
Also I just learnt about file handling
This is my code
But I get the error could not find part of the path
Protip: you can screenshot your screen
Im at college
I can’t screenshot
Since I don’t hve discord on the pc
You can open it in the browser
Regardless, take a good look at the path
I’ve got double slashes
But it was automatically added like that
Apart from that I don’t see what else the issue could be
Path in your code
Path on your disk
Ohhhh
Do you see the difference?
Yes
Double text based
Thank you haha
Sometimes a second pair of eyes if very nice