Solved

System.TypeInitialisation error

Posted on 2014-09-24
1
104 Views
Last Modified: 2014-09-30
We have a system that has been working without a problem for over a year. The site had a power outage which took down the PC in an uncontrolled manor. On restart our software now fails to run. We get a Watson Bucket in the event viewer.

having researched what these mean, P4 verified that it is our program that has the problem, P7 is 956 and P8 is 11. P9 says System.TypeInitialisation.

I then ran the decompiler to allow me to see what caused the issue

.class /*0200004D*/ private auto ansi sealed a1cbiss.CDAS.DataCollection.Startup
       extends [mscorlib/*23000001*/]System.Object/*01000003*/
{
  .custom /*0C000075:0A000010*/ instance void [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute/*01000067*/::.ctor() /* 0A000010 */ = ( 01 00 00 00 ) 
  .method /*06000956*/ public static void 
          Main(string[] args) cil managed
  {
    .entrypoint
    .custom /*0C00038F:0A0002C5*/ instance void [mscorlib/*23000001*/]System.STAThreadAttribute/*0100011C*/::.ctor() /* 0A0002C5 */ = ( 01 00 00 00 ) 
    // Code size       426 (0x1aa)
    .maxstack  5
    .locals /*11000597*/ init (bool V_0,
             class [mscorlib/*23000001*/]System.Exception/*01000073*/ V_1,
             class [mscorlib/*23000001*/]System.Exception/*01000073*/ V_2,
             string[] V_3)
    IL_0000:  ldnull
    IL_0001:  ldftn      void a1cbiss.CDAS.DataCollection.Startup/*0200004D*/::HandleError(object,
                                                                                           class [System/*23000005*/]System.Threading.ThreadExceptionEventArgs/*01000053*/) /* 06000957 */
    IL_0007:  newobj     instance void [System/*23000005*/]System.Threading.ThreadExceptionEventHandler/*0100011A*/::.ctor(object,
                                                                                                                           native int) /* 0A0002B9 */
    IL_000c:  call       void [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::add_ThreadException(class [System/*23000005*/]System.Threading.ThreadExceptionEventHandler/*0100011A*/) /* 0A0002BA */
    IL_0011:  call       string [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::get_CommonAppDataPath() /* 0A0002BB */
    IL_0016:  call       string [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::get_CommonAppDataPath() /* 0A0002BB */
    IL_001b:  ldstr      "\\" /* 70000C79 */
    IL_0020:  ldc.i4.m1
    IL_0021:  ldc.i4.0
    IL_0022:  call       int32 [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.Strings/*010000C9*/::InStrRev(string,
                                                                                                                      string,
                                                                                                                      int32,
                                                                                                                      valuetype [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.CompareMethod/*0100011B*/) /* 0A0002BC */
    IL_0027:  call       string [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.Strings/*010000C9*/::Left(string,
                                                                                                                   int32) /* 0A0002BD */
    IL_002c:  stsfld     string a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::DataPath /* 04000397 */
    IL_0031:  ldsfld     string a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::DataPath /* 04000397 */
    IL_0036:  ldstr      bytearray (D3 00 00 0A 07 17 D6 13 06 0A 2B 7C 02 7B 48 0A   // ..........+|.{H.
                                    00 04 06 8C 5E 00 00 01 6F A2 00 00 0A 74 C0 00   // ....^...o....t..
                                    00 02 0C 02 6F 3B 23 00 06 06 18 D8 17 DA 8C 5E   // ....o;#........^
                                    00 00 01 6F D7 00 00 0A 02 6F 3B 23 00 06 06 18   // ...o.....o;#....
                                    D8 8C 5E 00 00 01 6F D7 00 00 0A 02 6F 5F 17 00   // ..^...o.....o_..
                                    06 6F 8D 00 00 0A 08 6F D8 00 00 0A 02 7B 48 0A   // .o.....o.....{H.
                                    00 04 06 18 D8 17 DA 8C 5E 00 00 01 6F D7 )       // ........^...o. /* 7000557C */
    IL_003b:  call       class [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/ [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/::Parse(string,
                                                                                                                                                                                                                            string) /* 0A0002BE */
    IL_0040:  stsfld     class [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::RunningCheck /* 040003A9 */
    IL_0045:  newobj     instance void a1cbiss.CDAS.DataCollection.Systems.WarningMessagesHashtableDictionary/*0200005A*/::.ctor() /* 06000C32 */
    IL_004a:  stsfld     class a1cbiss.CDAS.DataCollection.Systems.WarningMessagesHashtableDictionary/*0200005A*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::WarningMessages /* 040003AB */
    .try
    {
      IL_004f:  ldsfld     class [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::AuthorisationCodes /* 040003A8 */
      IL_0054:  ldc.i4.0
      IL_0055:  callvirt   instance bool [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/::CheckForDongle(bool) /* 0A0002BF */
      IL_005a:  stloc.0
      IL_005b:  leave.s    IL_00aa

    }  // end .try
    catch [mscorlib/*23000001*/]System.Exception/*01000073*/ 
    {
      IL_005d:  dup
      IL_005e:  call       void [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.CompilerServices.ProjectData/*01000072*/::SetProjectError(class [mscorlib/*23000001*/]System.Exception/*01000073*/) /* 0A00001C */
      IL_0063:  stloc.1
      IL_0064:  ldloc.1
      IL_0065:  call       void [a1cbiss.Common.Functions/*2300000D*/]a1cbiss.Common.Functions.EventLogs/*0100009A*/::GenerateLogMessage(class [mscorlib/*23000001*/]System.Exception/*01000073*/) /* 0A000090 */
      IL_006a:  ldnull
      IL_006b:  ldstr      bytearray (C0 00 00 02 0C 02 6F 3B 23 00 06 06 18 D8 17 DA   // ......o;#.......
                                      8C 5E 00 00 01 6F D7 00 00 0A 02 6F 3B 23 00 06   // .^...o.....o;#..
                                      06 18 D8 8C 5E 00 00 01 6F D7 00 00 0A 02 6F 5F   // ....^...o.....o_
                                      17 00 06 6F 8D 00 00 0A 08 6F D8 00 00 0A 02 7B   // ...o.....o.....{
                                      48 0A 00 04 06 18 D8 17 DA 8C 5E 00 00 01 6F D7   // H.........^...o.
                                      00 00 0A 02 7B 48 0A 00 04 06 18 D8 8C 5E 00 00   // ....{H.......^..
                                      01 6F D7 00 00 0A 06 15 D6 0A 06 11 06 3C 7C FF   // .o...........<|.
                                      FF FF 2A 00 )                                     // ..*. /* 7000559A */
      IL_0070:  ldloc.1
      IL_0071:  callvirt   instance string [mscorlib/*23000001*/]System.Exception/*01000073*/::get_Message() /* 0A00001E */
      IL_0076:  call       string [mscorlib/*23000001*/]System.String/*0100006E*/::Concat(string,
                                                                                          string) /* 0A0000AA */
      IL_007b:  ldstr      bytearray (6F 5F )                                           // o_ /* 700055C8 */
      IL_0080:  ldc.i4.0
      IL_0081:  ldc.i4.s   16
      IL_0083:  call       valuetype [System.Windows.Forms/*23000003*/]System.Windows.Forms.DialogResult/*0100007E*/ [a1cbiss.Common.Functions/*2300000D*/]a1cbiss.Common.Functions.GlobalisationLibrary.RightToLeftAwareMessageBox/*01000086*/::Show(class [System.Windows.Forms/*23000003*/]System.Windows.Forms.IWin32Window/*01000087*/,
                                                                                                                                                                                                                                                      string,
                                                                                                                                                                                                                                                      string,
                                                                                                                                                                                                                                                      valuetype [System.Windows.Forms/*23000003*/]System.Windows.Forms.MessageBoxButtons/*01000088*/,
                                                                                                                                                                                                                                                      valuetype [System.Windows.Forms/*23000003*/]System.Windows.Forms.MessageBoxIcon/*01000089*/) /* 0A000054 */
      IL_0088:  pop
      IL_0089:  ldc.i4     0x1e94e5
      IL_008e:  call       void [mscorlib/*23000001*/]System.Environment/*0100009B*/::set_ExitCode(int32) /* 0A000092 */
      IL_0093:  ldsfld     class [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::RunningCheck /* 040003A9 */
      IL_0098:  ldc.i4.0
      IL_0099:  callvirt   instance void [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/::set_RunningProperly(bool) /* 0A000093 */
      IL_009e:  call       void [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::Exit() /* 0A000094 */
      IL_00a3:  call       void [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.CompilerServices.ProjectData/*01000072*/::ClearProjectError() /* 0A000020 */
      IL_00a8:  leave.s    IL_00aa

    }  // end handler
    .try
    {
      IL_00aa:  ldloc.0
      IL_00ab:  brfalse    IL_0133

      IL_00b0:  ldsfld     class [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::AuthorisationCodes /* 040003A8 */
      IL_00b5:  callvirt   instance bool [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/::get_AllowCdasToInstruments() /* 0A0002C0 */
      IL_00ba:  ldsfld     class [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::AuthorisationCodes /* 040003A8 */
      IL_00bf:  callvirt   instance bool [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/::get_AllowCdasToNetServer() /* 0A00024D */
      IL_00c4:  or
      IL_00c5:  brfalse.s  IL_0117

      IL_00c7:  ldsfld     class [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::AuthorisationCodes /* 040003A8 */
      IL_00cc:  callvirt   instance bool [CDAS.Classes/*23000004*/]a1cbiss.CDAS.Common.Classes.Security.Dongle/*0100004E*/::get_AllowCdasToNetServer() /* 0A00024D */
      IL_00d1:  brfalse.s  IL_0108

      IL_00d3:  call       bool a1cbiss.CDAS.DataCollection.Startup/*0200004D*/::SynchroniseDataFiles() /* 06000958 */
      IL_00d8:  brfalse.s  IL_00e9

      IL_00da:  newobj     instance void a1cbiss.CDAS.DataCollection.Systems.Main/*0200004F*/::.ctor() /* 060009AF */
      IL_00df:  call       void [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::Run(class [System.Windows.Forms/*23000003*/]System.Windows.Forms.Form/*01000005*/) /* 0A0002C1 */
      IL_00e4:  leave      IL_01a9

      IL_00e9:  ldc.i4     0x1e94e5
      IL_00ee:  call       void [mscorlib/*23000001*/]System.Environment/*0100009B*/::set_ExitCode(int32) /* 0A000092 */
      IL_00f3:  ldsfld     class [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::RunningCheck /* 040003A9 */
      IL_00f8:  ldc.i4.0
      IL_00f9:  callvirt   instance void [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/::set_RunningProperly(bool) /* 0A000093 */
      IL_00fe:  call       void [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::Exit() /* 0A000094 */
      IL_0103:  leave      IL_01a9

      IL_0108:  newobj     instance void a1cbiss.CDAS.DataCollection.Systems.Main/*0200004F*/::.ctor() /* 060009AF */
      IL_010d:  call       void [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::Run(class [System.Windows.Forms/*23000003*/]System.Windows.Forms.Form/*01000005*/) /* 0A0002C1 */
      IL_0112:  leave      IL_01a9

      IL_0117:  ldc.i4     0x1e94e5
      IL_011c:  call       void [mscorlib/*23000001*/]System.Environment/*0100009B*/::set_ExitCode(int32) /* 0A000092 */
      IL_0121:  ldsfld     class [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::RunningCheck /* 040003A9 */
      IL_0126:  ldc.i4.0
      IL_0127:  callvirt   instance void [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/::set_RunningProperly(bool) /* 0A000093 */
      IL_012c:  call       void [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::Exit() /* 0A000094 */
      IL_0131:  leave.s    IL_01a9

      IL_0133:  ldc.i4     0x1e94e5
      IL_0138:  call       void [mscorlib/*23000001*/]System.Environment/*0100009B*/::set_ExitCode(int32) /* 0A000092 */
      IL_013d:  ldsfld     class [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/ a1cbiss.CDAS.DataCollection.Declarations/*0200004B*/::RunningCheck /* 040003A9 */
      IL_0142:  ldc.i4.0
      IL_0143:  callvirt   instance void [a1cbiss.Common.Controls/*23000008*/]a1cbiss.Common.Controls.Classes.StartStop/*0100004F*/::set_RunningProperly(bool) /* 0A000093 */
      IL_0148:  call       void [System.Windows.Forms/*23000003*/]System.Windows.Forms.Application/*0100009C*/::Exit() /* 0A000094 */
      IL_014d:  leave.s    IL_01a9

    }  // end .try
    catch [mscorlib/*23000001*/]System.Exception/*01000073*/ 
    {
      IL_014f:  dup
      IL_0150:  call       void [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.CompilerServices.ProjectData/*01000072*/::SetProjectError(class [mscorlib/*23000001*/]System.Exception/*01000073*/) /* 0A00001C */
      IL_0155:  stloc.2
      IL_0156:  ldnull
      IL_0157:  ldc.i4.5
      IL_0158:  newarr     [mscorlib/*23000001*/]System.String/*0100006E*/
      IL_015d:  stloc.3
      IL_015e:  ldloc.3
      IL_015f:  ldc.i4.0
      IL_0160:  ldstr      bytearray (06 18 D8 17 )  /* 700055DE */
      IL_0165:  stelem.ref
      IL_0166:  ldloc.3
      IL_0167:  ldc.i4.1
      IL_0168:  ldloc.2
      IL_0169:  callvirt   instance string [mscorlib/*23000001*/]System.Exception/*01000073*/::get_Message() /* 0A00001E */
      IL_016e:  stelem.ref
      IL_016f:  ldloc.3
      IL_0170:  ldc.i4.2
      IL_0171:  ldstr      "\r\n" /* 70000EBB */
      IL_0176:  stelem.ref
      IL_0177:  ldloc.3
      IL_0178:  ldc.i4.3
      IL_0179:  ldloc.2
      IL_017a:  callvirt   instance string [mscorlib/*23000001*/]System.Exception/*01000073*/::get_StackTrace() /* 0A0002C2 */
      IL_017f:  stelem.ref
      IL_0180:  ldloc.3
      IL_0181:  ldc.i4.4
      IL_0182:  ldstr      "\r\n" /* 70000EBB */
      IL_0187:  stelem.ref
      IL_0188:  ldloc.3
      IL_0189:  call       string [mscorlib/*23000001*/]System.String/*0100006E*/::Concat(string[]) /* 0A0000C8 */
      IL_018e:  ldstr      bytearray (6F 5F )                                           // o_ /* 700055C8 */
      IL_0193:  ldc.i4.0
      IL_0194:  ldc.i4.s   16
      IL_0196:  call       valuetype [System.Windows.Forms/*23000003*/]System.Windows.Forms.DialogResult/*0100007E*/ [a1cbiss.Common.Functions/*2300000D*/]a1cbiss.Common.Functions.GlobalisationLibrary.RightToLeftAwareMessageBox/*01000086*/::Show(class [System.Windows.Forms/*23000003*/]System.Windows.Forms.IWin32Window/*01000087*/,
                                                                                                                                                                                                                                                      string,
                                                                                                                                                                                                                                                      string,
                                                                                                                                                                                                                                                      valuetype [System.Windows.Forms/*23000003*/]System.Windows.Forms.MessageBoxButtons/*01000088*/,
                                                                                                                                                                                                                                                      valuetype [System.Windows.Forms/*23000003*/]System.Windows.Forms.MessageBoxIcon/*01000089*/) /* 0A000054 */
      IL_019b:  pop
      IL_019c:  ldloc.2
      IL_019d:  call       void [a1cbiss.Common.Functions/*2300000D*/]a1cbiss.Common.Functions.EventLogs/*0100009A*/::GenerateLogMessage(class [mscorlib/*23000001*/]System.Exception/*01000073*/) /* 0A000090 */
      IL_01a2:  call       void [Microsoft.VisualBasic/*23000002*/]Microsoft.VisualBasic.CompilerServices.ProjectData/*01000072*/::ClearProjectError() /* 0A000020 */
      IL_01a7:  leave.s    IL_01a9

    }  // end handler
    IL_01a9:  ret
  } // end of method Startup::Main

Open in new window


This indicates that the call to commonapppath is the problem. I have another program that references the same constant, and it works fine. I have reinstalled the program and this hasn't fixed the problem.
0
Comment
Question by:ChloesDad
1 Comment
 
LVL 15

Accepted Solution

by:
ChloesDad earned 0 total points
ID: 40353950
It turns out that this was caused by a corrupt mysettings file. Deleting the file allowed the program to run normally
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now