Reputation: 31
Every time I try to run my code, I am having this error: "Csc.exe" exited with code - 255. I removed and re-installed Visual Studio 2015 and it did not help.
Upvotes: 2
Views: 3429
Reputation: 8308
Does csc.exe
succeed with different code?
It is possible that you’ve found a bug in the compiler that causes it to crash when trying to compile your particular program. To see if this is the case, create a new “Console App” project with Visual Studio (VS) and see if the default app in the template compiles and runs. If that works, then your code might be triggering a csc.exe
crash. If that doesn’t work, your VS install might be completely broken in which case I would recommend uninstalling and reinstalling VS (but you already tried that). If you cannot get VS to run even simple programs on your computer, you’ll need to try to track down why it is crashing and see if it is something you can manually fix. If your system is messed up enough and it is not worth tracking a fix down, you might consider reinstalling Windows (using the “Reset” feature).
Another thing to try is running your code on another computer with VS installed. That can help determine if the issue is your code triggering a compiler error versus your computer being messed up.
If csc.exe
only crashes for your particular code, then that is a bug in csc.exe
. If there is an issue with your code, csc.exe
should generate a nice error explaining the issue with your code instead of crashing.
It is also possible that your code is valid but a compiler bug causes csc.exe
to crash. An example of this (with VS 2017 and csharp7) is roslyn#19182. If this is the case, you might try using the VS feedback (frowny face/feedback button in the upper right hand corner) feature to report the issue so that the VS developers know about it. Also, you might be able to poke your code around until suddenly VS starts running successfully. If this is the issue, it might be hard to guess why csc.exe
is crashing, but, if you can, try to isolate the issue. For example, if csc.exe
was running fine before you made some changes to your code, look at the changes you made and see if undoing them results in csc.exe
running successfully again. Then try to make a new, minimal repro which causes csc.exe
to crash and send that as feedback using VS’s feedback mechanism or by reporting a bug against the roslyn project. You might also ask a new question here about why that particular code causes csc.exe
to crash. With particular code, people might be able to guess why csc.exe
can’t handle it and suggest workarounds to use while waiting for the VS team to release a fix.
As it is, your question does not have enough information to guess why csc.exe
was crashing for you. Hopefully this answer provides some guidance on what steps you should take if you ever end up in such a situation.
Upvotes: 3