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

Clean up public surface area #9076

Merged
merged 13 commits into from
Aug 28, 2023

Conversation

DustinCampbell
Copy link
Member

@DustinCampbell DustinCampbell commented Aug 2, 2023

Now that the legacy editor shim is in place, we can go ahead and clean up our public surface area and mark types as internal. In addition, there are several files in MS.VS.Editor.Razor that are no longer used by Web Tools and can be safely deleted.

I've enabled the public API analyzers for most of the tooling projects to ensure that we don't unintentionally add public surface area. I'm a little concerned about the MS.VS.LiveShare.Razor project (because I'm not sure how to validate it!), but I marked types that looked safe as internal.

Please let me know if I've missed something!

Note: This fails integration tests because the machines need to be updated in order for tests to pass. The test machines have a version of Web Tools that is still using public types from MS.VS.Editor.Razor.

@DustinCampbell DustinCampbell requested a review from a team as a code owner August 2, 2023 20:51
Copy link
Contributor

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

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

Looks good!

}

public EditorSettings Settings { get; }
public EditorSettings Settings { get; } = settings ?? throw new ArgumentNullException(nameof(settings));
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for this PR, but given we can now categorically say we have no public API, and we're (mostly) nullable enabled, is there any valid reason for keeping all of our argument validation?

Copy link
Member Author

Choose a reason for hiding this comment

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

The only reason that gives me pause is that it's a potentially disruptive change. I've seen a fair amount of test code passing null where it shouldn't.

Aside: @ryzngard, this is a potential reason in favor of enabling nullability in tests -- to spot these concerns quickly.

}

public override string ExtensionName { get; }
public override string ExtensionName { get; } = extensionName ?? throw new ArgumentNullException(nameof(extensionName));
Copy link
Contributor

Choose a reason for hiding this comment

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

❓does this still throw on initialization? primary constructors are weird

Copy link
Member Author

Choose a reason for hiding this comment

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

You'll get used to them. 😄 I tried not to change any existing behavior in this PR, but I did employ primary constructors in a few places to remove boilerplate.

@DustinCampbell DustinCampbell merged commit 2b325cf into dotnet:main Aug 28, 2023
@DustinCampbell DustinCampbell deleted the post-shim-clean-up branch August 28, 2023 17:27
@ghost ghost added this to the Next milestone Aug 28, 2023
@Cosifne Cosifne modified the milestones: Next, 17.8 P3 Sep 25, 2023
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