Standalone and Component Visualizers/VSIXes (#823)

* Revert "Remove visualizer from vsix (#792)"

This reverts commit d4635e3bb5.

* Reenabled standalone visualizer and forked component visualizer for VS installer integration

* build component and standalone visualizers
This commit is contained in:
Scott Jones 2020-12-14 21:02:28 -08:00 коммит произвёл GitHub
Родитель a1db3fcebb
Коммит 329b104182
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 96 добавлений и 35 удалений

Просмотреть файл

@ -22,7 +22,8 @@ if "%target_platform%"=="arm64" goto :eof
call msbuild /m /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:cppwinrt
_build\%target_platform%\%target_configuration%\cppwinrt.exe -in local -out _build\%target_platform%\%target_configuration% -verbose
call msbuild /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% natvis\cppwinrtvisualizer.sln
call msbuild /p:Configuration=%target_configuration%,Platform=%target_platform%,Deployment=Component;CppWinRTBuildVersion=%target_version% natvis\cppwinrtvisualizer.sln
call msbuild /p:Configuration=%target_configuration%,Platform=%target_platform%,Deployment=Standalone;CppWinRTBuildVersion=%target_version% natvis\cppwinrtvisualizer.sln
call msbuild /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% test\nuget\NugetTest.sln
call msbuild /m /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:test\test

Просмотреть файл

@ -3,14 +3,17 @@
set this_dir=%~dp0
set target_configuration=%1
set target_version=%2
set target_deployment=%3
if "%target_configuration%"=="" set target_configuration=Release
if "%target_version%"=="" set target_version=1.2.3.4
if "%target_deployment%"=="" set target_deployment=Standalone
if not exist ".\.nuget" mkdir ".\.nuget"
if not exist ".\.nuget\nuget.exe" powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile .\.nuget\nuget.exe"
call .nuget\nuget.exe restore cppwinrt.sln"
call .nuget\nuget.exe restore natvis\cppwinrtvisualizer.sln
call .nuget\nuget.exe restore test\nuget\NugetTest.sln
rem Build fast forwarder libs or all arches
@ -22,8 +25,12 @@ call msbuild /m /p:Configuration=%target_configuration%,Platform=arm64,CppWinRTB
rem Build cppwinrt.exe for x86 only
call msbuild /m /p:Configuration=%target_configuration%,Platform=x86,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:cppwinrt
rem Build cppwinrt visualizer dll for x86 and x64
call msbuild /p:Configuration=%target_configuration%,Platform=x64,Deployment=%target_deployment%,CppWinRTBuildVersion=%target_version% natvis\cppwinrtvisualizer.sln
call msbuild /p:Configuration=%target_configuration%,Platform=x86,Deployment=%target_deployment%,CppWinRTBuildVersion=%target_version% natvis\cppwinrtvisualizer.sln
rem Build nuget
.nuget\nuget.exe pack nuget\Microsoft.Windows.CppWinRT.nuspec -NonInteractive -OutputDirectory %this_dir%_build -Properties Configuration=%target_configuration%;cppwinrt_exe=%this_dir%_build\x86\%target_configuration%\cppwinrt.exe;cppwinrt_fast_fwd_x86=%this_dir%_build\x86\%target_configuration%\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%this_dir%_build\x64\%target_configuration%\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm=%this_dir%_build\arm\%target_configuration%\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%this_dir%_build\arm64\%target_configuration%\cppwinrt_fast_forwarder.lib -version %target_version% -Verbosity Detailed
rem Build vsix
call msbuild /p:Configuration=%target_configuration%,Platform=x86,CppWinRTVersion=%target_version%,NupkgDir=%this_dir%_build vsix\vsix.sln
call msbuild /p:Configuration=%target_configuration%,Platform=x86,Deployment=%target_deployment%,CppWinRTVersion=%target_version%,NatvisDirx86=%this_dir%natvis\x86\%target_configuration%\%target_deployment%,NatvisDirx64=%this_dir%natvis\x64\%target_configuration%\%target_deployment%,NupkgDir=%this_dir%_build vsix\vsix.sln

Просмотреть файл

@ -77,23 +77,23 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>x86\$(Configuration)\</OutDir>
<IntDir>x86\$(Configuration)\</IntDir>
<OutDir>x86\$(Configuration)\$(Deployment)\</OutDir>
<IntDir>x86\$(Configuration)\$(Deployment)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>x64\$(Configuration)\</OutDir>
<IntDir>x64\$(Configuration)\</IntDir>
<OutDir>x64\$(Configuration)\$(Deployment)\</OutDir>
<IntDir>x64\$(Configuration)\$(Deployment)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>x86\$(Configuration)\</OutDir>
<IntDir>x86\$(Configuration)\</IntDir>
<OutDir>x86\$(Configuration)\$(Deployment)\</OutDir>
<IntDir>x86\$(Configuration)\$(Deployment)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>x64\$(Configuration)\</OutDir>
<IntDir>x64\$(Configuration)\</IntDir>
<OutDir>x64\$(Configuration)\$(Deployment)\</OutDir>
<IntDir>x64\$(Configuration)\$(Deployment)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -204,6 +204,11 @@
<DelayLoadDLLs>vsdebugeng.dll</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Deployment)'=='Component'">
<ClCompile>
<AdditionalOptions>%(AdditionalOptions) /DCOMPONENT_DEPLOYMENT</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="object_visualizer.h" />
<ClInclude Include="cppwinrt_visualizer.h" />

