The type initializer threw an exception. - For no reason RRS feed

  • Question

  • Hi,
    Im developing a timetable like program which was all working fine until i installed some security updates for windows xp. This might be purely coincidental but i keep getting the exception, pasted below, when i try to call ModPublic.GetSett(). I even removed all code from inside the public modpublic.getSett() sub but i still get this error on each debug/F5 run.

    System.TypeInitializationException was unhandled
      Message="The type initializer for 'TimeTable.ModPublic' threw an exception."
           at TimeTable.ModPublic.GetSett()

           at TimeTable.Splash.SplashScreen1_Load(Object sender, EventArgs e) in C:\TimeTable\Splash.vb:line 5

           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 TimeTable.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 76

           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)

           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

           at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)

           at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)

           at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()

           at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)

           at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)

           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()

           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

    Sunday, October 16, 2005 4:23 AM


  • I did some commenting out and discovered that the problem was modpublic itself, by then commenting out 'Dim ar as new array_list()' it all worked.

    Thanks anyways

    Sunday, October 16, 2005 6:58 AM

All replies

  • DarkestShadow,

    Let us hope there is a reason! :)

    I have a couple of recomendations.  I think you need to findout whether the security patches are a coincidence or not. Do you have a recent restore point?
    Can you back up to it?

    Can you make a restore point now and back the patches out to see if this is the problem or not?
    Sunday, October 16, 2005 5:13 AM
  • Hi ReneeC,

    First of all thanks for replying but restoring the computer didnt help. Another thing i rememberd was that VB crashed last time. There didnt see any code problems because it was all saved.

    Could the crash have had effect on some other part like the project file or solution?
    Sunday, October 16, 2005 6:50 AM
  • I did some commenting out and discovered that the problem was modpublic itself, by then commenting out 'Dim ar as new array_list()' it all worked.

    Thanks anyways

    Sunday, October 16, 2005 6:58 AM
  • See how these problems unravel themselves?

    We learned that it wasn't the security patches and that the error wasn't for "no reason at all".

    Take care. :)

    Sunday, October 16, 2005 3:54 PM
  • Well i was meant to have a ? on the end of 'for no reason' but i didnt get round to it. Thanks for your help.
    Wednesday, October 19, 2005 7:00 AM