What is different between visual studio F5, ctrl+F5, or running outside of visual studio? - c++

I have written a program in vc++ that has different behavior in various case as below.
When I run it by F5 it works properly in release mode.
When I run it by ctrl + F5 it crashes when I start to send data to the program.
Outside of visual studio it crashes immediately.
I don't know how to find the bug. Any idea on
what is different between these cases?

Running ctrl + F5 will run the application without debugger.
(http://msdn.microsoft.com/en-US/library/8b59xk0f(v=vs.90).aspx)
This is not the same as running in release mode.
You can run your application in debug mode but without debugger.
It sounds stupid but is for example helpful if you want to stop the console from closing on exit. (How to stop console from closing on exit?)

You need to understand the difference between running an application in debug mode and release mode. F5 will generally help you to debug the application and ctrl + F5 will execute the application. There might be some issues in release mode that makes your vs to crash. Read this to get an understanding.

Related

Is it possible that my C++ program accidentally crash Visual Studio or Windows?

I created a Visual Studio C++ project, write a game (about 10K-lines).
Yesterday, I compile and ran it in release mode, then I got some access violation error.
My program doesn't have any virus-like command, the closest one is just the array access,
so I think it came from array-index-out-of-bound.
Therefore, I aborted my program - using STOP button - and edit my code, test it again - F5 (release mode, not-optimized).
This happened around 10-20 times - crash & debug ; my happy life cycle.
When I shut down, Windows 7 created a popup error about access violation.
(It has sometimes happened before, but has never caused any serious long-term affect.)
Problem
Today, after I turned on the computer, it began to act strangely
Windows and Visual Studio start up a little slower. (I may be biased.)
Windows task bar (that has the start button) is quite non-responsive. (obvious, happen only once)
Visual Studio : some shortcuts (Ctrl K + Ctrl O to switch .cpp /.h) not work anymore except it open a file instead (look like it recognize only Ctrl O).
Visual Studio : I can't assign any shortcut that has 2 Ctrl button (e.g. Ctrl xxx + Ctrl xxx)
I test with on-screen keyboard, after a bit of testing, my computer crashed. (mouse cursor disappear)
After I turned on my computer again - avoid opening Visual Studio, my computer act as almost normal, but alt+tab not work anymore.
Note that I didn't install any new software in the last 7 days.
Question
Is it possible that bug / crash of my C++ program (always run within Visual Studio) can destroy some structure of Visual Studio or OS unintentionally?
If so, is there any setting of Windows / Visual Studio to prevent it?

C++ source code line that stops execution and starts Visual Studio debugger

Is there a line of source code in C++ that will pause execution and start the debugger? Basically, I'm looking for the Matlab keyboard functionality.
I'm using Visual Studio 2010 and compiling in Debug mode.
I know I can set a breakpoint in the source code editor, insert a desired list of command arguments in the project properties, and use the Debug > Start Debugging (F5) option. But I'd like to be able to run the program from the command line and still get to the Visual Studio debugger.
Use __debugbreak(). It sets a breakpoint in your code (something, that was achieved on x86 using __asm int 3; instruction).
When such breakpoint is encountered in application executed without debugger, you will be prompted to run it. You will see window similar to this one:
Then, you can run new instance of Visual Studio or attach already running one.
EDIT
Oh, one more thing: you can also attach debugger to any running process in your system.
In Visual Studio, click: Debug -> Attach to Process and then select desired process.

Cannot stop the debug

Hi I am using the Microsoft Visual Studio. I started the debugging process by hitting F5. I would want to stop the debug without stopping the application(Visual Studio). Any help is appreciated.
Shift+F5 or Stop Debugging will terminate the process.
Instead you want the Detach All command from the Debug menu.
shift + F5 in keyboard shortcut or click stop debugging button at the top right corner of the visual studio

Visual Studio 2013: native C++ single-step debugging (F10) slow

I am using Visual Studio Premium 2013 Update 2 on a freshly installed (fast) machine with Windows 8.1 Update. Everything is running smoothly, only one thing bugs me:
Problem
When I debug a native C++ project (debug build) by going from line to line with F10 ("step over") it takes 1-2 seconds to go to the next line when I press the F10 key.
What I tried
I looked at several other questions related to slow debugging and made sure that neither of the following is not the reason in my case:
Everything is local (app and all data), no network shares involved
Disabling the Microsoft symbol server did not help
I only have a single breakpoint
Using the menu/toolbar instead of the keyboard does not make any difference
In the default configuration "edit and continue" is enabled, but apparently not for native code:
When I disabled "edit and continue" completely, F10 stepping became much faster (0.5-1 s). The speed is tolerable now. I had to restart Visual Studio after I changed the configuration to this:

VS2010 Access Violation while step the code using F10 or F11

I have a C++ native code that run fine in Debug and Release mode. But there is a little problem, if I debug my program and set a breakpoint in my code visual studio stop on breakpoint then if I press F5 to continue run code run normally but if I press F10 or F11 visual studio catch an AccessViolation and program will be stopped due to the fact that exception is not anywhere in my code and I don't handle it.
This error will not occure in Console application but in MFC application or when I use a .NET EXE to debug my native DLL.
I have a 64 bit Win7 and VS2010 SP1.
Sorry!! I found a solution, you must turn off Tools/Options/Debugging/Native/Enable RPC debugging.
and every thing will go fine. But I don't know if I want to debug RPC calls to external server, what should I do, so if any one help me and find the reason of failure it will be great