Skip to content

Make IHostEnvironment.ApplicationName non-nullable - #72945

Merged
eerhardt merged 2 commits into
dotnet:mainfrom
eerhardt:Fix68512
Aug 1, 2022
Merged

Make IHostEnvironment.ApplicationName non-nullable#72945
eerhardt merged 2 commits into
dotnet:mainfrom
eerhardt:Fix68512

Conversation

@eerhardt

Copy link
Copy Markdown
Member

It is not intended that normal execution has a null ApplicationName, so don't make callers need to check for null. When an ApplicationName is not available, it is set to string.Empty.

Fix#68512

It is not intended that normal execution has a null ApplicationName, so don't make callers need to check for null. When an ApplicationName is not available, it is set to string.Empty.
Fixdotnet#68512
@ghost

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghostghost assigned eerhardtJul 27, 2022
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-extensions-hosting
See info in area-owners.md if you want to be subscribed.

Issue Details

It is not intended that normal execution has a null ApplicationName, so don't make callers need to check for null. When an ApplicationName is not available, it is set to string.Empty.

Fix #68512

Author:eerhardt
Assignees:-
Labels:

new-api-needs-documentation, area-Extensions-Hosting

Milestone:-

@eerhardt

Copy link
Copy Markdown
MemberAuthor

@halter73 - any concern with using string.Empty instead of <Unknown> here?

@halter73halter73 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think using string.Empty instead of something like <Unknown> is reasonable since hosting assumes that a non-empty app name is the name of the assembly containing the UserSecretsIdAttribute. It's easier to special case string.Empty than <Unknown>, and still communicates that a good default app name couldn't be determined.

@eerhardt
eerhardt merged commit 028e556 into dotnet:mainAug 1, 2022
@eerhardt
eerhardt deleted the Fix68512 branch August 1, 2022 15:22
@ghostghost locked as resolved and limited conversation to collaborators Aug 31, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Make IHostEnvironment.ApplicationName non-nullable

3 participants

@eerhardt@halter73@tarekgh