Resolve()throws exceptions

Jun 3, 2011 at 12:24 PM

Hi ,

 Please help me in this

LogWriter is registered but the resolve method is throwing an exception

UnityServiceLocator.Current.Resolve(typeof(LogWriter), typeof(LogWriter).Name, null

)   

 

 

 

Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "LogWriter".
Exception occurred while: while resolving.
Exception is: ArgumentNullException - Value cannot be null.
Parameter name: collection
-----------------------------------------------
At the time of the exception, the container was:

  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,LogWriter

i see that there is code 

 

 

 

 

 

 

 

if

(t.IsGenericTypeDefinition)

{

 

 

throw new ArgumentException

(

 

 

string.Format(CultureInfo

.CurrentCulture,

 

 

Resources

.CannotResolveOpenGenericType,

t.FullName),

 

"t"

 not sure if it is causing the issue.

  

);

}

this is what happens in unity2.0

 but in unity 1.1 there is method that supports genrics

 T Resolve<T>()

 

 Let me know if unity 2.0 supports genrics or not .

 Thanks in advance!!!

 Regards,

 Kiran

Jun 6, 2011 at 3:49 AM

Hi,

Yes Unity 2.0 still supports generics as with Unity 1.1. Can you post your relevant config here, specially the part on how you register your generic types?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com