Skip to content
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

Remove ! from Microsoft.Extensions.DependencyModel #58139

Closed
maxkoshevoi opened this issue Aug 25, 2021 · 14 comments
Closed

Remove ! from Microsoft.Extensions.DependencyModel #58139

maxkoshevoi opened this issue Aug 25, 2021 · 14 comments
Assignees
Labels
area-DependencyModel help wanted [up-for-grabs] Good issue for external contributors
Milestone

Comments

@maxkoshevoi
Copy link
Contributor

Description

This is a blanket issue for all ! operations that were added in #57445 (mainly in 57dee24)
They should be removed or reviewed.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Aug 25, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Aug 26, 2021

Tagging subscribers to this area: @eerhardt
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

This is a blanket issue for all ! operations that were added in #57445 (mainly in 57dee24)
They should be removed or reviewed.

Author: maxkoshevoi
Assignees: -
Labels:

area-DependencyModel, untriaged

Milestone: -

@eerhardt eerhardt added this to the Future milestone Aug 26, 2021
@eerhardt eerhardt removed the untriaged New issue has not been triaged by the area owner label Aug 26, 2021
@eerhardt eerhardt added the help wanted [up-for-grabs] Good issue for external contributors label Aug 26, 2021
@AnudeepGunukula
Copy link
Contributor

Hi @eerhardt @maxkoshevoi . i am interested in this project
i would like to work on this issue.

@eerhardt
Copy link
Member

eerhardt commented Sep 4, 2021

Sounds good. I assigned it to you.

@AnudeepGunukula
Copy link
Contributor

Hi @eerhardt . i had made a pr that might solve this issue
Kindly review it and please let me know the changes if needed.
Thanks in advance

@filipjelic
Copy link
Contributor

filipjelic commented Oct 23, 2021

@maxkoshevoi @eerhardt If you all agree, I'd like to take over this issue?

@eerhardt
Copy link
Member

Thanks, @filipjelic. I am assigning it to you.

@filipjelic
Copy link
Contributor

@eerhardt Just a bit more information here...
Should the approach be to have a default value (empty string) if GetString returns null, or writing an additional TryGetString as part of Utf8JsonReader.TryGet.cs ?

@eerhardt
Copy link
Member

As long as string.Empty and <null> don't need to be handled differently, that approach might work.

@filipjelic
Copy link
Contributor

After reading the discussion I see the way you proposed (having ReadTarget accept nullable string) which is the most simplest.
Is that agreed way or should the <null> handled with an exception?

@eerhardt
Copy link
Member

The heart of the problem (as far as I know) is that the DependencyModel code that reads a .deps.json file doesn't handle cases where a required strings are not provided in the file. It reads a string, stores it, and then later uses it as if it were not null. This can result in NullReferenceExceptions occurring.

We need to figure out a good approach to take when required strings are not in the file. I would guess the approach would be:

  1. If a string is required, and not in the file, throw an exception stating "the required field 'XX' was not specified".
  2. If a string is not required, ensure that it is typed as a string? everywhere.

@filipjelic
Copy link
Contributor

filipjelic commented Oct 27, 2021

After reading this resource
It seems the following objects are required:

Main .deps.json elements:

  • runtimeTarget
  • targets
  • libraries

targets section (.deps.json)

  • framework name (can contain also Runtime Identifier)
  • libraries > target

libraries section (.deps.json)

  • type

I'll re check my PR and update it accordingly.

@maxkoshevoi
Copy link
Contributor Author

Should this be closed since #60842 is merged?

@eerhardt
Copy link
Member

Yes! The PR wasn't linked to this issue as "fixes". Closing.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-DependencyModel help wanted [up-for-grabs] Good issue for external contributors
Projects
None yet
Development

No branches or pull requests

5 participants