[Mono-bugs] [Bug 381435] Castle project (MonoRail and Windsor) stack with 1. 9 exceptions

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Dec 19 09:21:16 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=381435

User silk at boktor.net added comment
https://bugzilla.novell.com/show_bug.cgi?id=381435#c6


Grzegorz Sobański <silk at boktor.net> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |silk at boktor.net
             Status|NEEDINFO                                        |NEW
      Info Provider|patrick at villadays.com                           |




--- Comment #6 from Grzegorz Sobański <silk at boktor.net>  2008-12-19 07:21:15 MST ---
Nathan O'Sullivan has reported a new bug to castle, with a detailed reason for
this failure, and a very simple reproducible test case.
I checked, it is still valid for 2.2 branch.

To compile: gmcs -r:Castle.Windsor.dll Test.cs
You can get castle stack for example from:
http://builds.castleproject.org/cruise/DownloadBuild.castle?number=998

I am quoting the original IOC-ISSUE-133 here
(http://support.castleproject.org/projects/IOC/issues/view/IOC-ISSUE-133):

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


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list