I have below code for GET request -
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method="GET";
request.Timeout=300000;
X509Certificate2 certificate= new X509Certificate2(path,password);
request.ClientCertificates.Add(certificate);
While adding certificate I am getting Error -
Self Referencing loop detected for property 'manifestmodule' with type 'System.Reflection.RuntimeModule' Path 'Exception.Targetsite.Module.Assembly'
I searched on internet with respect to this error , but its general occurance is while using / parsing json which I am nowhere doing in my code.
I am using .NET core - 2.1.1
As you already found out this is an error coming from the Newtonsoft JsonSerializer. I think what's happening is that inside your API an exception is occurring, which is then passed to Newtonsoft to serialize to JSON so it can be returned as a response. Your options are either to fix this exception or disable reference loop detection mechanism.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
.AddJsonOptions(
options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With