PDA

View Full Version : Cannot obtain PropertyInfo... exception after nightbuild.


Nop
03-07-2007, 06:53 AM
Hi all!
I used Spring Framework .NET 1.1 P3 and to avoid some issues I decided to update.
After update to the nightbuild Spring.NET-20070304-2218 the spring context of my app could not be intialized :(. An exception is

[FatalObjectException: Cannot obtain PropertyInfo from an expression that does not resolve to a property.]
Spring.Expressions.PropertyOrFieldNode.GetProperty Info(Object context) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Expressions\PropertyOrFieldNode.cs:476
Spring.Objects.ObjectWrapper.GetPropertyInfo(Strin g propertyName) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\ObjectWrapper.cs:397
...
[ObjectCreationException: Error creating object with name 'ConverterFactory' defined in 'file [C:\development\projects\MyProj\trunk\Src\Web\Confi g\FrontController.xml]' : Initialization of object failed : Cannot obtain PropertyInfo from an expression that does not resolve to a property.]
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:745
Spring.Objects.Factory.Support.WebObjectFactory.Cr eateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments) in c:\projects\daily\Spring.Net\src\Spring\Spring.Web \Objects\Factory\Support\WebObjectFactory.cs:221



What does it mean?

Thanks.

Nop
03-07-2007, 08:10 AM
It is strange...
The exception is appeared when my ConverterFactory object is declared with a dictionary property...
For example,

<object id="ConverterFactory" type="MyProj.MVC.ConverterFactory, MyProj.MVC">
<property name="errorConverterDict">
<dictionary>
</dictionary>
</property>
</object>


And I am reported about
Cannot obtain PropertyInfo from an expression that does not resolve to a property.

Any suggestions?

Thanks.

Bruno Baia
03-07-2007, 02:16 PM
Hi,

I made a change recently, and it seems this is the problem.
Get the Spring.NET-20070302-2218.zip (http://www.springframework.net/downloads/nightly/Spring.NET-20070302-2218.zip) daily build instead.

I'm on it !

Bruno

Erich Eichinger
03-08-2007, 03:54 PM
Hi,

I just tried to reproduce your problem. Can you please post your ConverterFactory class' code?

tx,
Erich

Nop
03-09-2007, 08:27 AM
Hi Erich.
I try to use Spring.NET-20070304-2218.

The configuration file contains:
<object id="ConverterFactory" type="Converter.ConverterFactory, Converter">
<property name="ErrorConverterDict">
<dictionary>
</dictionary>
</property>

</object>

ConverterFactory class' code is

using System.Collections.Generic;

namespace Converter
{
public class ConverterFactory
{
public static IDictionary<string, string> ErrorConverterDict = new Dictionary<string, string>();

}
}

It may well be that, the exception is thrown when ErrorConferterDict is not defined as property (it's a field)...
I try a following example
using System.Collections.Generic;

namespace Converter
{
internal class ConverterFactory
{
public static IDictionary<string, string> errorConverterDict = new Dictionary<string, string>();

public static IDictionary<string, string> ErrorConverterDict
{
set
{
errorConverterDict = value;
}
}
}
}
and it works fine.
There is no a need of the property for errorConverterDict in early versions of Spring :D . I think it's my error.

Thanks.
Best regards, Nop.

Erich Eichinger
03-09-2007, 01:52 PM
Hi Nop,

thanks for reporting this. It is not your mistake - you discovered a nasty little bug in Spring. I entered a new JIRA issue SPRNET-502 (http://opensource.atlassian.com/projects/spring/browse/SPRNET-502) for this.

cheers,
Erich