asp.net core System.StackOverflowException while using dynamic keyword

-1

I'm using .Net Core version: 2.2

Sample code scenario causing the System.StackOverflowException

public string Method1(string jsonData)
{
    dynamic dObject = JObject.Parse(jsonData);
    string strData = Method2(dObject);
    return strObject;
}

public string Method2(dynamic dObj)
{   // <-- debugger breaks the program with exception at this line
    // ...some logic
    return data
}

The JObject.Parse() method is from Newtonsoft.Json.Linq namespace

Error details:

System.StackOverflowException

HResult=0x800703E9

Message=Exception of type 'System.StackOverflowException' was thrown.


Same code is working with .Net Framework. Getting issue while converting to .Net Core

c#
dynamic
json.net
.net-core-2.2
asked on Stack Overflow Mar 26, 2019 by Abhay Gawade • edited Mar 27, 2019 by Abhay Gawade

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0