質問

I recently have encountered a weird issue with my project: as soon as I click debug and it builds the project, it stops debugging. There isn't any error message, or anything else that comes up, including the form itself.

I've tried messing with the settings: no splash screen and I've even changed the startup form to a blank Windows form. What could be causing this problem? Is it Visual Studio or my code?

役に立ちましたか?

解決 3

I found a solution, but not the problem.

How I fixed it:

I just created a template for each form, created a new project, and imported everything into the new project. One thing that I found useful is in the new project is to add an existing item (CTRL + D), and group select (maybe, don't know if you can) and select all the non-code/form/designer/etc. files (like text files or images) and then import them.

他のヒント

Probably your program is exiting normally. Set a breakpoint at the first statement to be executed, press F5, then single-step through the program until you get to the last statement executed.

If the first statement is never reached, then one of two things probably happened:

  1. You're mistaken about which statement is executed first, or

  2. The program is terminating during initialization, probably because a class constructor is exiting the program either normally or abnormally.

A few ideas:

Use Debug->Exceptions, and check all the checkboxes so you break when an exception is thrown.

Use Debug->Step into to step into your code.

Then you can use Step Over and Step Into (look at the menu for the keyboard shortcuts)

I have found a possible solution after I had the same problem.

You probably have more than one project in your solution (The main project, plus an "InstallShield" project",perhaps)

Make sure you have the main project set up as "Startup Project".

In the Solution Explorer, right click on the Main Project and select "Set as Startup Project". Everything will then run OK.

If you get the error like: "The debug mode is program but there is no program specified....." Go to Solution Explorer then Right Click on main project's name and Click on Set as StartUp project. You can debug your program.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top