I have a problem with a copy of the Logging Block I have built from source. Specifically I am trying to use the MSMQ Distributor, which I builds successfully and the service installer works correctly too. However, the moment I try to write something, I
get the following message in my Event Log:
Exception Type: System.InvalidCastException
[A]Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry cannot be cast to
Type A originates from 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Logging\5.0.414.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Logging.dll'.
Type B originates from 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Users\username\Documents\Visual Studio 2010\Projects\EntLib50Src\Blocks\Logging\MsmqImplementation\Microsoft.Practices.EnterpriseLibrary.Logging.dll'.
TargetSite: Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry Deserialize(System.String)
The stack trace looks like this:
StackTrace Information Details:
at Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.BinaryLogFormatter.Deserialize(String serializedLogEntry)
The line of code that references LogEntry is:
Which seems quite uncontroversial.
I do not have the strong named version mentioned anywhere in my configuration, I definitely used the locally built version of the configuration tool to build the .config file and I don't believe it to be referenced by any part of the solution. I am wondering
whether Unity is trying to Dependency Inject the wrong version into my code for some reason. I do have the binary version of Enterprise Library installed as well- is this simply incompatible?
Can anyone cast any light on what is going on and what I need to do to prevent it?