Self referencing loop detected for property 'NamingContainer' with type 'System.Web.UI.WebControls.GridViewRow'. Path 'FooterRow.Cells[0]'



Am new user of Hangfire and using fireandforget feature ,below is the code

var jobId = BackgroundJob.Enqueue(() => FireAndForget(GvDataFiles, clientContext, destLibraryName));

Function highlights
1.looping through the gridview rows.
2.performing some excel operations and uploading the file to sharepoint library.

While executing this job in form am facing the following issue “Self referencing loop detected for property ‘NamingContainer’ with type ‘System.Web.UI.WebControls.GridViewRow’. Path ‘FooterRow.Cells[0]’.”

Please guide me to resolve this issue.


Need help to solve JsonSerializationException and Hangfire.BackgroundJobClientException in hangfire while BackgroungJob.Enqueue

I’m pretty sure this is a serialization issue.

Hangfire stores the method and the parameter in the database by serializing them. What probably happens is that in one of your parameter, there is a self referencing loop.

A way to prevent that is by preventing SelfReferencingLoop when serializing.

The way I do it is by changing the AddHangfire method :

services.AddHangfire((sp, config) =>
        //Add the line below
        config.UseSerializerSettings(new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore });