Skip to content

Add RuntimeProperties Trace Event #690

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

swaroop-sridhar
Copy link
Contributor

As part of dotnet/core-setup#4112, this change adds the RuntimeProperties event.
This event during fired on startup, and publishes all properties passed by the host to the runtime.

Known properties are explicitly called out by the event template.
Other properties are accumulated into the "Others" string.

Currently, due to EventPipe’s attach only nature, a test using event-pipe may miss the event.
So, this change doesn't include an automated test.

The recommended method for testing the event was using ETW.
I'll send out a PR to the PerfView repo to add this event to TraceEvent.

As part of dotnet/core-setup#4112, this change adds the RuntimeProperties event.
This event during fired on startup, and publishes all properties passed by the host to the runtime.

Known properties are explicitly called out by the event template.
Other properties are accumulated into the "Others" string.

Currently, due to EventPipe’s attach only nature, a test using event-pipe may miss the event.
So, this change doesn't include an automated test.

The recommended method for testing the event was using ETW.
I'll send out a PR to the PerfView repo to add this event to TraceEvent.
LPCWSTR fxProductVersion = nullptr;
LPCWSTR jitPath = nullptr;
LPCWSTR fxDepsFile = nullptr;
LPCWSTR appPaths = nullptr;
Copy link
Member

@jkotas jkotas Dec 9, 2019

Choose a reason for hiding this comment

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

appNIPaths is deprecated and not used anywhere. Do we really need to log it?

I would rather delete it.

{
fxProductVersion = propertyValues[i];
}
else if (wcscmp(propertyNames[i], W("JIT_PATH")) == 0)
Copy link
Member

@jkotas jkotas Dec 9, 2019

Choose a reason for hiding this comment

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

JIT_PATH is also not relly used for anything.

@@ -710,6 +710,43 @@
</UserData>
</template>

<template tid="RuntimeProperties">
<data name="ClrInstanceID" inType="win:UInt16" />
<data name="TrustedPlatformAssemblies" inType="win:UnicodeString"/>
Copy link
Member

@jkotas jkotas Dec 9, 2019

Choose a reason for hiding this comment

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

There is nothing Trusted nor Platform about these. Should we use this as an opportunity to come up with more sensible name that does not need 5 minute explanation?

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 agree, we should choose a better name, since it is just a list of assemblies from which we resolve dependencies by default. I spoke to @richlander about this, he said he'll suggest a better name.

Copy link
Member

Choose a reason for hiding this comment

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

I have heard about the TPA list for many years, but I don't know how it fits into frameworks and other .NET Core-isms. Can you describe what it means to you?

Copy link
Member

Choose a reason for hiding this comment

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

  • Is is a list of assemblies that the application is composed of.
  • It is a list of assemblies that are (logically) pre-loaded into default assembly load context.

Some naming ideas: Assemblies, DefaultAssemblies

Copy link
Member

Choose a reason for hiding this comment

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

Good suggestions. Those help. They are also a bit misleading. For example, DefaultAssemblies doesn't align with the default AssemblyLoaderContext. That would be confusing to me.

When a dependency needs to be resolved from a non-default ALC by the default ALC, I assume assemblies other than the TPA ones would be candidates. Is that right?

I take it that the TPA is basically the set of "pre-bound assemblies." How about ApplicationAssemblies.

Copy link
Member

Choose a reason for hiding this comment

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

When a dependency needs to be resolved from a non-default ALC by the default ALC, I assume assemblies other than the TPA ones would be candidates

Maybe I'm missing what you mean by this, but if the default ALC needs to resolve a dependency that is not on the TPA list, the runtime would not know where to look for that assembly? The user would need to have added some sort of event handler (AssemblyLoadContext.Resolving or AppDomain.AssemblyResolve) to do the resolution themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When a dependency needs to be resolved from a non-default ALC by the default ALC, I assume assemblies other than the TPA ones would be candidates. Is that right?

When an assembly is loaded into non-default ALC, the ALC's load method tries to resolve the assembly using custom logic in its Load() overrides. If the assembly cannot be resolved that way, the resolution defers to the default-ALC, which tries to resolve the assembly using the TPA list. So, the TPAs are closely associated with the default-ALC.

How about ApplicationAssemblies.

ApplicationAssemblies sounds like a good name, because typically the application's assemblies are loaded into the default-ALC, while the plugins are loaded into custom-ALC.

Copy link
Member

Choose a reason for hiding this comment

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

I think @elinor-fung used the term DefaultAssemblies in the other PR, which I actually like better. There are two sets of assemblies which are typically present in the TPA:

  • The frameworks
  • Application assemblies

Both are equally important when dealing with plugins and such. Calling it just ApplicationAssemblies might mean to someone that it's just the app stuff, not the shared frameworks.
But it's still much better than TPA :-)

@jkotas
Copy link
Member

jkotas commented Dec 11, 2019

Do we have an idea what this logging will look like if/once we implement https://github.com/dotnet/core-setup/issues/7112 ?

@jkotas
Copy link
Member

jkotas commented Dec 11, 2019

cc @vitek-karas

@stephentoub
Copy link
Member

This PR hasn't seen any activity in 3 months. It's still in progress? When do we expect it to be moved forward? Thanks.

@swaroop-sridhar
Copy link
Contributor Author

I was planning to come back to this in a couple of weeks, after my current stream of work.
I'll close the two PRs for now, and activate them again in 2-3 weeks. Thanks.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants