ProxyGen work around for the "Stack Empty" error.

ProxyGen has many issues and doesn't give very informative errors.  One of the most annoying errors I've come across is “ProxyGen.exe Error:  0  :  Stack empty.” Which is followed by “ProxyGen.exe Information:  0  :  Finished”.  The second line is a lie.  The “Stack empty” error is fatal and the proxy file will not be generated or updated.  There are several issues that can cause the “Stack empty” error, but sometimes the error is generated for code that has no problems. 

So, assuming that the code is problem free, here are three workarounds.  The idea of these workarounds is to reduce the descriptor file being used as input, if necessary emptying it as much as possible.  When a reduced descriptor file doesn’t work- create two proxies and combine them.

Workaround I)   Reduce the descriptor input file:

1.       Create a descriptor and proxy file using a command like:

ProxyGen /l:”yourLibrary.exe” /o:”descriptor.xml” /c:”proxy.cs” /f

 

2.       Remove or comment out all classes that are marked isExcluded=”true” in the descriptor file.  While no code should be generated for these in the proxy file, these excluded classes can confuse ProxyGen. 

 

3.       Correct any nested class syntax for the remaining classes.  ProxyGen creates nested classes like “ParentClass+ChildClass” instead of “ParentClass.ChildClass”.

 

4.       Add the isAddInEntryPoint="true" attribute to the entry point class after isStatic="false" attribute.

 

5.       Save the reduced descriptor file.

 

6.       Use ProxyGen to update the proxy file using the reduced descriptor file as input.  The command should be like:

ProxyGen /l:”yourLibrary.exe” /i:”descriptor.xml” /c:”proxy.cs” /f

 

If a compilable proxy file is not created, try the second work around which combines two proxies.

 

Workaround II) Reduce the descriptor input file, create and combine 2 proxies:

1.       Create a descriptor and proxy file using a command like:

ProxyGen /l:”yourLibrary.exe” /o:”descriptor.xml” /c:”proxy.cs” /f

 

2.       Remove or comment out all classes except the entry point class.

 

3.       Add the isAddInEntryPoint="true" attribute to the entry point class after isStatic="false" attribute.

 

4.       Save the reduced descriptor file.

 

5.       Use ProxyGen to create a second proxy file using the reduced descriptor file as input.  The command should be like:

ProxyGen /l:”yourLibrary.exe” /i:”descriptor.xml” /c:”proxy2.cs” /f

 

6.       Combine the two proxy files.  Use the entry point code for the addInEntryPoint class from the second proxy, proxy2.cs,  with the complete proxy, proxy.cs.

 

If a compilable proxy file is not created, try the third work around using a “bare bones” descriptor file and combining two proxies.

 

Workaround III)                       Reduce the descriptor input file to include only 1 empty class, create and combine 2 proxies

1.       Create a descriptor and proxy file using a command like:

ProxyGen /l:”yourLibrary.exe” /o:”descriptor.xml” /c:”proxy.cs” /f

 

2.       Remove or comment out all classes except the entry point class.

 

3.       Add the isAddInEntryPoint="true" attribute to the entry point class after isStatic="false" attribute.

 

4.       Remove or comment out all methods and properties in the entry point class.  This should result in a descriptor file like:

<Library newNamespace="" isCOM="false" originalName="Sample" xmlns="http://schemas.microsoft.com/vsta/2006/01/ProxyGenDescriptor">

 

  <Class originalFullyQualifiedName="Sample.MainApplication" newName="MainApplication" isExcluded="false" newNamespace="Sample" visibility="public" isStatic="false" isAddInEntryPoint="true">

  </Class>

 

</Library>

 

5.       Save the greatly reduced descriptor file.

 

6.       Use ProxyGen to create a second proxy file using the reduced descriptor file as input.  The command should be like:

ProxyGen /l:”yourLibrary.exe” /i:”descriptor.xml” /c:”proxy.cs” /f

 

7.       Combine the two proxy files.  Use the entryPoint code for the addInEntryPoint class from the second proxy, proxy2.cs, with the complete proxy, proxy.cs.

 

If a compilable proxy file is still not created, check that the library (“yourLibrary.exe”) is acceptable for ProxyGen (no public forms, if using generics other changes are necessary, etc).  Free support is available through our forums.


Posted Aug 28 2007, 11:21 AM by Melody
Copyright Summit Software Company, 2008. All rights reserved.