Skip to content

Add IsPackagedProcess and IsSelfContained to common insights PartB fields#6233

Open
agniuks wants to merge 10 commits intomainfrom
user/agnel/app_insights
Open

Add IsPackagedProcess and IsSelfContained to common insights PartB fields#6233
agniuks wants to merge 10 commits intomainfrom
user/agnel/app_insights

Conversation

@agniuks
Copy link
Contributor

@agniuks agniuks commented Feb 20, 2026

Add IsPackagedProcess and IsSelfContained bools to PartB fields to get signal on self-contained vs framework-dependent and packaged vs unpackaged deployments

@agniuks
Copy link
Contributor Author

agniuks commented Feb 25, 2026

@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.

@agniuks agniuks marked this pull request as ready for review February 25, 2026 18:57
@agniuks
Copy link
Contributor Author

agniuks commented Feb 25, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@agniuks
Copy link
Contributor Author

agniuks commented Feb 25, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe
Copy link
Member

@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.

Good idea, but this information retrieval happens on every TraceLoggingWrite. Not too heavy a cost?

@DrusTheAxe
Copy link
Member

Please "Resolve conversation" as you address issues. It helps make it easy to spot what was addressed vs still open/pending

inline HRESULT IsSelfContained_nothrow(bool& isSelfContained) noexcept
{
isSelfContained = false;
auto module = ::GetModuleHandleW(L"Microsoft.WindowsAppRuntime.dll");
Copy link
Member

Choose a reason for hiding this comment

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

Silently swallows errors. if !module it would be better to report what happened

WIL is your friend :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

!module is the normal case when the DLL isn't loaded yet (like during bootstrap). If we RETURN_LAST_ERROR_IF_NULL here it'd bubble up as a real error. Would something like LOG_LAST_ERROR_IF_NULL + still returning S_OK be a good middle ground?

Copy link
Member

Choose a reason for hiding this comment

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

Ahhh, but in this case it is an error. It's the caller's decision if that's a problem for them, or if they want to ignore it as 'expected'

If this is called before the DLL is loaded (e.g. bootstrap) then would the caller hit this again later and get a different answer?

Given the TraceLogging callsite calls this on 1st use and caches the result the question is, does that 1st call happen after bootstrapping? If not how would that cached answer be revised - or would it always be wrong 'cause too early?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the logic still works out: self-contained apps already have the DLL loaded (no
bootstrap), so GetModuleHandleW succeeds on first call. Framework-dependent apps use the bootstrapper, and they aren't self-contained anyway, so the cached false is correct either way?

@agniuks
Copy link
Contributor Author

agniuks commented Feb 27, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@agniuks
Copy link
Contributor Author

agniuks commented Feb 27, 2026

@DrusTheAxe ready for another review, thanks!

@agniuks agniuks requested a review from DrusTheAxe February 27, 2026 23:54
@agniuks
Copy link
Contributor Author

agniuks commented Feb 28, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants