-
Notifications
You must be signed in to change notification settings - Fork 5k
Add RuntimeProperties Trace Event #690
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5035,6 +5035,108 @@ VOID ETW::InfoLog::RuntimeInformation(INT32 type) | |
} EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); | ||
} | ||
|
||
/****************************************************************************/ | ||
/* This is called by the runtime during startup to log the | ||
properties passed on from the host. */ | ||
/****************************************************************************/ | ||
|
||
VOID ETW::InfoLog::RuntimeInputProperties(int nProperties, LPCWSTR* propertyNames, LPCWSTR* propertyValues) | ||
{ | ||
CONTRACTL{ | ||
NOTHROW; | ||
GC_TRIGGERS; | ||
} CONTRACTL_END; | ||
|
||
EX_TRY{ | ||
if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context, RuntimeProperties)) | ||
{ | ||
unsigned short ClrInstanceID = GetClrInstanceId(); | ||
LPCWSTR trustedPlatformAssemblies = nullptr; | ||
LPCWSTR nativeDllSearchDirectories = nullptr; | ||
LPCWSTR platformResourceRoots = nullptr; | ||
LPCWSTR appContextBaseDirectory = nullptr; | ||
LPCWSTR appContextDepsFiles = nullptr; | ||
LPCWSTR probingDirectories = nullptr; | ||
LPCWSTR fxProductVersion = nullptr; | ||
LPCWSTR jitPath = nullptr; | ||
LPCWSTR fxDepsFile = nullptr; | ||
LPCWSTR appPaths = nullptr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I would rather delete it. |
||
LPCWSTR appNIPaths = nullptr; | ||
LPCWSTR startUpHooks = nullptr; | ||
LPCWSTR resolvedFrameworks = nullptr; | ||
SString others; | ||
|
||
for (int i = 0; i < nProperties; i++) | ||
{ | ||
if (wcscmp(propertyNames[i], W("TRUSTED_PLATFORM_ASSEMBLIES")) == 0) | ||
{ | ||
trustedPlatformAssemblies = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("NATIVE_DLL_SEARCH_DIRECTORIES")) == 0) | ||
{ | ||
nativeDllSearchDirectories = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("PLATFORM_RESOURCE_ROOTS")) == 0) | ||
{ | ||
platformResourceRoots = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("APP_CONTEXT_BASE_DIRECTORY")) == 0) | ||
{ | ||
appContextBaseDirectory = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("APP_CONTEXT_DEPS_FILES")) == 0) | ||
{ | ||
appContextDepsFiles = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("PROBING_DIRECTORIES")) == 0) | ||
{ | ||
probingDirectories = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("FX_PRODUCT_VERSION")) == 0) | ||
{ | ||
fxProductVersion = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("JIT_PATH")) == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
jitPath = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("FX_DEPS_FILE")) == 0) | ||
{ | ||
fxDepsFile = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("APP_PATHS")) == 0) | ||
{ | ||
appPaths = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("APP_NI_PATHS")) == 0) | ||
{ | ||
appNIPaths = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("STARTUP_HOOKS")) == 0) | ||
{ | ||
startUpHooks = propertyValues[i]; | ||
} | ||
else if (wcscmp(propertyNames[i], W("RESOLVED_FRAMEWORKS")) == 0) | ||
{ | ||
resolvedFrameworks = propertyValues[i]; | ||
} | ||
else | ||
{ | ||
others.Append(propertyNames[i]); | ||
others.Append(W("=")); | ||
others.Append(propertyValues[i]); | ||
others.Append(W("\n")); | ||
} | ||
} | ||
|
||
FireEtwRuntimeProperties(ClrInstanceID, trustedPlatformAssemblies, nativeDllSearchDirectories, | ||
platformResourceRoots, appContextBaseDirectory, appContextDepsFiles, | ||
probingDirectories, fxProductVersion, jitPath, fxDepsFile, | ||
appPaths, appNIPaths, startUpHooks, resolvedFrameworks, others); | ||
} | ||
} EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); | ||
} | ||
|
||
/* Fires ETW events every time a pdb is dynamically loaded. | ||
* | ||
* The ETW events correspond to sending parts of the pdb in roughly | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is nothing
Trusted
norPlatform
about these. Should we use this as an opportunity to come up with more sensible name that does not need 5 minute explanation?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some naming ideas:
Assemblies
,DefaultAssemblies
There was a problem hiding this comment.
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
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.There was a problem hiding this comment.
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: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 :-)