This one cropped up at work recently. As part of a project there was a requirement for an API to carry out a check as part of an update on an object to ensure that none of the object’s children met a certain criteria (I’m avoiding business context here).
I was working with a customer’s code base recently and I noticed a separate Unit test project was referencing an internal class in a different assembly. Initially, I expected a code smell and perhaps some kind of wrapper that was exposing an internal class some how. After doing a bit of digging and examining dependencies further with Resharper I drew a blank. How was this possible?
I then recalled there’s a way of specifying a referenced dll as trusted but couldn’t recall how to do this. A quick Google (and good old Stackoverflow) pointed me towards marking the referencing assembly as a “friend” via the AssemblyInfo.cs . The full detail over at Stackoverflow