The Cross Language Exception sample demonstrates the ability using NGWS to throw and catch exceptions using multiple languages. This sample builds three clients and three servers; to demonstrate VC, VB and assembly languages throwing and catching exceptions. Each server contains the same classes and methods, each of which throws various exceptions.
This sample list located in the Exceptions directory of the NGWS SDK sample directories.
For Example:
C:\NGWSSDK\Samples\Exceptions
In order to properly build and run this sample, the following steps need to be performed prior to building and running the sample.
For Example:
C:\NGWSSDK\Samples\Exceptions\:>NMAKE All
In order to run this sample, follow the instructions listed below.
For Example:
C:\NGWSSDK\Samples\AsmClient\:>Copy ..\VCServer\MytestException.dll
For Example:
C:\NGWSSDK\Samples\AsmClient\:>Client
Output:
============================================================= VC TestExcept.CustomException Done...Not Thrown CustomException Finally called ============================================================= VC TestExcept.TestDivideByZero Done...Not Thrown TestDivideByZero Finally called ============================================================= VC TestExcept.TestNullReferenceException Done...Not Thrown TestNullReferenceException Finally called ============================================================= VC TestExcept.CustomException Caught Exception: Exception: MyTestException.MyCustomException: MyCustomException at MyTestException.TestExcept.CustomException(Boolean) at ThrowException Message: MyCustomException Stack Trace: at MyTestException.TestExcept.CustomException(Boolean) at ThrowException Help URL: http://something.com/help.html Error Code: -2147221503 Finally called ============================================================= VC TestExcept.TestDivideByZero Caught Exception: Exception: System.DivideByZeroException at MyTestException.TestExcept.TestDivideByZero(Boolean) at ThrowException Message: Stack Trace: at MyTestException.TestExcept.TestDivideByZero(Boolean) at ThrowException Help URL: Error Code: -2146233083 Finally called ============================================================= VC TestExcept.TestNullReferenceException Caught Exception: Exception: System.NullReferenceException at MyTestException.TestExcept.TestNullReferenceException(Boolean) at ThrowException Message: Stack Trace: at MyTestException.TestExcept.TestNullReferenceException(Boolean) at ThrowException Help URL: Error Code: -2147467261 Finally called Pass