none
同一程序在win7下没问题,在xp下报the type initializer for threw an exception. RRS feed

  • 问题

  • 有一个程序在win7下跑没问题,在XP小跑就报

    System.TypeInitializationException
    The type initializer for 'GetSystemInfo.GetSystemInfoClass' threw an exception.

    部分源码:

    public static class GetSystemInfoClass
        {
            private static IDictionary<string, string> PowerSchemeList;
            //static bool _isWin7 = false;
            static bool? _status;
            static GetSystemInfoClass()
            {
                // PowerSchemeList = null;
    
    
                //IsWin7();
    
                //_status = QueryFirewallStatus();
                PowerSchemeList = null;
                _status = null;
            }
    

    调用其中一个方法
    Console.WriteLine(GetSystemInfoClass.GetMachineInfo());

    2012年3月22日 9:41

答案