'Debugging' visual studio code .natvis based custom view objects - c++

I would like to provide some .natvis file based C++ custom view objects for Visual Studio Code. It is not working as expected out of the box and the definitions used in the .natvis file are not used to display the intended objects during a debugging session. I added the custom .navis file to the launch.json and followed all best practices I could find.
Now I'm at the point where some feedback about the parsed .natvis content would be helpful to find the error. Is it possible to get log outputs or more about these definitions in a Visual Studio Code session to be able to find my error?

Yes it is, but I don't have experience with VS Code, only Visual Studio. But presumably you have Visual Studio installed if you are using natvis? If not then maybe you could download it, to fix your natvis errors.
In Visual Studio go to
Tools/Options/Debugging/Output Window/General Output Settings/Natvis Diagnostic Messages
Set to Error or Verbose
Error messages appear in the output window when you start debugging your program. I found that you get one error message at a time. So if your natvis file has several errors it will take a while to fix them all.

Related

WIN32 Application Solution Error: The Project File Could Not be Loaded. Root Element is Missing

I was going to program a game of Snake using SFML, and after downloading SFML, I tried to create a WIN32 Windows Application, and when I clicked finish in the Wizard, I got the following error:
Unable to read the project file "SFML-Snake2.vcxproj".
C:\Users\arnav_1n7er7u\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props(0,0): The project file could not be loaded.
Root element is missing.
This can be seen in the following screenshot, although it may be unclear:
So to try and solve this problem, I went to the appropriate directory and opened the file Microsoft.Cpp.Win32.user.props in Notepad. After doing so, I found something unusual: The file was full of whitespace, and the exact whitespace content was as follows:
Whitespace
(The word whitespace wasn't written there, I just wrote it for the formatting).
In fact, there were two other files in this directory, and when I looked at them, they were also full of whitespace. I have a feeling that is the problem since it is unlikely Microsoft switched to the Whitespace Programming Language, but I have absolutely no idea what is supposed to be in the file. Could I be pointed in the right direction, to see what the problem is, and how to fix the Visual Studio error message so I can create my project?
UPDATE
Ok, to try and fix the problem, I uninstalled Visual Studio 2015, and instead now downloaded the new Visual Studio 2017. In this, I tried to create another WIN32 Windows Application, and got the exact same error, which can be seen as follows:
This time, I tried to open the file Microsoft.Cpp.Win32.user.props and now found this content (For some reason I cannot copy and paste it):
Now I am really confused. For some reason, now I cannot create WIN32 Applications in Visual Studio, whether it is 2015, or 2017. What should I do?
Yes! I figured out how to solve the problem. After reading this MSDN link, I followed the accepted answers idea to delete the files in the directory v4.0. After doing so, I created a new project, and Visual Studio was able to do so because it generated new files in place of the corrupted ones.

Adding more cpp items in Microsoft Visual C++ 2010 Express

I am using Microsoft Visual C++ 2010 Express and I am having a problem saving more than one cpp item within a solution/project.
When I first create a project I can create a new item, write the code and Debug the program normally. But, when I add a new item into that same project and write the code and try to debug it I get this error:
Unable to start program 'Directory' The system cannot find the file specified.
I checked the directory, the file is there and I can open it but I cannot debug it. I would like someone with experience to help me with this problem. Thank you, I am waiting for answers.
http://i.imgur.com/WD7kGgl.png
The error message is about file Directory.exe. If you don't have that file then there were build errors. See the VC++ Output window for build errors. You have to fix them and then try building again. No exe file is produced if there are any build errors.

Attaching Documentation in Visual Studio (à la Eclipse)

I'm new to Visual Studio (2012) and having come from using Eclipse, I'm finding myself missing the ability to hover my mouse over a method and receive a dialogue detailing the parameters and any accompanying comments.
In this particular example, I'm using the OpenGL SDK with C++ in Visual Studio, and I would like to be able to quickly get at the documentation without having to jump between VS and http://www.opengl.org/sdk/docs/man/.
Is there a way that I can attach the documentation somehow so that I can view it from within Visual Studio itself without needing to manually search?
visual studio does provide the functionality you are looking for as a tooltip (instead of a dialogue) when you hover long enough (2-3 seconds). For this to work correctly and more usefully though, you'd need the functions to be documented properly in the code itself.
Check the following questions for more information on how intellisense tooltip works :
How to get full intellisense tooltip comments working?
Documenting C++/CLI library code for use from c# - best tools and practices?
By default though, intellisense will simply display the comment above the function declaration or deninition (which ever comment is larger, it seems). It takes a while longer when you hover first time over a function, so be patient and retry :)
you can type in the code 3 slash /// and visual studio automaticalli write a xml template for the documentation of the method/class/property.
next you can go in the project properties. Build tab, Output section, XML documentation file, and enter the filename. It will be built on every build of the project.
You could try NDOC or SandCastle if you dont mind using 3rd party tools.

Tried renaming a managed c++ project in Visual Studio, getting resource errors now

I tried renaming a c++ project in Visual Studio and I'm now getting the following errors:
An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in
mscorlib.dll
Additional information: Could not find any resources appropriate for
the specified culture or the neutral culture. Make sure
"OuiDesktop.PreForm.resources" was correctly embedded or linked into
assembly "OuiProject" at compile time, or that all the satellite
assemblies required are loadable and fully signed.
I get this for every each form that uses a resource. If I comment these lines of code out that raise this error, the program launches okay, but I need the resources.
What have i done wrong? Seems renaming a project in Visual Studio is a nightmare!!
These .resources files are being created in the build directory just fine, just not being included in the assembly!
I was using Visual Studio Express 2010 on this machine. Creating a new project and adding the source files back into that in Express didn't work.
I tried this same fix on another machine with full Visual Studio 2010 Professional and it worked perfectly.

VS 2010 intellisense not working for upconverted project

We have a very big C++ solution with several projects for which intellisense works perfectly in Visual Studio 2008, but not at all in Visual Studio 2010 (not even for structs defined in the same file where they are used). I've verified that intellisense does work in VS 2010 for other projects on my machine. I've tried importing one of the problematic projects from a brand-new solution with no success. Re-building the project files from scratch seems promising, but it would require days of work to follow that path, with no guarantee of success at the end. Any alternative suggestions are welcome. The actual error message I get is:
"Intellisense: 'No additional information available'(See 'Troubleshooting IntelliSense in C++ Projects' for further help.)
I've tried that, but there's basically only one suggestion on the MSDN webpage, to make sure "stdafx.h" on the include path, but we're not using precompiled headers and don't include it from anywhere, so I'm pretty sure that's not the problem.
Have you deleted all of the generated database (.ncb and .sdf) files? Corrupted database files is the most likely cause of Visual Studio failing to display IntelliSense.
Intellisense was not included as a component of Visual Studio 2010 for C++/CLI. Unfortunately, it seems they are not going to support it soon either. This is an incredible detriment, as i find myself having to open VS2005 on occasion to simply find an object member.
Here is Microsoft's release on the subject:
http://blogs.msdn.com/b/vcblog/archive/2011/03/03/10136696.aspx