Search code examples
vb.netvisual-studio-2010classfriend

interprate the error in decompiled source


I found some helpful code online where only the library file was provided and I recreated the source code but found a couple errors I am not sure of.

<StandardModule()> _
Friend NotInheritable Class CreateFiles
' Methods

' Fields
Private Shared Configuration As Configuration = New Configuration

' Nested Types
Private Delegate Sub showITDelegate(ByVal message As String)

<STAThread()> _
Public Shared Sub Main()
    CreateFiles.Configuration.ReadConfig()
    CreateFiles.DisplayConfig(CreateFiles.Configuration)
    CreateFiles.CreateFiles()
End Sub

Public Shared Sub CreateFiles()

I am trying to understand if there is another class missing because there are errors on the CreateFiles.* lines in the main and these reference subs within this very class: CreateFiles has 'expression does not produce a value' under it. Why would it reference itself and the methods and subs within the same class.


Solution

  • Seems like it looks at the Sub CreateFiles() rather than the class. And a sub (routine) doesn't return any value. You could remove the (first) CreateFiles in the Main subroutine.

    This should work:

    <StandardModule()> _
    Friend NotInheritable Class CreateFiles
    ' Methods
    
    ' Fields
    Private Shared Configuration As Configuration = New Configuration
    
    ' Nested Types
    Private Delegate Sub showITDelegate(ByVal message As String)
    
    <STAThread()> _
    Public Shared Sub Main()
        Configuration.ReadConfig()
        DisplayConfig(Configuration)
        CreateFiles()
    End Sub
    
    Public Shared Sub CreateFiles()
    

    Given that you don't have a problem anywhere else.