Hi guys, since a downloaded the latest DO version I have problems with the one Structure class I have.
Are there any changes that could have caused this? Example:
public class MyEntity: Entity
{
[Field]
public MyStructure MyStructureProperty {get; private set;}
public MyEntity()
{
MyStructureProperty = new MyStructure("This is new");
//Error occors right after the line above.
}
}
public class MyStructure: Structure
{
public MyStructure(string value)
{
Set(value);
//So far so good, constructor does not fail...
}
[Field]
[NotNullOrEmptyConstraint]
public string Value { get; private set; }
public void Set(string value)
{
Value = HashHelper.ApplySoopahDoopahHash(value ?? string.Empty);
}
}
And the error is like this:
System.ArgumentNullException: Value cannot be null.
Parameter name: con
at System.Reflection.Emit.DynamicILGenerator.Emit(OpCode opcode, ConstructorInfo con)
at Xtensive.Reflection.DelegateHelper.CreateConstructorDelegate[TDelegate](Type type)
at Xtensive.Threading.ThreadSafeDictionary`2.GetValue(TKey key, Func`2 generator)
at Xtensive.Orm.Internals.Activator.CreateStructure(Type type, Persistent owner, FieldInfo field)
at Xtensive.Orm.Internals.FieldAccessors.StructureFieldAccessor`1.<.cctor>b__0(Persistent obj, FieldInfo field)
at Xtensive.Orm.Persistent.GetFieldValueAdapter(FieldInfo field, Func`3 ctor)
at Xtensive.Orm.Internals.FieldAccessors.CachingFieldAccessor`1.GetValue(Persistent obj)
at Xtensive.Orm.Internals.FieldAccessor`1.GetUntypedValue(Persistent obj)
at Xtensive.Orm.Persistent.GetFieldValue(FieldInfo field)
at Xtensive.Orm.Persistent.SetFieldValue(FieldInfo field, Object value, SyncContext syncContext, RemovalContext removalContext)
at Xtensive.Orm.Persistent.SetFieldValue(FieldInfo field, Object value, SyncContext syncContext)
at Xtensive.Orm.Persistent.SetFieldValue(FieldInfo field, Object value)
at Xtensive.Orm.Persistent.SetFieldValue[T](FieldInfo field, T value)
at Xtensive.Orm.Persistent.SetFieldValue[T](String fieldName, T value)
... in ...\MyEntity.cs:line xxx
at MyEntity Constructor (Session session, ... string value) in ...\MyEntity.cs:line xxx
at MyEntityService.SessionProvidingInvoker.PopulateData(Session session) in ...\MyEntityService\SessionProvidingInvoker.cs:line xxx
asked
May 03 '12 at 11:45
Jos
44●4●5●8
Hello Jos, unfortunately I can't reproduce your problem. It seems that structure does not have required constructor. All required constructors are injected via PostSharp, so your assembly might be not processed by it. Please check that and if it does not work still try to make a sample project for us. You can contact me directly via e-mail support at dataobjects net
Hi Denis, thanks for your quick response. Ok, I did have some Postsharp issues and also read about it in other issues in this forum. I did remove and reinstall DataObjects + PostSharp completely yesterday and also checked the attributes in the *.csproj files related to PostSharp. It all did not help. For now I will go trough this process again and double-check things and if that does not help I will let you know.