Builtin instructions are inadvisable because of their risky nature

[vc_row][vc_column]Software ResiliencyProgramming Best Practices[vc_empty_space height=”12px”][vc_row_inner][vc_column_inner width=”1/2″][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

Why you should care

[/vc_column_text][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]Certain built-in commands in VB/VB.net bring about unnecessary reliability risk to applications.

This unexpected application or machine behavior occurs a result of awkward/unreliable methods of handling errors and interacting with memory – that includes using pointers, forcing garbage collection, unstructured exception handling etc.[/vc_column_text][/vc_column_inner][vc_column_inner width=”1/2″][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

Business Impacts

The use of certain (unrecommended) built-in commands can increase the likelihood for applications to malfunction and fail in a production environment. Debugging and working with these commands can increase development time significantly.[/vc_column_text][vc_empty_space height=”32px”]Production RiskComplexity[/vc_column_inner][/vc_row_inner][vc_empty_space height=”12px”][vc_empty_space height=”32px”][vc_single_image image=”5362″ img_link_large=”” img_link_target=”_self” img_size=”full” alignment=”none”][vc_row_inner][vc_column_inner width=”1/2″][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

CAST recommendations

Identifying the built-in functions that can potentially cause reliability issues from the patterns above and encourage developers to seek alternatives to these risky commands. Documentation of most of these identified issues can be easily found online and in the references below.[/vc_column_text][/vc_column_inner][vc_column_inner width=”1/2″][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

References

https://stackoverflow.com/questions/118633/whats-so-wrong-about-using-gc-collect

http://www.vbforums.com/showthread.php?759361-RESOLVED-Need-Full-Understanding-of-VarPtr-StrPtr-ObjPtr

https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/resume-statement

https://stackoverflow.com/questions/29418248/what-does-the-vb-net-ubound-function-actually-do-and-why-does-the-msdn-document[/vc_column_text]Style Guide[/vc_column_inner][/vc_row_inner][vc_separator color=”grey” align=”align_center” style=”” border_width=”” el_width=””][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

How we detect

[/vc_column_text][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]This code insight follows code which contains β€œsystem” and β€œgcβ€œ, count one violation each time β€œcollect (” is encountered.

Count one violation each time following patterns are encountered :

  • objptr
  • strptr
  • varptr
  • ismissing
  • as new
  • resume
  • for … lbound
  • to … ubound

[/vc_column_text][vc_row_inner][vc_column_inner width=”1/1″][vc_single_image image=”5362″ img_link_large=”” img_link_target=”_self” img_size=”full” alignment=”none”][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

[/vc_column_text][vc_empty_space height=”16px”]See featuresHow it works[/vc_column_inner][/vc_row_inner][/vc_column][/vc_row]

?>