Is there a way to debug code on Visual C++ 2008 Express, such as I can watch a variable for certain value(s) and, when it assumes this value, to break?
For instance, I want to break when xbecomes 5. In gdb I would set a breakpoint then a condition that x == 5. How can I do it (if possible) on Visual C++ 2008 Express?
Although built in support for it is missing in the express editions, there is another way around it.
I found this on another answer for a similar question.
#if DEBUG
if( node.Name == "Book" )
System.Diagnostics.Debugger.Break();
#endif
The example shows that if the Name property matches "Book", a breakpoint occurs.
Here is the original question:
How Do I: Create a Breakpoint Using Conditions? [C# Express]
This is not possible in the Express versions of Visual Studio. But it is possible in the full versions.
It seems it's possible to do this even in express, at least here it worked. After marking the breakpoint, I right-clicked on its mark, and set a "Condition" (it couldn't be easier than that)
!Setting a condition
Then you can write an expression which evaluates to true. My colleague who has just showed this to me said they have some issues using this for comparing strings, but it's pretty neat for simple comparisons using ints.
!Condition window
However, as said in the other answer, this is not so fast as typing the break code directly.
Lucky! Visual Studio 2010 Express of C/C++ does support it. See How to: Specify a Breakpoint Condition.
I've tried it.
Related
Autocomplete and intellisense is TERRIBLE for visual studio for mac. It will literally autocomplete random objects in the middle of strings and will not work at all when in the middle of a function that doesn't have a valid return value yet (in for or let statements). I had to turn it off because it's way worse than being useless. Anyone have any tips on how to fix this or should I change IDE's? Or is this a problem unique to myself. For reference I am in a script file.
I would highly recommend Visual Studio Code with Ionide extension installed.
This is a new one for me. I have been asked, for legal reasons, to setup a laptop with Visual Studio, but to disable the ability to compile projects/solutions. The purpose is to enable browsing of the source code, but not allow building or executing it.
Yes, I know this is really a stupid question and unfortunately I can't get into too many details. I've asked about using alternative text editors, but I have been told no. So until I can prove it isn't possible (or that I have at least made a reasonable effort), I have to try and make this work. Notepad++ would be an excellent alternative, but that has been rejected.
This would be in Visual Studio 2010 or later. Is there any way that I can do this?
UPDATE
After trying Marius Bancila's suggestion of removing the compilers and MSBuild, I was surprised to find out that VS continued to work fine (except for building, of course). I did not expect that functionality like F12 (Go To Definition) would continue to work.
This may mean that there still remains the ability to build something somewhere somehow. But as it stands with MSBuild permanently deleted and the Visual Studio Build command not working, it'll take some effort to get around it (if a way in fact does exist).
You didn't say what projects should not be possible to build (VC++, VC#, VB.NET, F#, etc.). Starting with VS2010 they are all built using MSBuild. So if you delete MSBuild they will not be able to build from inside Visual Studio. However, one can still be able to build from the command line, so the only possibility I see is that you delete all the compilers that come with Visual Studio.
It's a little bit crazy, but if you really have to ...
Try deleting some important binaries after installing Visual Studio e.g. linker (link.exe) and compiler (cl.exe).
Use a text editor instead. Notepad++ even comes with color syntax highlighting.
You cannot prevent people from compiling the code. Visual Studio Express is available to anyone, and the compiler can be executed from the command line, without Visual Studio's help.
Today my Visual studio couldn't help me by auto complete so I thought that the ReSharper trial period had ended .After I suspended ReSharper I see that still no auto complete. After a few changes I see still the same problem and there are some strange behavior in Visual Studio. For example I see m_value field for int. But my other Visual studio instances works as expected. How can I fix this problem?
Probably there is an error somewhere in your code which is causing the types to be determined incorrectly - for example a missing curly brace. Check your code carefully for errors. Make sure that your code compiles correctly.
PS: You don't need ReSharper to get autocompletion. Intellisense is a standard feature of Visual Studio. Even without ReSharper I find the built-in autocompletion extremely usable.
IntelliSense is Microsoft's implementation of autocompletion, best known for its use in the Microsoft Visual Studio integrated development environment.
The file property build action was content and this was reason of those strange behaviours. It is fixed after turned build action to compile.
In Visual Studio 2010 sometimes when I want to get the value of a variable while debugging, it tells me that it "does not exist in this context" when it obviously does.
I have found that if I use the variable, as in the screenshot below, then it is able to show it.
Has anyone experienced this? Visual Studio 2008 never did this.
How can I get Visual Studio 2010 to always show me variable values while debugging?
alt text http://www.deviantsart.com/upload/jcnr1s.png
Hazarding a guess..
Could it be that your running in Release mode and the variable has been optimized out? Once you actually use the value, then it no longer can optimize the value out?
Is GetListOfFileNames() deferring execution? Try tacking .ToList() on it.
I am working on a C# windows based project in visual studio 2005.I often debug different features in this huge project.Now the problem is i have made few break points in few places which i require only when i debug for that feature.i want other break points to be disabled then.I understand this might not be a use case for larger community.
What i want to know is,is there any way to group break points in VS 2005 ,so that i can enable disable them when i debug that particular feature?
There's not a feature built into Visual Studio, however something I came across a while back is a clever use of macros to give some grouping functionality.
Check out this blog entry by Jim Gries showing how to do it.
Just a note, I now it doesn't help your current situation, but the situation has been improved in VS 2010.
you can check this reference:
a VS 2010 Debugger Improvements (BreakPoints, DataTips, Import/Export)
This solution works only in Visual Studio 2010 and above