Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings in natvis project #1463

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions natvis/cppwinrt_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace winrt;
using namespace winmd::reader;

std::vector<std::string> db_files;
std::unique_ptr<cache> db;
std::unique_ptr<cache> db_cache;

void MetadataDiagnostic(DkmProcess* process, std::wstring const& status, std::filesystem::path const& path)
{
Expand Down Expand Up @@ -105,7 +105,7 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie

if (std::find(db_files.begin(), db_files.end(), path_string) == db_files.end())
{
db->add_database(path_string, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); });
db_cache->add_database(path_string, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); });
db_files.push_back(path_string);
}
}
Expand All @@ -120,12 +120,12 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie

TypeDef FindType(DkmProcess* process, std::string_view const& typeName)
{
auto type = db->find(typeName);
auto type = db_cache->find(typeName);
if (!type)
{
auto processPath = process->Path()->Value();
LoadMetadata(process, processPath, typeName);
type = db->find(typeName);
type = db_cache->find(typeName);
if (!type)
{
NatvisDiagnostic(process,
Expand All @@ -137,7 +137,7 @@ TypeDef FindType(DkmProcess* process, std::string_view const& typeName)

TypeDef FindType(DkmProcess* process, std::string_view const& typeNamespace, std::string_view const& typeName)
{
auto type = db->find(typeNamespace, typeName);
auto type = db_cache->find(typeNamespace, typeName);
if (!type)
{
std::string fullName(typeNamespace);
Expand Down Expand Up @@ -165,7 +165,7 @@ cppwinrt_visualizer::cppwinrt_visualizer()
db_files.push_back(file.path().string());
}
}
db.reset(new cache(db_files, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); }));
db_cache.reset(new cache(db_files, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); }));
}
catch (...)
{
Expand All @@ -188,7 +188,7 @@ cppwinrt_visualizer::~cppwinrt_visualizer()
{
ClearTypeResolver();
db_files.clear();
db.reset();
db_cache.reset();
}

HRESULT cppwinrt_visualizer::EvaluateVisualizedExpression(
Expand Down
2 changes: 1 addition & 1 deletion natvis/object_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ HRESULT object_visualizer::GetItems(

auto pParent = pVisualizedExpression;
auto childCount = std::min(m_propertyData.size() - StartIndex, (size_t)Count);
for(auto i = 0; i < childCount; ++i)
for(size_t i = 0; i < childCount; ++i)
{
auto& prop = m_propertyData[i + (size_t)StartIndex];
com_ptr<DkmChildVisualizedExpression> pPropertyVisualized;
Expand Down
3 changes: 3 additions & 0 deletions natvis/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#define NOMINMAX

#include <windows.h>
#pragma warning(push)
#pragma warning(disable : 4471)
#include <vsdebugeng.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to pull a newer version of this nuget package? I tried specifying the latest but couldn't nuget pull after that.

Copy link
Member Author

@DefaultRyan DefaultRyan Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried before, and there's been some weirdness. But I've been making some visualizer improvements and hope to do some updating as part of that work! For now, though, I'm a big fan of keeping PRs tightly scoped when possible. :) My main goal here is to eliminate the warning spew that's currently happening in the repo so we can get everything resolved and prevent "warning creep" going forward.

#pragma warning(pop)
#include <vsdebugeng.templates.h>
#include <Dia2.h>
#include "base_includes.h"
Expand Down