0

I have built a standalone console app that is throwing intermittent StackOverFlow exceptions only when installed on a Windows Server 2003 Enterprise Edition Service Pack 2 test machine. The code is far too complex to post, but here are the details:
Source code is C# VS 2010.
There are no recursive calls in the source code, but it does use a worker thread.
The running process is not terminated when the StackOverflowException occurs.
When the exception occurs, it will consistently occur in the same location.
When the exception occurs, it almost always occurs when the code is trying to initialize across a COM boundary i.e: CAsset asset = new CAsset() where CAsset is a COM object written in C++.
Replacing the direct initialization with a call to System.Activator.CreateInstance

            System.Type assetType = System.Type.GetTypeFromProgID("GDMTCommon.HansenAsset");
            object activated = System.Activator.CreateInstance(assetType);
            asset = activated as CHansenAsset;

does not solve the problem, but it does move the point of failure to a different location in the code. Also the above code does not throw an error, but the asset variable is null after the direct cast. This instance is the one time that the failure does not occur on initializing a COM object.
The most baffling behavior is that I can run the tool on two different sets of source data on the test machine, and for one set of source data the code will run to completion without error, on the other the code fails.
I have installed the same tool on two different Windows 7 test machines and could not reproduce the error on either machine. I also installed the tool on a Windows Server 2003 Standard Edition Service Pack 2 test machine and could not reproduce the error on that machine.
Numerous searches have turned up a couple of other questions where code working on one OS starts throwing StackOverflowExceptions on when installed on Windows Server 2003 , but I did not see any definitive solutions.
I found this knowledge base article that seems to describe my problem:
http://support.microsoft.com/kb/915750
But according to the article, the problem is fixed in Service Pack 2 and I have verified that Service Pack 2 is installed on the test machine.
Any assistance will be greatly appreciated.
Regards,
Jay

1
  • In case anyone else runs into this issue, the client told me this morning that running Windows Update and applying all applicable patches cleared the problem.
    – Jay Florey
    Nov 14, 2012 at 21:47

1 Answer 1

0

Running Windows Update and applying all of the available updates to the machine resolved the stack overflow problems. Still unsure what was causing them in the first place. Since this was a client machine that I did not have access to, I had to wait for them to apply the updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.