Tuesday, May 5, 2020

[VB][Resolved]function 'SetMapping' doesn't return a value on all code paths

Error message
function 'SetMapping' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used
Source :
Function SetMapping()
    Console.WriteLine("do sth")
End Function
If you make sure there is nothing to return, change the keyword Function to Sub
Sub SetMapping()
    Console.WriteLine("do sth")
End Sub

Reference:
https://stackoverflow.com/questions/52126716/function-start-doesnt-return-a-value-on-all-code-paths-a-null-reference-except

No comments :

Post a Comment