-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
IHostingStartup topic #4967
IHostingStartup topic #4967
Conversation
Updates Updates Updates Updates
@Tratcher Alrighty ... now that I've got us on the correct PR ... I'll cover the relevant bits that I find from the discussion in dotnet/aspnetcore#2051 and ping u back. |
@Tratcher I added two sections: Discovery to cover troubleshooting/debugging and a bit on globally disabling the automatically loaded hosting startup assemblies. What else would help in these regards? |
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.
Let's move these new sections to the very top right after the opening paragraph, they are applicable to the most users. Comparatively few users implement this feature.
|
||
## Discover loaded hosting startup assemblies | ||
|
||
To discover hosting startup assemblies loaded by the app or libraries added to the app, read the value of the [HostingStartupAssembliesKey](/dotnet/api/microsoft.aspnetcore.hosting.webhostdefaults.hostingstartupassemblieskey). The sample app reads the key into a `string` array and displays the result in the app's Index 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.
|
||
When either the host setting or the environment variable is set to `true` or `1`, hosting startup assemblies aren't automatically loaded. If both are set, the host setting controls the behavior. | ||
|
||
It isn't currently possible to selectively disable a hosting startup assembly added by a library unless the library offers its own configuration option. Disabling hosting startup assemblies using the host setting or environment variable disables them globally and may disable several features of an app. |
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.
want to link currently to the 2.1 bug that added this feature?
aspnet/Hosting#1243
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.
We don't generally discuss 2.1 features in the 2.0-era docs. @Rick-Anderson Do you want to make an exception here? I can say something to the effect that 'a future release will offer this feature' and then link that issue. I believe we have done that a few times in the past.
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.
@guardrex yes
👍 |
@Tratcher 👍 See how those updates look. |
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.
Fix the one long sentence. Do you really need to say in the runtime store?
|
||
### Update the dependencies file | ||
|
||
In order for the feature to activate for an app, the `runtime` location in the *\*.deps.json* file must be changed to reflect the location of the feature's runtime assembly in the runtime store. Prefix the `runtime` location with `lib/netcoreapp2.0/`: |
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.
Way too long. Alt:
The runtime
location for features is specified in the *.deps.json file. To active a feature, the runtime
must include the location of the feature's runtime assembly. Prefix the runtime
location with lib/netcoreapp2.0/
:
Or can you make a bullet list?
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'll try a shorter version of this that breaks the sentence as you suggest.
|
||
## Sample app | ||
|
||
The [sample app](https://github.com/aspnet/Docs/tree/master/aspnetcore/hosting/ihostingstartup/sample/) ([how to download](xref:tutorials/index#how-to-download-a-sample)) uses `IHostingStartup` to create a diagnostics tool. The tool adds two middlewares to the app at startup that provide diagnostic information: |
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.
provides ?
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.
The "two middlewares" "provide" (plural verb) 'the feature.' I think we're ok here.
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 guess the reason that I'm focusing on "two middlewares" and not "the tool" is that the object of "that" feels like it refers to the "two middlewares" more than "the tool." This is the way that I would speak the sentence verbally.
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. That's why I put ?
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.
lol 😄 I don't take anything you suggest lightly!
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.
🍻
|
||
## Discover loaded hosting startup assemblies | ||
|
||
To discover hosting startup assemblies loaded by the app or by libraries, enable logging and check the application logs. Errors that occur when loading assemblies are also logged. Loaded hosting startup assemblies are logged at the Debug level, and errors are always logged. |
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.
Errors that occur when loading assemblies are also logged
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.
and errors are always logged.
How about
and all errors are logged.
|
||
To discover hosting startup assemblies loaded by the app or by libraries, enable logging and check the application logs. Errors that occur when loading assemblies are also logged. Loaded hosting startup assemblies are logged at the Debug level, and errors are always logged. | ||
|
||
It's also possible to read the value of the [HostingStartupAssembliesKey](/dotnet/api/microsoft.aspnetcore.hosting.webhostdefaults.hostingstartupassemblieskey). The sample app reads the key into a `string` array and displays the result in the app's Index 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.
It's also possible to read the value of the
You can read the value of the
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.
Or better yet, nuke that entire sentence. The sample reads the HostingStartupAssembliesKey key into ...
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'll make the change, but this is an alternative to the first option of looking at the logs. This loses it's conversational tone by jumping right to 'the sample does Y for this' here.
Fixes #4438
Internal Review Topic