This is an old revision of the document!
begin sequence - end sequence
The begin sequence
- recover
- end sequence
statements are widely used in VO applications, and the X# compiler translates it mainly in the try
- catch
and end try
statements.
So, if you are transporting VO code, you can keep these statements safely, but for new code please use the .NET equivalents Try - Catch.
Where the X# compiler adds functionality in the translation is in the recover statement, to support the VO break
command, and encapsulates the exception in an usual. And it adds support for the CanBreak()
function.
The biggest difference between the error handling in .NET and Visual Objects stays in the ErrorBlock() handling. Please see the relative topic: The VO ErrorBlock
Unfortunately, in the begin sequence
- end sequence
construct seems to be a major compatibility issue. This code for example:
local uVal1 as usual local uVal2 as usual local uVal3 as usual begin sequence uVal1 := "Hi" uVal2 := 2 uVal3 := uVal1 + uVal2 end sequence
when executed in VO shows a runtime error, as expected.
When you execute it in X#, it does not shows any runtime error.
This could lead to not see runtime errors in your migrated VO application.
Until the X# development team is able to add some enhancements in their own runtime, you should better use the .NET try - catch
statements, and if you need to remain source compatible between VO and X#, you can use code like this:
#ifdef __XSHARP__ try #else begin sequence #endif uVal1 := "Hi" uVal2 := 2 uVal3 := uVal1 + uVal2 #ifdef __XSHARP__ catch oEx as Exception ErrorBox{ nil, oEx:Message }:Show() end try #else end sequence #endif