How to fix Type initializer exception during runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paul snow
    New Member
    • Nov 2010
    • 2

    How to fix Type initializer exception during runtime

    I'm having this System.TypeInit ializerExceptio n problem but only during runtime in a separate environment than its own build environment.

    Win7x64 is the build environment. I'm testing the project on various WinXPx86 computers using a Setup Deployment and am noticing the error.

    The portion of the code that comes to question is:

    Code:
    public static SettingsSingleton Instance { get { return Nested.instance; } }
    
    ...
    
    class Nested
    {
     Nested() { }
     static readonly SettingsSingleton instance = new SettingsSingleton();
     }
    I've tried and tested this suggested solution:

    http://blog.wouldbethe ologian.com/2009/03/type-initializer-for-someclass-threw.html

    Still no luck.

    I have since installed MVS2008 (same as dev environment) on the XP machine and ran debugger. The error does not come up. I've built the Setup/Deployment and sent it to Win7, WinVista machines and they work fine. Any suggestions are greatly appreciated.
  • paul snow
    New Member
    • Nov 2010
    • 2

    #2
    It turns out that it's just not WinXP; but all machines that did not have this software suite previously installed.

    Comment

    Working...