Splash Screen NullReferenceExceptions  
Author Message
xshua





PostPosted: Visual Basic Express Edition, Splash Screen NullReferenceExceptions Top

Created a Splash Screen for my VB2005 express application. After I run the application the first time I may or may not get a NullReferenceException on subsequent runs. The NullRefExcpn appears after splash screen appears and then dissapears. The application form may appear with the NullRefExc or it may not appear at all. Can't figure out the cause.

NullReferenceException was unhandled
Troubleshooting tips:
Use the new keyword to create an object instance.
Check to determine if the object is null before calling the method.

Exception Detail
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.WaitForWaitHandle(WaitHandle waitHandle)
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at System.Windows.Forms.Control.Invoke(Delegate method)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.HideSplashScreen()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.MainFormLoadingDone(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at TestProject.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()






Visual Studio Express Editions38  
 
 
ahmedilyas





PostPosted: Visual Basic Express Edition, Splash Screen NullReferenceExceptions Top

can you also post some code where the error is happening does it happen when you are running the application within the IDE or just when its a standalone application running (double clicking the exe file)



 
 
xshua





PostPosted: Visual Basic Express Edition, Splash Screen NullReferenceExceptions Top

I've only run the application in the IDE by clicking the'Start Debugging' arrow or pressing F5.

Public Class MyOwnBrowser
Private Sub MyOwnBrowser_Load(ByVal sender As System.Object, ByVal e As EventArgs) Handles MyBase.Load
End Sub

Private Sub btnGo_Click(ByVal sender System.Object,
ByVal e As EventArgs) Handles btnGo.Click myBrowser.Navigate(txtURL.txt)
End Sub

Private Sub myBrowser_DocumentCompleted(ByBal sender As System.Object, ByVal e As System.Windows.Forms.webBrowserDocumentsCompletedEventArgs) Handles myBrowser.DocumentCompleted
End Sub

End Class

Public NotInheritable Calss Splash
Private Sub Splash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load

If My.Application.Info.Title <> ""
Application.Title.Text = My.Application.Info.Title
Else
Application.Title.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
End If

version.Text = System.String.Format(version.Text, My.Application.Info.version.Major, My.Application.Info.version,Minor)
Copyright.Text = My.Application.Info.Copyright
End Sub
End Class



 
 
SJWhiteley





PostPosted: Visual Basic Express Edition, Splash Screen NullReferenceExceptions Top

I believe that Windows 2000 causes problems with the Spalsh Screen: you may want to check this item:

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx FeedbackID=114918

There is no current work around using the built in plash screen. If you really need one, then you can do what we did in the 'olden' days and roll your own (you can relatively easily create one on another thread so it remains responsive in any way you need).



 
 
xshua





PostPosted: Visual Basic Express Edition, Splash Screen NullReferenceExceptions Top

Thanks for the link. The workaround shown on the link works.

Rating Validation Workarounds