BizTalk Error Message – An unhandled exception (‘System.StackOverflowException’) occurred in BTSNTSvc.exe

Posted: May 11, 2011 in BizTalk
Tags: , ,

It’s very common to use .NET code for orchestration support. In one of these scenarios I decide to use a class for, in a certain way, validate request and add more information, and to my surprise I was blessed by this error:

An unhandled exception (‘<System.StackOverflowException>’) occurred in BTSNTSvc.exe [2756]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on.
Check the documentation index for ‘Just-in-time debugging, errors’ for more information.


And to further aggravate the situation my Host Instance associated to the process stopped. First action was to reactive the host instance! But for my surprise again! Automatically the host instance stopped again! Sorriso


First, let put some integration context…


My team requested me, ASAP (this would be one of the problems Sorriso), to develop a method to change User Contact Information across different platforms. Basically, I get a request with different attributes, each of them is optional and so I need:

  • First to read the user contact information from my “Cache” DB
  • See the fields that aren’t filled, and filled them with the cache information
  • Update the user information across different platforms
  • Update my database user information


So to accomplish that goal, I decide to create a Serializable public class UserProfile and use this class as a variable inside the orchestration



First clue:

  • A StackOverflowException exception is thrown when the execution stack overflows by having too many nested method calls.
  • Tips: Make sure you do not have an infinite loop or infinite recursion.

Second clue:

  • Because I was running different processes in that host instance, I had to validate which process was causing the error
  • When I found the process, I found that no orchestration artifact is load, so the problem was in the Initialization of the artifact, but I cannot find an easy way to debug from Visual Studio.


It happens to everyone… I usually say that these kinds of problems are between the chair and the keyboard Sorriso.

The cause of the problem was in the definition of a variable of class UserProfile, I put in the return the name of the prop snippet instead of the variable, and this cause an infinite loop.

private string userFirstName = string.Empty;
/// <summary>
/// User First and Last Name
/// </summary>
public string UserFirstName
      return UserFirstName;
      userFirstName = value;


Easy, rectify the code.

The major difficulty in this scenario was how to find the error. I was able to debug the .NET stack using the Microsoft Symbol Server to obtain debug symbol files ( that I will explain a little more in one of my next posts.


  • ASAP never works well Sorriso
  • Be aware with copy –> paste

Last but not least, I want to thank Jorge Lourenço for help, which is one of the best technicians that I know in regard to detecting and solving problems

Tags: BizTalk | Orchestration | Errors and Warnings, Causes and Solutions

  1. […] BizTalk Error Message – An unhandled exception (‘System.StackOverflowException’) o… […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s