I developed a simple email library that submits records ("email records") to a database to be processed and submitted to the email server by another process. This library has a custom Message ("custom") class with all of the properties that a email message would have To, From, Subject and a few more properties that I track that is not typical in a email message but more of the purpose of capturing who created the email, process that is generating the email, key identifiers, etc. Lets call this library email.dll.
I developed another library ("Lib A") that needs to use email. A reference is made to "email.dll" for the purpose of creating message classes that inherit from the "custom" message class. Thats all! So for example, in this library, I have a custom message called "ApprovedMailMessage" that inherited the properties from the custom class within email.dll. When the parent application (that uses this library) need sends the "ApprovedMailMessage", it creates a queued record ("queued records") into another table to be picked up by a console application. "Lib A" is compiled using ILmerge which incorporates "email.dll" into it.
I developed a console application ("App B") that also has a reference to "Lib A". This application simply checks for "queued records". The application creates the "ApprovedMailMessage" object using "Lib A" where the custom message exists.
When "App B" tries to set some values on the "Lib A" object, I get a "Attempt by method x to access type Y failed." exception
So here is the setup:
"email.dll" is referenced by "Lib A"
"Lib A" is referenced by "App B"
"App B" trying to set a value on a inherited property (from email.dll) on object from "Lib A".
What I tried:
I tried to reference "email.dll" from "App B". When I did that some ambiguity namespace exceptions appeared.