+ Start a Discussion
Jay UdayakumarJay Udayakumar 

SFDC Login Error from .NET (An unhandled exception of type 'System.StackOverflowException' occurred in Microsoft.GeneratedCode)

Our Enterprise WSDL undergone some changes due to new fields in a table. So, we removed the Web Service reference in .NET project and deleted and added back. It's now throwing the below error in the line _sForceRef.login(SalesForce_User, SalesForce_Password & SalesForce_Token) as follows.

An unhandled exception of type 'System.StackOverflowException' occurred in Microsoft.GeneratedCode

The same code works good in another laptop, but I tried in both VS 2013 and 2015 and I get same error. Please help.

'New line added for SalesForce TLS changes
System.Net.ServicePointManager.SecurityProtocol = DirectCast(3072, SecurityProtocolType)

Dim wp As WebProxy = New WebProxy("cwybcproxy.us.dnb.com", 8080)
wp.BypassProxyOnLocal = False
_sForceRef.Proxy = wp

_loginResults = _sForceRef.login(SalesForce_User, SalesForce_Password & SalesForce_Token)

_sessionId = _loginResults.sessionId
_sForceRef.Url = _loginResults.serverUrl
_sForceRef.SessionHeaderValue = New SessionHeader()
_sForceRef.SessionHeaderValue.sessionId = _sessionId
Daniel BallingerDaniel Ballinger
What does the StackTrace from the exception look like? It will show you where the recursion is happening.
Daniel BallingerDaniel Ballinger

Let's keep any correspondence here in the forum so that it can also help others over time.

Greg Robinson 1Greg Robinson 1
I had the same issue and it happened on login as well.  I integrate the WSDL using C#.NET.  I previously had version 41 of the WSDL and this broke when I updated to version 43 of the WSDL.  There was a small change to one custom object I needed to use so I ended up reverting to version 41 and updating the single line in the WSDL file.  Perhaps this is something that broke on an update a year ago?
Chetan Mhatre 13Chetan Mhatre 13
Hi Greg, Facing same issue in salesforce login functionality c#. Please share which single line needs to be updated in WSDL File. Thanks in advance.
Rafal HejnaRafal Hejna
We're currently facing the same issue in my team. Is there any solution to resolve that?