@@ -15,6 +15,34 @@ namespace
1515{
1616 std::vector<std::string> db_files;
1717 std::unique_ptr<cache> db_cache;
18+ coded_index<TypeDefOrRef> guid_TypeRef{};
19+ }
20+
21+ coded_index<TypeDefOrRef> FindGuidType ()
22+ {
23+ if (!guid_TypeRef)
24+ {
25+ // There is no definitive TypeDef for System.Guid. But there are a variety of TypeRefs scattered about
26+ // This one should be relatively quick to find
27+ auto pv = db_cache->find (" Windows.Foundation" , " PropertyValue" );
28+ for (auto && method : pv.MethodList ())
29+ {
30+ if (method.Name () == " CreateGuid" )
31+ {
32+ auto const & sig = method.Signature ();
33+ auto const & params = sig.Params ();
34+ if (params.first != params.second )
35+ {
36+ auto const & type = params.first ->Type ().Type ();
37+ if (std::holds_alternative<coded_index<TypeDefOrRef>>(type))
38+ {
39+ guid_TypeRef = std::get<coded_index<TypeDefOrRef>>(type);
40+ }
41+ }
42+ }
43+ }
44+ }
45+ return guid_TypeRef;
1846}
1947
2048void MetadataDiagnostic (DkmProcess* process, std::wstring const & status, std::filesystem::path const & path)
@@ -194,6 +222,11 @@ TypeSig ResolveGenericTypePart(DkmProcess* process, iter& it, sent const& end)
194222 {
195223 return TypeSig{ basic_type_pos->second };
196224 }
225+
226+ if (partName == " Guid" )
227+ {
228+ return TypeSig{ FindGuidType () };
229+ }
197230
198231 TypeDef type = FindSimpleType (process, partName);
199232 auto tickPos = partName.rfind (' `' );
@@ -271,6 +304,7 @@ cppwinrt_visualizer::cppwinrt_visualizer()
271304cppwinrt_visualizer::~cppwinrt_visualizer ()
272305{
273306 ClearTypeResolver ();
307+ guid_TypeRef = {};
274308 db_files.clear ();
275309 db_cache.reset ();
276310}
0 commit comments