Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 04, 2016, 06:37:17 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Unity Errors in Configuration File  (Read 505 times)

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 8,405
  • "In my dreams, I always do it right."
    • View Profile
    • Donate to Member
Unity Errors in Configuration File
« on: September 11, 2015, 10:52:08 AM »
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: Text [Select]
  1. <register type="ISystemInformationProvider" mapTo="SpecificInstanceSystemInformationProvider" name="SpecificInstanceSystemInformationProvider">
  2.   <lifetime type="singleton"/>
  3. </register>

Then later on, I have to use it.

Code: Text [Select]
  1. <register type="ILogBehavior" mapTo="CriticalErrorEmailNotificationBehavior" name="CriticalErrorEmailNotificationBehavior">
  2.   <lifetime type="singleton"/>
  3.   <constructor>
  4.     <param name="formatter" dependencyName="CriticalErrorEmailFormatter"></param>
  5.   </constructor>
  6.   <property name="Recipients">
  7.     <array>
  8.       <value value="[Redacted]"/>
  9.     </array>
  10.   </property>
  11.   <property name="SMTPServer" value="[Redacted]"></property>
  12.   <property name="From" value="[Redacted]"></property>
  13.   <property name="SystemInformationProvider" dependencyName="SpecificInstanceSystemInformationProvider"></property>
  14. </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...