Previous | Index | Next 

[PRB] The VB.NET application ends with a fatal exception when the splash screen closes

As documented in the following KB article: [PRB] The VB.NET application hangs on the splash screen or terminates earlier than expected, you can use the following pragma to activate the VB.NET application framework and select a splash screen form for the application being converted:

        '## EnablesAppFramework frmMain, frmSplash

You should be aware, however, that VB.NET has a known bug that causes random crashes of applications that use the application framework to define splash screens. According to this Microsoft KB article you can work around the issue by adding the following code in the Form_Load event of the splash screen form:

        Private Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            Dim dummyForm As New Form
            dummyForm.Opacity = 0
            dummyForm.ShowInTaskbar = False
            dummyForm.FormBorderStyle = FormBorderStyle.None
            ' next statement has no effect, because the form is actually invisible
            dummyForm.Show()
            ' more code in the splash screen form
            ' ...
        End Sub

It should be clear that this bug has nothing to do with VB Migration Partner. However, if you notice that a converted VB.NET application shows an unexpected exception when its splash screen form closes, you can try working around the issue by using a helper method named SplashScreenBugFix6, which creates the invisible “dummy” form:

        Private Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            SplashScreenBugFix6()
            ' more code in the splash screen form
            ' ...
        End Sub

Even better, you can use an InsertStatement pragma to generate the method call each time the VB6 project is converted:

        ' in the original VB6 splash screen form
        Private Sub Form_Load()
            '## InsertStatement SplashScreenBugFix6()
            ' ...
        End Sub

 

Previous | Index | Next