newrelic-dotnet-agent icon indicating copy to clipboard operation
newrelic-dotnet-agent copied to clipboard

Reduce the public API "footprint" of the Agent

Open tippmar-nr opened this issue 1 year ago • 1 comments

Describe the story, please be clear on scope of the story.

At present, nearly all classes and interfaces in the .NET Agent are declared as public. In general this isn't a problem, but there have been reports of some customers running to issues in their use of certain dependency injection frameworks and other assembly scanning tools that look for all publicly accessible classes and interfaces in all assemblies loaded into the current application domain.

We should try, to the extent possible, to refactor the .NET Agent to convert all public classes and interfaces that aren't part of our intended public API to internal instead. In general, the only public classes should be those we intentionally expose for clients to use - i.e., the classes in NewRelic.Api.Agent.

Potential issues with a refactor would include impacts on Unit and Integration Tests that need access to classes in the Agent that are currently public. Possible solutions to that issue would be to use the InternalsVisibleTo attribute to allow our test classes access to the internals, or to refactor the code so that concrete classes remain internal while only interfaces would be public and refactor tests to reference interfaces instead of concrete classes.

This work should probably be preceded by a spike to determine the extent of the effort involved and assess the risks of refactoring.

Acceptance Criteria

The Agent should continue to function as it always has, and clients who scan all assemblies for public classes should not experience any errors.

Estimates

Please provide initial t-shirt size L

tippmar-nr avatar Mar 23 '23 19:03 tippmar-nr

https://issues.newrelic.com/browse/NEWRELIC-7734