WARNING #1044

    Sub Main in a DLL won't get called.

    Description

    This EWI is generated when a non EXE project has a Sub Main as startup object

    Recommendations

    Since .Net DLLs doesn't have any method to execute it when the respective assembly is loaded, we have to add a static constructor and call the sub main inside.

    This won't be executed at same time as VB6 but is the most similar behavior.

    Sample VB6

    Sub Main()
    EndSub

    Target VB.NET

    PublicClass Class1
       'UPGRADE_WARNING: (1044) Sub Main in a DLL won't get called.
       PublicSub Main()
       EndSub
    EndClass

    Expected VB.NET

    PublicClass Class1
       SharedSubNew()
          Main()
       EndSub

       PrivateSharedSub Main()
       EndSub
    EndClass

    Target C#

    publicclassClass1
    {
       //UPGRADE_WARNING: (1044) Sub Main in a DLL won't get called.
       publicvoid Main()
       {
       }
    }

    Expected C#

    publicclassClass1
    {
       static Class1()
       {
       Main();
       }

       staticvoid Main()
       {
       }
    }


    Download VBUC Free Trial
    Download VBUC Now

    It's time to eradicate VB6
    ROI of eradicating VB6

    8 Proven Tips for
    Planning a Successful Migration

    8 Tips for migration