Hey James,
It looks like the problem is still there. The exact exception is below but
I thought I'd pass along some diagnostic info first.
I downloaded the source, included it in our project and set some breakpoints
in SeparateSubclassVisitor.cs. When the SortByDistanceFrom method is called
with the providers parameter containing the mappings for the
ConstantColorSource and SubstringColorSource the parentType parameter is
null. That's where the null reference exception is coming from on line 104.
if (subclassType.IsTopLevel() && !(parentType.IsInterface &&
subclassType.HasInterface(parentType)))
continue;
The statement above references the IsInterface method of the parentType
parameter but it's null.
The exact exception is...
----> System.NullReferenceException : Object reference not set to an
instance of an object.
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\Cfg\FluentConfiguration.cs(119,0):
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
C:\Documents and
Settings\developer\Desktop\VersiLabel\source\Testing\nhibernate_fixture.cs(104,0):
at GBS.VersiLabel.Testing.nhibernate_fixture.buildConfiguration()
C:\Documents and
Settings\developer\Desktop\VersiLabel\source\Testing\nhibernate_fixture.cs(79,0):
at GBS.VersiLabel.Testing.nhibernate_fixture.Test_Setup()
--NullReferenceException
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\SeparateSubclassVisitor.cs(104,0):
at FluentNHibernate.SeparateSubclassVisitor.SortByDistanceFrom(Type
parentType, IEnumerable`1 providers)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\SeparateSubclassVisitor.cs(32,0):
at FluentNHibernate.SeparateSubclassVisitor.FindClosestSubclasses(Type type)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\SeparateSubclassVisitor.cs(54,0):
at
FluentNHibernate.SeparateSubclassVisitor.ProcessJoinedSubclass(JoinedSubclassMapping
mapping)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\MappingModel\ClassBased\JoinedSubclassMapping.cs(22,0):
at
FluentNHibernate.MappingModel.ClassBased.JoinedSubclassMapping.AcceptVisitor(IMappingModelVisitor
visitor)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\MappingModel\DefaultMappingModelVisitor.cs(147,0):
at
FluentNHibernate.MappingModel.DefaultMappingModelVisitor.Visit(ISubclassMapping
subclassMapping)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\MappingModel\ClassBased\ClassMappingBase.cs(26,0):
at
FluentNHibernate.MappingModel.ClassBased.ClassMappingBase.AcceptVisitor(IMappingModelVisitor
visitor)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\MappingModel\ClassBased\ClassMapping.cs(72,0):
at
FluentNHibernate.MappingModel.ClassBased.ClassMapping.AcceptVisitor(IMappingModelVisitor
visitor)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\MappingModel\DefaultMappingModelVisitor.cs(102,0):
at
FluentNHibernate.MappingModel.DefaultMappingModelVisitor.Visit(ClassMapping
classMapping)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\MappingModel\HibernateMapping.cs(38,0):
at
FluentNHibernate.MappingModel.HibernateMapping.AcceptVisitor(IMappingModelVisitor
visitor)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\PersistenceModel.cs(149,0):
at FluentNHibernate.PersistenceModel.ApplyVisitors(IEnumerable`1 mappings)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\PersistenceModel.cs(115,0):
at FluentNHibernate.PersistenceModel.BuildMappings()
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\PersistenceModel.cs(156,0):
at FluentNHibernate.PersistenceModel.EnsureMappingsBuilt()
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\PersistenceModel.cs(166,0):
at FluentNHibernate.PersistenceModel.WriteMappingsTo(String folder)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\Cfg\FluentMappingsContainer.cs(116,0):
at FluentNHibernate.Cfg.FluentMappingsContainer.Apply(Configuration cfg)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\Cfg\MappingConfiguration.cs(63,0):
at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
C:\Documents and
Settings\developer\Desktop\fluentnhibernate-source-1.0.0.579\src\FluentNHibernate\Cfg\FluentConfiguration.cs(110,0):
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
If there's anything else I can do let me know.
On Wed, Aug 26, 2009 at 12:49 PM, Everett Muniz <[email protected]>wrote:
> Thanks James :-), i'll pull it down and test shortly.
>
> I'm trying to decide whether to feel psyched or a bit self conscious about
> having my name in the code base anywhere. i'm leaning toward the later ;-).
>
> On Wed, Aug 26, 2009 at 12:30 PM, James Gregory
> <[email protected]>wrote:
>
>> I've just committed a change that should hopefully fix this. There's now a
>> test in your honor ;) *ShouldHandleEverettsWeirdMapping*
>>
>> On Wed, Aug 26, 2009 at 1:20 PM, Everett Muniz <[email protected]>wrote:
>>
>>> I've included the classes I'm mapping along with the intermediate classes
>>> in the inheritance hierarchy.
>>>
>>> public abstract class ColorSource
>>> {
>>> public ColorSource()
>>> {
>>> }
>>>
>>> public abstract Color GetColorFrom(IRecord record);
>>> }
>>>
>>> public class ConstantColorSource : ColorSource
>>> {
>>> public const string ColorPartOutOfRangeMessage = "{0} is less
>>> than 0 or greater than 255.";
>>>
>>> protected internal ConstantColorSource()
>>> {
>>> }
>>>
>>> internal ConstantColorSource(int alpha, int red, int green, int
>>> blue)
>>> {
>>> if (!WholeNumber.IsByteValue(alpha))
>>> throw new
>>> ArgumentException(String.Format(ColorPartOutOfRangeMessage, "alpha"),
>>> "alpha");
>>> if (!WholeNumber.IsByteValue(red))
>>> throw new
>>> ArgumentException(String.Format(ColorPartOutOfRangeMessage, "red"), "red");
>>> if (!WholeNumber.IsByteValue(green))
>>> throw new
>>> ArgumentException(String.Format(ColorPartOutOfRangeMessage, "green"),
>>> "green");
>>> if (!WholeNumber.IsByteValue(blue))
>>> throw new
>>> ArgumentException(String.Format(ColorPartOutOfRangeMessage, "blue"),
>>> "blue");
>>>
>>> this.Alpha = alpha;
>>> this.Blue = blue;
>>> this.Green = green;
>>> this.Red = red;
>>> }
>>>
>>> internal ConstantColorSource(int red, int green, int blue)
>>> : this(Byte.MaxValue, red, green, blue)
>>> {
>>> }
>>>
>>> internal ConstantColorSource(Color color)
>>> {
>>> this.Alpha = color.A;
>>> this.Red = color.R;
>>> this.Green = color.G;
>>> this.Blue = color.B;
>>> }
>>>
>>> public virtual int Alpha { get; private set; }
>>>
>>> public virtual int Blue { get; private set; }
>>>
>>> public virtual int Green { get; private set; }
>>>
>>> public virtual int Red { get; private set; }
>>>
>>> public override Color GetColorFrom(IRecord record)
>>> {
>>> return Color.FromArgb(this.Alpha, this.Red, this.Green,
>>> this.Blue);
>>> }
>>> }
>>>
>>> public abstract class DataBoundColorSource : ColorSource
>>> {
>>> protected internal DataBoundColorSource()
>>> {
>>> }
>>>
>>> public DataBoundColorSource(RecordAccessor recordAccessor)
>>> {
>>> if (recordAccessor == null)
>>> throw new ArgumentNullException("recordAccessor",
>>> "recordAccessor is null.");
>>> this.RecordAccessor = recordAccessor;
>>> }
>>>
>>> public virtual RecordAccessor RecordAccessor { get; private set;
>>> }
>>> }
>>>
>>> public abstract class ColorMapColorSource : DataBoundColorSource
>>> {
>>> protected internal ColorMapColorSource()
>>> {
>>> }
>>>
>>> public ColorMapColorSource(ColorMap colorMap, RecordAccessor
>>> recordAccessor)
>>> : base(recordAccessor)
>>> {
>>> if (colorMap == null)
>>> throw new ArgumentNullException("colorMap", "colorMap is
>>> null.");
>>> this.ColorMap = colorMap;
>>> }
>>>
>>> public virtual ColorMap ColorMap { get; private set; }
>>> }
>>>
>>> public class SubstringColorSource : ColorMapColorSource
>>> {
>>> public const string ColorMappingExceptionMessage = "An error was
>>> encountered while attempting to locate a color for the value '{0}' in the
>>> '{1}' color map.";
>>> public const string RecordAccessExceptionMessage = "An error was
>>> encountered while attempting to access the supplied record ({0}).";
>>> public const string ValueNotMappedToValidColorExceptionMessage =
>>> "The value '{0}' is not mapped to a valid color in the {1} color map.";
>>>
>>> private static readonly TextSelector TextSelector = new
>>> TextSelector();
>>>
>>> internal SubstringColorSource(int start, int length, ColorMap
>>> colorMap, RecordAccessor recordAccessor)
>>> : base(colorMap, recordAccessor)
>>> {
>>> this.Start = start;
>>> this.Length = length;
>>> }
>>>
>>> protected internal SubstringColorSource()
>>> {
>>> }
>>>
>>> public virtual int Length { get; private set; }
>>>
>>> public virtual int Start { get; private set; }
>>>
>>> public override Color GetColorFrom(IRecord record)
>>> {
>>> if (record == null)
>>> throw new ArgumentNullException("record", "record is
>>> null.");
>>>
>>> var value = TextSelector.Select(getValue(record), this.Start,
>>> this.Length);
>>> var color = getColor(value);
>>>
>>> if (color.ToArgb() == Color.Empty.ToArgb())
>>> {
>>> throw new ApplicationException(String.Format(
>>> ValueNotMappedToValidColorExceptionMessage,
>>> value,
>>> this.ColorMap.Name
>>> ));
>>> }
>>>
>>> return color;
>>> }
>>>
>>> private Color getColor(string value)
>>> {
>>> try
>>> {
>>> return this.ColorMap.FindColorBy(value);
>>> }
>>> catch (Exception exception)
>>> {
>>> throw new ApplicationException(
>>> String.Format(ColorMappingExceptionMessage, value,
>>> this.ColorMap.Name),
>>> exception
>>> );
>>> }
>>> }
>>>
>>> private string getValue(IRecord record)
>>> {
>>> try
>>> {
>>> return this.RecordAccessor.GetValueFrom(record);
>>> }
>>> catch (Exception exception)
>>> {
>>> throw new ApplicationException(
>>> String.Format(RecordAccessExceptionMessage,
>>> record.Schema.ToString()),
>>> exception
>>> );
>>> }
>>> }
>>> }
>>>
>>>
>>>
>>
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---