vscode natvis using launch configuration - debugging

I am trying to debug a ROS2 node which uses Eigen matrices. I followed https://gist.github.com/JADC362/a4425c2d05cdaadaaa71b697b674425f.
However, to visualize Eigen matrices, I encountered natvis files. I never worked with them but I found a natvis file for the Eigen Library (https://github.com/cdcseacave/Visual-Studio-Visualizers/blob/master/Eigen.natvis)
My question now is how do I incorporate it in the launch file via
{
"name": "C++ Debugger",
"request": "launch",
"type": "cppdbg",
"miDebuggerServerAddress": "localhost:3000",
"cwd": "/",
"program": "[build-path-executable]"
"visualizerFile": "${workspaceFolder}/Visual-Studio-Visualizers/Eigen.natvis",
}
But I can't really see any changes during debugging. I hoped t be able to examine the matrices now....
Any ideas?
Max

Related

Visual Studio Code / C++ : Intellisense not showing quick info with method documentation (signature help)

I recently installed VSCode for my C++ projects. That's a great tool, very light, easy to use and no trouble to install C++ dedicated extensions. But I've realized after checking some videos/documentation about VSCode, IntelliSense is not fully working in my environment. So far, most IntelliSense features I've used work well...except Quick Info feature to show accompanying documentation for a method (signature help). As I can see from C++ tutorials/videos using VSCode, I should have a Quick Info blue icon when writing a method that expands to the side parameter info.
In my case there is no Quick Info blue icon, there is just the parameters name or short info. Im figuring out since several days why my VSCode is not able to provide the Signature help feature. I also tried with C#, but I get same behavior...
So Im heading to the StackOverflow community to get help. I've seen so many things about VScode on the Web but nothing concerning my issue.
My configuration:
MacBookPro - MacOS Catalina V10.15.4 (OS: Darwin x64 19.4.0)
VSCode Version: 1.45.1
C++ Microsoft (ms-vscode.cpptools) extension
C++ Intellisense (austin.code-gnu-global) extension
UserSettings:
"editor.detectIndentation": false,
"editor.multiCursorModifier": "alt",
"workbench.iconTheme": "vscode-icons",
"workbench.view.alwaysShowHeaderActions": true,
"C_Cpp.updateChannel": "Insiders",
"editor.insertSpaces": false,
"editor.minimap.maxColumn": 100,
"editor.minimap.size": "fill",
"editor.tabSize": 4,
"task.saveBeforeRun": "never",
"window.closeWhenEmpty": true,
"workbench.colorTheme": "Default Light+",
"workbench.editor.closeEmptyGroups": false,
"workbench.editor.showTabs": true,
"workbench.settings.editor": "json",
"workbench.settings.openDefaultSettings": true,
"workbench.settings.useSplitJSON": true
Example with pictures:
My working Environment without quick info blue icon
C++ example with quick info blue icon
(source : https://www.youtube.com/watch?v=3Tc6f3nhCxo)
Thank you in advance for your help!
For more details, here are some c++ IntelliSense Settings
> "C_Cpp.autocomplete": "Default",
"C_Cpp.default.intelliSenseMode": "",
"C_Cpp.intelliSenseCachePath": "",
"C_Cpp.intelliSenseEngine": "Default",
"C_Cpp.intelliSenseEngineFallback": "Disabled"
Faced the same problem getting VS Code C++ IntelliSense Quick Info to work on Mac M1 (arm64) without having to install Xcode for personal reasons (large and not needed).
Simply using the gcc provided by homebrew did the trick.
Make sure to install Homebrew first if not installed
Then install gcc
brew install gcc
Open your c_cpp_properties.json file in .vscode directory and replace the compilerPath value with the one from homebrew.
"compilerPath": "/opt/homebrew/Cellar/gcc/11.2.0/bin/g++-11"
In my case this is gcc-11 with version 11.2.0. Yours may be different so confirm from the brew install gcc output or confirm manually.
(This solution should work for MacOS and isn't limited to just the M1.)
I finally solved my Intellisense issue on my VS code configuration!
Now "Quick Info" feature is shown when I start typing functions, methods or whatever.
It has been fixed after installing xcode macOS application and updating gcc version by Homebrew (see attached pictures).
gcc version 10.2.0 on Homebrew
my cpp configuration (c_cpp_properties.json)
Hope it may help other people that have same Intellisense issue to show accompanying documentation for a method (signature help).

The library 'hostpolicy.dll' was not found

In my ASP.NET WebAPI (not Core!) project, I would like to use the SDK-based csproj format. I converted the project and got it to build:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<OutputType>Library</OutputType>
</PropertyGroup>
Now when I run it using IIS Express, I get:
Waiting for the IIS Express worker process to start…
Worker process has been started: 22108
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Code\MyWebApp\MyWebApp\bin\Debug\net461\'.
Failed to run as a self-contained app. If this should be a framework-dependent app, add the C:\Code\MyWebApp\MyWebApp\bin\Debug\net461\MyWebApp.runtimeconfig.json file specifying the appropriate framework.
I've seen this answer to a similar question that suggests adding a .runtime.config file but I believe it is only required for .NET Core apps.
I don't want to migrate to .NET Core at this point. All I wanted was to use the new project format to get rid of some nasty binding redirects. I.e. I only wanted to change my build tooling and leave everything as is at run time.
My launchsettings.json:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59119",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true
}
}
}
These are the changes I made: Pull request
The ASP.NET team have responded:
This is not possible, sdk-based projects are not suited for traditional aspnet/webapi projects and it is likely you'll see a long trail of issues if you try to use them.
I was so close to getting it to work!

