Access Violation
When mapping to an Input application crashes with no info when doing a multilevel mapping on EF Classes
[SupplyParameterFromForm] public InputModel Input { get; set; } = new();
public class InputModel : myClass
{
}
public class myClass
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime DateTimeStamp { get; set; } = DateTime.Now;
public List<Thing>? Things{ get; set; }
}
public class Thing
{
public int Id { get; set; }
public string ThingName { get; set; }
public DateTime DateTimeStamp { get; set; } = DateTime.Now;
public List<AnotherThing>? AnotherThings{ get; set; }
public myClass myClass { get; set; }
public int myClassId { get; set; }
}
public class AnotherThing
{
public int Id { get; set; }
public string AnotherThingName { get; set; }
public DateTime DateTimeStamp { get; set; }
public Thing Thing { get; set; }
public int ThingId { get; set; }
}
Crashes on:
Input = _myClass.Adapt<InputModel>();
Crash error: The program '[53536] MyApp.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.
Hello @KC-Cygnia Please indicate the version of Mapster you are using? If possible, check on the latest pre-release version.
Hi @DocSvartz I'm using 7.4.0
Hello @KC-Cygnia Please indicate the version of Mapster you are using? If possible, check on the latest pre-release version.
Pre release version 7.4.2-pre02 also crashes
possible linked with #720
@KC-Cygnia Based on your class structure (which appears to be recursive) I'm going to go out on a limb and guess that you are encountering circular recursion which leads to a stack overflow, which produces the access violation error. See if any of these options can help you.
@KC-Cygnia Based on your class structure (which appears to be recursive) I'm going to go out on a limb and guess that you are encountering circular recursion which leads to a stack overflow, which produces the access violation error. See if any of these options can help you.
Hi, Thanks, inline mapping and max depth helped as it was going in a loop of backward navigation, hence the error. May I suggest making maxdepth by default or handling the stack overflow? Hope this thread will help others with this issue. Thank you