Skip to content

NRT enable dependent project finder.#43900

Merged
CyrusNajmabadi merged 5 commits intodotnet:masterfrom
CyrusNajmabadi:nrtDepProjectFinder
May 5, 2020
Merged

NRT enable dependent project finder.#43900
CyrusNajmabadi merged 5 commits intodotnet:masterfrom
CyrusNajmabadi:nrtDepProjectFinder

Conversation

@CyrusNajmabadi
Copy link
Contributor

We have a null ref in this code reported here: #43265

The code is extremely brittle and definitely not null safe. So at least doing a first pass of NRTifying it.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner May 2, 2020 03:42
@CyrusNajmabadi CyrusNajmabadi requested a review from sharwell May 4, 2020 03:11
private struct DependentProject : IEquatable<DependentProject>
private readonly struct DependentProject : IEquatable<DependentProject>
{
public readonly ProjectId ProjectId;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public readonly ProjectId ProjectId;
public readonly ProjectId? ProjectId;

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval


if (previous != null)
{
var referencedProject = solution.GetProject(previous.Assembly, cancellationToken);
Copy link
Contributor

Choose a reason for hiding this comment

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

❔ Why not GetRequiredProject here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tbh, because i don't know if i expect the above to succeed.

Comment on lines +296 to +300
return attrType?.Name == nameof(InternalsVisibleToAttribute) &&
attrType.ContainingNamespace?.Name == nameof(System.Runtime.CompilerServices) &&
attrType.ContainingNamespace.ContainingNamespace?.Name == nameof(System.Runtime) &&
attrType.ContainingNamespace.ContainingNamespace.ContainingNamespace?.Name == nameof(System) &&
attrType.ContainingNamespace.ContainingNamespace.ContainingNamespace.ContainingNamespace?.IsGlobalNamespace == true;
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 It would be nice to have a helper IsSameTypeName(Type) that performs this check:

return attrType.IsSameTypeName(typeof(InternalsVisibleToAttribute));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

idealy, this would just grab the "GetBestTypeByMetadataName" and hten just compare that type to the attrType. But i was worried that might subtle change semantics.

Copy link
Contributor

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

A couple small additional details

@CyrusNajmabadi CyrusNajmabadi merged commit be35a9f into dotnet:master May 5, 2020
@ghost ghost added this to the Next milestone May 5, 2020
@CyrusNajmabadi CyrusNajmabadi deleted the nrtDepProjectFinder branch May 5, 2020 00:06
@JoeRobich JoeRobich modified the milestones: Next, 16.7.P2 May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants