Add IsPackagedProcess and IsSelfContained to common insights PartB fields#6233
Add IsPackagedProcess and IsSelfContained to common insights PartB fields#6233
Conversation
|
@DrusTheAxe what do you think of this? Getting some signal on selfcontained vs fwp dependent, and packages vs unpackaged is something we've wanted for a while. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
|
|
||
| // Reimplemented here (not using AppModel::Identity / WindowsAppRuntime::SelfContained) | ||
| // to avoid header dependencies — PartB fires during bootstrap before DLL load. |
There was a problem hiding this comment.
-1
Dupe code is a bad idea. Add the needed #include's and learn to love the bomb :-)
|
|
||
| #define _GENERIC_PARTB_FIELDS_ENABLED \ | ||
| TraceLoggingStruct(4, "COMMON_WINDOWSAPPSDK_PARAMS"), \ | ||
| TraceLoggingStruct(6, "COMMON_WINDOWSAPPSDK_PARAMS"), \ |
There was a problem hiding this comment.
This adds the data to every TraceLoggingWrite event. That seems heavy handed.
Better to replace the IsDebuggerPresent boolean with a Flags UINT32 bitfield
TraceLoggingUInt32(::Microsoft::WindowsAppRuntine::Insights::RuntimeInformation::TraceLoggingInformationFlags(), "Flags") \
and add
enum class TraceLoggingInformationFlags
{
None = 0,
IsDebuggerPresent = 0x00000001,
IsPackagedProcess = 0x00000002,
IsSelfContained = 0x00000004,
};
DEFINE_ENUM_FLAG_OPERATORS(TraceLoggingInformationFlags)
std::uint32_t GetTraceLoggingInformationFlags()
{
auto flags{ TraceLoggingInformationFlags::None };
if (wil::details::IsDebuggerPresent())
{
flags |= TraceLoggingInformationFlags::IsDebuggerPresent;
}
try
{
if ( ::AppModel::Identity::IsPackagedProcess())
{
flags |= TraceLoggingInformationFlags::IsPackagedProcess;
}
}
catch (...)
{
// Ignore errors
}
try
{
if ( ::WindowsAppRuntime::SelfContained::IsSelfContained())
{
flags |= TraceLoggingInformationFlags::IsSelfContained;
}
}
catch (...)
{
// Ignore errors
}
return flags;
}
There was a problem hiding this comment.
Or add to dev\common
HRESULT AppModel::Identity::IsPackagedProcess(bool& isPackagedProcess)HRESULT WindowsAppRuntime::SelfContained::IsSelfContained_nothrow(bool& isSelfContained)
as non-throwing variants and call these inGetTraceLoggingInformationFlags()
But regardless, don't duplicate code
Good idea, but this information retrieval happens on every TraceLoggingWrite. Not too heavy a cost? |
Add IsPackagedProcess and IsSelfContained bools to PartB fields to get signal on self-contained vs framework-dependent and packaged vs unpackaged deployments