Operator '<operatorsymbol>' doesn't return a value on all code paths

Operator '<operatorsymbol>' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.

An operator procedure has at least one possible path through its code that does not return a value.

You can return a value from an operator procedure only by including it in a Return Statement.

If control passes to the End Operator statement, the operator procedure returns the default value of the property's data type. For more information, see "Behavior" in Function Statement.

By default, this message is a warning. For more information on hiding warnings or treating warnings as errors, see Configuring Warnings in Visual Basic.

Error ID: BC42106

To correct this error

  • Check your control flow logic and make sure every possible path ends with a Return statement. In particular, the last statement before End Operator should be a Return statement.

See also