User Tools

Site Tools


begin_end_sequence

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
begin_end_sequence [2018/03/30 14:22]
wolfgangriedmann
begin_end_sequence [2019/08/29 19:57] (current)
wolfgangriedmann
Line 4: Line 4:
 So, if you are transporting VO code, you can keep these statements safely, but for new code please use the .NET equivalents [[trycatch|Try - Catch]]. So, if you are transporting VO code, you can keep these statements safely, but for new code please use the .NET equivalents [[trycatch|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. 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.
 +Please see here for a detailled explanation: [[https://www.xsharp.info/forum/public-product/1418-dtawin-server-exceptions#10445|https://www.xsharp.info/forum/public-product/1418-dtawin-server-exceptions#10445]]
  
 The biggest difference between the error handling in .NET and Visual Objects stays in the ErrorBlock() handling. Please see the relative topic: [[vo_errorblock|The VO ErrorBlock]] The biggest difference between the error handling in .NET and Visual Objects stays in the ErrorBlock() handling. Please see the relative topic: [[vo_errorblock|The VO ErrorBlock]]
  
-Unfortunately, in the ''begin sequence'' - ''end sequence'' construct seems to be a major compatibility issueThis code for example: +The biggest difference is that in VO you can set a global error handler, and this is then called every time a runtime error is encountered, regardless of the presence of a ''begin sequence'' - ''end sequence'' block.
-<code>local uVal1 as usual +
-local uVal2 as usual +
-local uVal3 as usual+
  
-begin sequence   +In .NET, if an exception is occurring, and there is no ''try'' - ''end try'' block that encapsulates this code, the program is terminated abnormallyIf there is such a block, the execution continues in the ''catch'' part of this block, and then the program continues to run normallyand if the ''catch'' block does not shows any erroryou will not see any error message.
-  uVal1 := "Hi" +
-  uVal2 := 2 +
-  uVal3 := uVal1 + uVal2 +
-end sequence</code+
-when executed in VO shows a runtime erroras 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: +
-<code>#ifdef __XSHARP__ +
-  try +
-#else +
-  begin sequence +
-#endif   +
-uVal1 := "Hi" +
-uVal2 := 2 +
-uVal3 := uVal1 + uVal2 +
-#ifdef __XSHARP__ +
-  catch oEx as Exception +
-  ErrorBox{ niloEx:Message }:Show() +
-  end try +
-#else +
-  end sequence +
-#endif</code>+
  
 +Therefore, in X# the presence of error handling is much more important than in VO.
begin_end_sequence.txt · Last modified: 2019/08/29 19:57 by wolfgangriedmann