DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Unity Errors in Configuration File  (Read 4,131 times)

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 11,205
    • Participated in NANY Challenge Fourteen Times
    • Coding Snacks
    • Writer
    • Hardware Hacker
Unity Errors in Configuration File
« on: September 11, 2015, 03:52 PM »
This could be subtitled How I've wasted 2 days 3 times on 3 different projects

I 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:

Code: ( xml)
<register type="ISystemInformationProvider" mapTo="SpecificInstanceSystemInformationProvider" name="SpecificInstanceSystemInformationProvider">
  <lifetime type="singleton"/>
</register>

Then later on, I have to use it.

Code: ( xml)
<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...

Original address: https://www.donationcoder.com/forum/index.php?topic=41583.0