vb.net - String.Substring(start, end) sometimes throwing an exception -
my program uses backgroundworker call performaction() method when different method, method1 returns true. using strategy pattern set correct performaction() should performed every time event raised. for strategy pattern created abstract class, , class inside abstract class inherits it. public mustinherit class abstract public mustoverride sub performaction(byval str string) public class extends inherits abstract public overrides sub performaction(byval str string) str = str.substring(str.indexof(":"), str.indexof(">")) msgbox(str) end sub end class i create class contains field of abstract, , used call performaction. the performaction method gets called backgroundworker.reportprogress event, called when backgroundworker.dowork detects method1 returning true. , code above, causes system.reflection.targetinvocationexception addition information exception has been thrown t...