Просмотреть файл

@ -211,9 +211,14 @@ static HRESULT ObjectToString(
_In_ DkmVisualizedExpression* pExpression,
_In_ DkmPointerValueHome* pObject,
bool isAbiObject,
_Out_ com_ptr<DkmString>& pValue
_Out_ com_ptr<DkmString>& pValue,
bool* unavailable = nullptr
)
{
if (unavailable)
{
*unavailable = false;
}
if (SUCCEEDED(EvaluatePropertyString({ IID_IStringable, 0, PropertyCategory::String }, pExpression, pObject, isAbiObject, pValue)))
{
if (pValue && pValue->Length() > 0)
@ -232,6 +237,10 @@ static HRESULT ObjectToString(
// VirtualQuery validation failed (as determined by no runtime class name) or an
// exception escaped WINRT_abi_val (e.g, bad pointer, which we try to avoid via VirtualQuery)
if (unavailable)
{
*unavailable = true;
}
return DkmString::Create(L"<Object uninitialized or information unavailable>", pValue.put());
}
@ -534,18 +543,55 @@ HRESULT object_visualizer::CreateEvaluationResult(_In_ DkmVisualizedExpression*
return S_OK;
}
#ifdef COMPONENT_DEPLOYMENT
static std::set<UINT64> g_refresh_cache;
bool requires_refresh(UINT64 address, DkmEvaluationFlags_t evalFlags)
{
auto refreshed = g_refresh_cache.find(address) != g_refresh_cache.end();
return !refreshed && ((evalFlags & DkmEvaluationFlags::EnableExtendedSideEffects) != DkmEvaluationFlags::EnableExtendedSideEffects);
}
void cache_refresh(UINT64 address)
{
g_refresh_cache.insert(address);
}
#else
bool requires_refresh(UINT64, DkmEvaluationFlags_t)
{
return false;
}
void cache_refresh(UINT64)
{
}
#endif
HRESULT object_visualizer::CreateEvaluationResult(_Deref_out_ DkmEvaluationResult** ppResultObject)
{
com_ptr<DkmRootVisualizedExpression> pRootVisualizedExpression = m_pVisualizedExpression.as<DkmRootVisualizedExpression>();
auto valueHome = make_com_ptr(m_pVisualizedExpression->ValueHome());
com_ptr<DkmPointerValueHome> pPointerValueHome = valueHome.as<DkmPointerValueHome>();
auto address = pPointerValueHome->Address();
com_ptr<DkmString> pValue;
IF_FAIL_RET(ObjectToString(m_pVisualizedExpression.get(), pPointerValueHome.get(), m_isAbiObject, pValue));
DkmEvaluationResultFlags_t evalResultFlags = DkmEvaluationResultFlags::ReadOnly;
if (requires_refresh(address, m_pVisualizedExpression->InspectionContext()->EvaluationFlags()))
{
IF_FAIL_RET(DkmString::Create(L"<Refresh to view properties>", pValue.put()));
evalResultFlags |= DkmEvaluationResultFlags::EnableExtendedSideEffectsUponRefresh | DkmEvaluationResultFlags::CanEvaluateNow;
}
else
{
cache_refresh(address);
bool unavailable;
IF_FAIL_RET(ObjectToString(m_pVisualizedExpression.get(), pPointerValueHome.get(), m_isAbiObject, pValue, &unavailable));
if (!unavailable)
{
evalResultFlags |= DkmEvaluationResultFlags::Expandable;
}
}
com_ptr<DkmDataAddress> pAddress;
IF_FAIL_RET(DkmDataAddress::Create(m_pVisualizedExpression->StackFrame()->RuntimeInstance(), pPointerValueHome->Address(), nullptr, pAddress.put()));
IF_FAIL_RET(DkmDataAddress::Create(m_pVisualizedExpression->StackFrame()->RuntimeInstance(), address, nullptr, pAddress.put()));
com_ptr<DkmSuccessEvaluationResult> pSuccessEvaluationResult;
IF_FAIL_RET(DkmSuccessEvaluationResult::Create(
@ -553,7 +599,7 @@ HRESULT object_visualizer::CreateEvaluationResult(_Deref_out_ DkmEvaluationResul
m_pVisualizedExpression->StackFrame(),
pRootVisualizedExpression->Name(),
pRootVisualizedExpression->FullName(),
DkmEvaluationResultFlags::Expandable | DkmEvaluationResultFlags::ReadOnly,
evalResultFlags,
pValue.get(),
pValue.get(),
pRootVisualizedExpression->Type(),

Двоичные данные
vsix/UpgradeLog.htm

Двоичный файл не отображается.

Просмотреть файл

@ -22,6 +22,8 @@
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="NativeVisualizer" Path="cppwinrt.natvis" />
<Asset Type="DebuggerEngineExtension" Path="CppWinrtVisualizer.vsdconfig" />
<Asset Type="Microsoft.VisualStudio.ItemTemplate" Path="ItemTemplates" />
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
<Asset Type="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" Source="File" Path="Microsoft.Windows.CppWinRT.|%CurrentProject%;GetCppWinRTVersion|.nupkg" VsixSubPath="Packages" />

Просмотреть файл

@ -9,7 +9,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<OutputPath>bin\x86\Debug\$(Deployment)\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
@ -17,7 +17,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<OutputPath>bin\x86\Release\$(Deployment)\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
@ -46,24 +46,6 @@
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\$(Deployment)\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CopyVsixExtensionFiles>False</CopyVsixExtensionFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\$(Deployment)\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Content Include="LICENSE">
<IncludeInVSIX>true</IncludeInVSIX>
@ -108,6 +90,22 @@
<Link>Packages\Microsoft.Windows.CppWinRT.$(CppWinRTVersion).nupkg</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\natvis\cppwinrt.natvis">
<Link>%(Filename)%(Extension)</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="$(NatvisDirx86)\cppwinrtvisualizer.vsdconfig">
<Link>%(Filename)%(Extension)</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="$(NatvisDirx86)\cppwinrtvisualizer.dll">
<Link>x86\%(Filename)%(Extension)</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="$(NatvisDirx64)\cppwinrtvisualizer.dll">
<Link>x64\%(Filename)%(Extension)</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
@ -139,6 +137,8 @@
<Target Name="GetCppWinRTVersion" Outputs="$(CppWinRTVersion)" />
<Target Name="PrepareBuild" BeforeTargets="PrepareForBuild">
<Error Condition="'$(CppWinRTVersion)' == ''" Text="The project must be supplied with a CppWinRTVersion property value" />
<Error Condition="'$(NatvisDirx86)' == ''" Text="The project must be supplied with a NatvisDirx86 property value" />
<Error Condition="'$(NatvisDirx64)' == ''" Text="The project must be supplied with a NatvisDirx64 property value" />
<Error Condition="'$(NupkgDir)' == ''" Text="The project must be supplied with a NupkgDir property value" />
<Copy SourceFiles="..\LICENSE" DestinationFolder="$(MSBuildProjectDirectory)" />
<ItemGroup>