Skip to content

<hash_set>: Natvis errors while debugging #2783

@fsb4000

Description

@fsb4000

Describe the bug
When I was fixing other visualizer issue I found that debugger can't visualize stdext::hash_*

#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include <hash_set>
#include <hash_map>
using namespace std;
int main() {
	stdext::hash_set<int> hs = { 1,2,3 };
	stdext::hash_multiset<int> hms = { 1,1,2,3 };
	stdext::hash_map<int, char> hm = { {1, 'a'}, {2,'b'} };
	stdext::hash_multimap<int , char> hmm = { {1, 'a'}, {1, 'c'}, {2,'b'} };
}

It still looks usable:
изображение

Natvis log:

Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1459,65): Error: class "stdext::_Hmap_traits<int,char,stdext::hash_compare<int,std::less<int> >,std::allocator<std::pair<int const ,char> >,0>" has no member "_Mypair"
    Error while evaluating '_Traitsobj._Mypair._Myval2._Myval2' in the context of type 'TestCpp.exe!stdext::hash_map<int,char,stdext::hash_compare<int,std::less<int>>,std::allocator<std::pair<int const ,char>>>'.
Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1447,4): Ignoring visualizer for type 'stdext::hash_map<int,char,stdext::hash_compare<int,std::less<int> >,std::allocator<std::pair<int const ,char> > >' labeled as 'stdext::hash_map<*>' because one or more sub-expressions was invalid.

Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1459,65): Error: class "stdext::_Hmap_traits<int,char,stdext::hash_compare<int,std::less<int> >,std::allocator<std::pair<int const ,char> >,1>" has no member "_Mypair"
    Error while evaluating '_Traitsobj._Mypair._Myval2._Myval2' in the context of type 'TestCpp.exe!stdext::hash_multimap<int,char,stdext::hash_compare<int,std::less<int>>,std::allocator<std::pair<int const ,char>>>'.
Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1447,4): Ignoring visualizer for type 'stdext::hash_multimap<int,char,stdext::hash_compare<int,std::less<int> >,std::allocator<std::pair<int const ,char> > >' labeled as 'stdext::hash_multimap<*>' because one or more sub-expressions was invalid.

Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1459,65): Error: class "stdext::_Hset_traits<int,stdext::hash_compare<int,std::less<int> >,std::allocator<int>,1>" has no member "_Mypair"
    Error while evaluating '_Traitsobj._Mypair._Myval2._Myval2' in the context of type 'TestCpp.exe!stdext::hash_multiset<int,stdext::hash_compare<int,std::less<int>>,std::allocator<int>>'.
Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1447,4): Ignoring visualizer for type 'stdext::hash_multiset<int,stdext::hash_compare<int,std::less<int> >,std::allocator<int> >' labeled as 'stdext::hash_multiset<*>' because one or more sub-expressions was invalid.


Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1459,65): Error: class "stdext::_Hset_traits<int,stdext::hash_compare<int,std::less<int> >,std::allocator<int>,0>" has no member "_Mypair"
    Error while evaluating '_Traitsobj._Mypair._Myval2._Myval2' in the context of type 'TestCpp.exe!stdext::hash_set<int,stdext::hash_compare<int,std::less<int>>,std::allocator<int>>'.
Natvis: C:\Dev\STL\stl\debugger\STL.natvis(1447,4): Ignoring visualizer for type 'stdext::hash_set<int,stdext::hash_compare<int,std::less<int> >,std::allocator<int> >' labeled as 'stdext::hash_set<*>' because one or more sub-expressions was invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedSomething works now, yay!visualizerHow the VS debugger displays STL types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions