The custom functions contained in the string must be instance methods written in Visual Basic.NET syntax.
See the "Custom Code" topic in the User Guide for more information.
Report report = new Report(); report.Code = "Public Function CustomFunction() As String Return \"Hello\" End Function";