-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
Dear Support,
following exception occurs when auto mapping a model with viewmodel with same methods but different parameters !
System.ArgumentException
HResult=0x80070057
Message=Cannot bind to the target method because its signature is not compatible with that of the delegate type.
Source=System.Private.CoreLib
StackTrace:
at System.Reflection.RuntimeMethodInfo.CreateDelegateInternal(Type delegateType, Object firstArgument, DelegateBindingFlags bindingFlags)
at System.Reflection.RuntimeMethodInfo.CreateDelegate(Type delegateType)
at ServiceStack.AssignmentMember.CreateGetter() in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\AutoMappingUtils.cs:line 1085
at ServiceStack.AssignmentEntry..ctor(String name, AssignmentMember from, AssignmentMember to) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\AutoMappingUtils.cs:line 1048
at ServiceStack.AssignmentDefinition.AddMatch(String name, AssignmentMember readMember, AssignmentMember writeMember) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\AutoMappingUtils.cs:line 1140
at ServiceStack.AutoMappingUtils.<>c__DisplayClass27_0.<GetAssignmentDefinition>b__0(String <p0>) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\AutoMappingUtils.cs:line 457
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at ServiceStack.AutoMappingUtils.GetAssignmentDefinition(Type toType, Type fromType) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\AutoMappingUtils.cs:line 445
at ServiceStack.AutoMappingUtils.PopulateFromPropertiesWithoutAttribute[To,From](To to, From from, Type attributeType) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\AutoMappingUtils.cs:line 598
at UnitTests.AutoMapperTest.Test_PopulateFromPropertiesWithoutAttribute() in K:\Library II\4. VB\09 Tests\UnitTests\AutoMapperTest.cs:line 37This is the test code I have created:
[TestClass]
public class AutoMapperTest
{
[TestMethod]
public void Test_PopulateFromPropertiesWithoutAttribute ()
{
MyModel myModel = new MyModel ();
MyViewModel myViewModel = new MyViewModel ();
myViewModel.MyProp = "Test";
myModel.PopulateFromPropertiesWithoutAttribute (myViewModel, typeof(IgnoreOnPopulateAttribute));
Assert.AreEqual (myModel.MyProp, myViewModel.MyProp);
}
class MyModel
{
public void MyMethode (string myProp)
{
MyProp = myProp;
}
public string MyProp { get; set; }
}
class MyViewModel
{
public void MyMethode ()
{
MyProp = "MyMethode";
}
public string MyProp { get; set; }
}
}Please see also the attached gif for more information.
Could you verify and fix it please.
Metadata
Metadata
Assignees
Labels
No labels