SFML for MinGW VS code

I am attempting to use SFML for my next project, however I have yet to find reliable information on how to install SFML for MinGW, the page on the main SFML website is for using code::blocks, and I would prefer to keep using VS Code if I could. Additionally all of the tutorials for visual studio are for older versions where the UI is much different. I was hoping that someone who has installed it could guide me through the steps they used to install it. Thanks.
I am on Windows.
Just to be clear, I have never used Visual Studio Code, but it supports Nuget Package Manager, so it should work the same as in the 'normal' Visual Studio. So after creating new project:
Your should be getting/installing Nuget Package Manager from here.
Then according to answers to this question, you should be able to Press Ctrl+P or Ctrl+Shift+P and search for SFML packages, and choose version 2.5.1.
There are five modules: Audio, Graphics, Network, System and Window, choose what you need or install all five.
As I said at the begining, I do not have a way to test it, but it should work.
This question is fairly old at this point but for anyone in the future wondering how I solved it, I ended up switching compilers to Clang and creating a .bat file the just runs clang++ and links the SFML lib directory. (SFML GCC-64 worked fine with Clang)
To fix any errors in VS Code, you can add SFML to the workspace config
in .vscode/c_cpp_properties.json:
add or edit a field called "configurations" (should be an array), and add the following:
"configurations": [
{
"name": "SFML",
"intelliSenseMode": "clang-x64",
"includePath": ["${defaultInclude}", "C:/libs/SFML/GCC-64-Bit/SFML-2.5.1/include"],
"compilerPath": "C:/msys64/mingw64/bin/clang++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"browse": {
"path": ["${workspaceFolder}"],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
]
You'll have to change some of the paths to fit your setup, and you could very well put this in your global C++ configuration.
Finally, make sure that the needed DLLs are copied to your compilation output directory

Using docfx.console fails to generate documentation

I installed docfx.console through the nuget package manager (visual studios 2017 15.7.3) into a test project. My project is a .net library with a singular class with a bit of xml documentation. When I build the project it creates a _site file with a .html file but no documentation. It also generates an api, apidoc and articles folder and a docfx.json file.
The project throws the warning: Unable to find either toc.yml or toc.md inside obj/api/. Make sure the file is included in config file docfx.json!
I found a few similar issues in github which advised setting my visual studio version to 2015, however this solution doesn't appear to work with docfx.console as far as I can tell. Does anyone know how I might be able to correct this issue? Thank you
I also stumbled upon this issue when I was documenting an existing VB.net solution. Without knowing what your docfx.json file looks like or whether your .NET library is written in C# or VB.net, I can only provide a answer that fixed my issue and maybe will help with yours.
For me when installing docfx via nuget, the docfx.json file is set to be used with C# projects and not VB.Net projects by default.
I easily fixed this by modifying the docfx.json file and changing the metadata file source extension to search for *.vbproj:
"metadata": [
{
"src": [
{
"files": [
"*.vbproj"
],
"cwd": ".",
"exclude": [
"**/obj/**",
"**/bin/**",
"_site/**"
]
}
],
"dest": "obj/api"
}],

Target different Javascript versions with TypeScript

TypeScript can globally target different versions of Javascript - you can switch between transpiling ES3, ES5 or ES6.
We have to support IE, so ES3 is our lowest common denominator.
However, good browsers (like Chrome) already support ES6, and will be able to run the significantly smaller ES6 code with optimisations.
So, from the same TypeScript source I want to serve ES3 to IE and ES6 to Chrome.
Is there a way to make TypeScript transpile multiple JS files (maybe as *.es3 and *.es6 or something like that) so we can pick which version to serve? (Ideally in VS 2015)
Alternatively in C# can I access the TypeScript transpiler to complete the step at run time?
You can actually specify which version you want to transpile to using the command line (--target ES3).
You can also specify an output directory, so that you can output both ES6 and ES3 transpiled code, and then chose which to reference on the fly (using old style IE ifs).
How about using different tsconfig.json files?
For example, something like:
- root
- ts-source
- js-es3
- tsconfig.json
- js
- js-es5
- tsconfig.json
- js
Then the root/js-es3/tsconfig.json:
{
"compilerOptions": {
"target": "ES3",
"outDir": "js",
"rootDir": "../ts-srouce"
}
}
And the root/js-es5/tsconfig.json:
{
"compilerOptions": {
"target": "ES5",
"outDir": "js",
"rootDir": "../ts-srouce"
}
}
I'm not a visual studio user so I don't know how to support different tsconfig.json files there, but even if you can't, then you can compile it using tsc.

Resources