@@ -11,8 +11,11 @@ using namespace std::filesystem;
1111using namespace winrt ;
1212using namespace winmd ::reader;
1313
14- std::vector<std::string> db_files;
15- std::unique_ptr<cache> db_cache;
14+ namespace natvis
15+ {
16+ std::vector<std::string> db_files;
17+ std::unique_ptr<cache> db_cache;
18+ }
1619
1720void MetadataDiagnostic (DkmProcess* process, std::wstring const & status, std::filesystem::path const & path)
1821{
@@ -103,10 +106,10 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie
103106
104107 auto const path_string = winmd_path.string ();
105108
106- if (std::find (db_files.begin (), db_files.end (), path_string) == db_files.end ())
109+ if (std::find (natvis:: db_files.begin (), natvis:: db_files.end (), path_string) == natvis:: db_files.end ())
107110 {
108- db_cache->add_database (path_string, [](TypeDef const & type) { return type.Flags ().WindowsRuntime (); });
109- db_files.push_back (path_string);
111+ natvis:: db_cache->add_database (path_string, [](TypeDef const & type) { return type.Flags ().WindowsRuntime (); });
112+ natvis:: db_files.push_back (path_string);
110113 }
111114 }
112115 auto pos = probe_file.rfind (' .' );
@@ -121,12 +124,12 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie
121124TypeDef FindSimpleType (DkmProcess* process, std::string_view const & typeName)
122125{
123126 XLANG_ASSERT (typeName.find (' <' ) == std::string_view::npos);
124- auto type = db_cache->find (typeName);
127+ auto type = natvis:: db_cache->find (typeName);
125128 if (!type)
126129 {
127130 auto processPath = process->Path ()->Value ();
128131 LoadMetadata (process, processPath, typeName);
129- type = db_cache->find (typeName);
132+ type = natvis:: db_cache->find (typeName);
130133 if (!type)
131134 {
132135 NatvisDiagnostic (process,
@@ -139,13 +142,13 @@ TypeDef FindSimpleType(DkmProcess* process, std::string_view const& typeName)
139142TypeDef FindSimpleType (DkmProcess* process, std::string_view const & typeNamespace, std::string_view const & typeName)
140143{
141144 XLANG_ASSERT (typeName.find (' <' ) == std::string_view::npos);
142- auto type = db_cache->find (typeNamespace, typeName);
145+ auto type = natvis:: db_cache->find (typeNamespace, typeName);
143146 if (!type)
144147 {
145148 std::string fullName (typeNamespace);
146149 fullName.append (" ." );
147150 fullName.append (typeName);
148- FindType (process, fullName);
151+ FindSimpleType (process, fullName);
149152 }
150153 return type;
151154}
@@ -242,10 +245,10 @@ cppwinrt_visualizer::cppwinrt_visualizer()
242245 {
243246 if (std::filesystem::is_regular_file (file))
244247 {
245- db_files.push_back (file.path ().string ());
248+ natvis:: db_files.push_back (file.path ().string ());
246249 }
247250 }
248- db_cache.reset (new cache (db_files, [](TypeDef const & type) { return type.Flags ().WindowsRuntime (); }));
251+ natvis:: db_cache.reset (new cache (natvis:: db_files, [](TypeDef const & type) { return type.Flags ().WindowsRuntime (); }));
249252 }
250253 catch (...)
251254 {
@@ -267,8 +270,8 @@ cppwinrt_visualizer::cppwinrt_visualizer()
267270cppwinrt_visualizer::~cppwinrt_visualizer ()
268271{
269272 ClearTypeResolver ();
270- db_files.clear ();
271- db_cache.reset ();
273+ natvis:: db_files.clear ();
274+ natvis:: db_cache.reset ();
272275}
273276
274277HRESULT cppwinrt_visualizer::EvaluateVisualizedExpression (
0 commit comments