This could be subtitled
How I've wasted 2 days 3 times on 3 different projectsI have a common logger, that allows me to inject different behaviors depending on how I want to log. It works well. But Unity configuration sucks! Or it might just be me.
And when I say unity, I mean the unity application block, not the unity for gaming.
So at the top of my configuration file, I have the following to register the System Information Gathering module for the application:
<register type="ISystemInformationProvider" mapTo="SpecificInstanceSystemInformationProvider" name="SpecificInstanceSystemInformationProvider">
<lifetime type="singleton"/>
</register>
Then later on, I have to use it.
<register type="ILogBehavior" mapTo="CriticalErrorEmailNotificationBehavior" name="CriticalErrorEmailNotificationBehavior">
<lifetime type="singleton"/>
<constructor>
<param name="formatter" dependencyName="CriticalErrorEmailFormatter"></param>
</constructor>
<property name="Recipients">
<array>
<value value="[Redacted]"/>
</array>
</property>
<property name="SMTPServer" value="[Redacted]"></property>
<property name="From" value="[Redacted]"></property>
<property name="SystemInformationProvider" dependencyName="SpecificInstanceSystemInformationProvider"></property>
</register>
Notice that the SpecificInstanceSystemInformationProvider dependency is in there twice. But I always forget the second one... and the resolver complains about the FIRST one when the SECOND one is the problem, because I still have the class for the default use, instead of replacing it. I know... search and replace. But I just do a C&P on the first one...
and then spend 2 days looking for it.
ARGH! It's really cool... when I can get past my own stupidity and unity's build up error reporting! I just had to rant... I have a love/hate relationship with Unity...