There are 2 projects in my solution, Project A for UI and Project B for business logic. A depends on B. The issue I have is that A has a textbox for log but B can’t access to it because you know, B cannot depend on A. I wonder if there is workaround?

have both of them use the same logging framework (e.g. microsoft ILogger interface, log4net, nlog, etc.) and then pass the logger from A to B via constructor, DI, or a method parameter.
I think I know what you are talking about. Thanks, big help.
Pass an Action<string> into the business layer if all you need is to add text.
Use delegate to pass a method. Cool, I never thought of it this way.
BL should not access anything in the UI.
The simplest solution is probably to have an event defined in the BL. UI subscribes to it, registering a handler. Whenever there’s something to log, the BL triggers the event and the handler (which is a part of the UI) puts the message in the textbox, making sure that accessing the control itself happens on the UI thread.
publisher/subscriber, interesting. I will try it out.
C# devs
null reference exceptions

source