.NET 8 upgrade issue for functions using Durable functions and Orchestrator

Vivek Nirale 0 Reputation points
2024-06-28T11:40:03.35+00:00

I have upgraded Function which uses Orchestrator and Durable functions from .Net 6 to .Net 8 (isolated model) and after upgrade when I am trying to run the function, I am getting the error.

An unexpected failure occurred while processing instance 'bfac8741288e59fd9868ae537b3ae370': Newtonsoft.Json.JsonReaderException: The reader's MaxDepth of 64 has been exceeded. Path 'OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[1].OrchestrationTraceContexts[0]', line 1, position 9933.

And I am using Newtonsoft to deserialize the json but after deserializing when it goes into Orchestrator triggered function during calling subOrcestrator function it won't process further.

Tried by adding the below configuration in host.json for the function but it did not work.

{

  "version": "2.0",

  "orchestrator": {

    "maxDepth": 128

  },

  "extensions": {

    "durableTask": {

      "serialization": {

        "maxDepth": 128

      },

      "tracing": {

        "distributedTracingEnabled": true,

        "distributedTracingProtocol": "W3CTraceContext"

      }

    }

  }

And also tried to set maxDepth property to 128 during deserializing but its not working. Can someone please help on this.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,543 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,562 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,550 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 59,966 Reputation points
    2024-06-28T16:28:55.2866667+00:00

    The newtonsoft serializer does not support the hosts file. You should set the max depth with the serializer settings when you configure using newtonsoft.

    0 comments No comments