Thank you very much, Nathan!

I just applied your patch to the recent trunk version (r5416) that I
checked out and updated our Project's lib - and with some other
changes, we run on Mono (2.0.1) again with Castle MicroKernel! Very
glad about this! :)

Best greetings,
Stefan


On Nov 15, 4:18 am, Nathan O'Sullivan <[EMAIL PROTECTED]>
wrote:
> Browsing through the archives there was a thread on this a while back
> but it seems the problem was not solved.
>
> Somewhere between RC3 and HEAD  the MicroKernel stopped working properly
> on Mono 1.9+. HEAD still works on the older 1.2.x releases of Mono.
>
> I've attached a sample program which demonstrates the problem. After
> poking through the mono source it can be seen that for some  reason,
> Mono 1.9+ has implemented the
> System.ComponentModel.TypeDescriptor.CanConvertFrom() to claim that it
> can convert a string to interface (even though the implementation is
> incapable of doing so)
>
> This breaks the MicroKernel's method
> ComponentModelConverter.CanHandleType(Type). The end result of this is
> that on Mono 1.9+ the MicroKernel treats any dependencies on an
> interface as a "DependencyByKey" instead of "DependencyByService".
>
>               public override bool CanHandleType(Type type)
>                 {
>                         TypeConverter converter = 
> TypeDescriptor.GetConverter(type);
>                         return (converter != null &&
> converter.CanConvertFrom(typeof(String)));
>                 }
>
> I do not have the understanding of when this should succeed; hopefully
> it should never succeed when type.IsInterface ? I've attached a tiny
> patch to that effect, but perhaps there are some circumstances when
> interfaces can be converted from strings that I dont know of.
>
> I've also attached a basic test program; on Mono 1.9+ and Castle HEAD
> without this patch this program will throw an exception. The program
> works with Castle HEAD as-is on Windows or Mono 1.2.x
>
> Regards
> Nathan
>
>  ComponentModelConverter.cs.patch
> < 1KViewDownload
>
>  Test.build
> < 1KViewDownload
>
>  Test.cs
> < 1KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to