我上的單元測試工作的形式呼叫Tester.cs的函數,下面是錯誤:單元測試TypeInitializationException錯誤
Error 7/31/2012 10:43:11 PM One of the background threads threw exception:
System.TypeInitializationException: The type initializer for 'Tester.Tester' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: String
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s)
at Tester.Tester..cctor() in E:\Incubator\Tester\Tester\Tester.cs:line 35
--- End of inner exception stack trace ---
at Tester.Tester.Dispose(Boolean disposing)
at System.ComponentModel.Component.Finalize() MY-PC
在線路35是一個代碼,它基本上由結構檢索值文件,並將其轉換爲整數:
private static int _part = int.Parse(ConfigurationManager.AppSettings["Part"]);
什麼錯誤?謝謝。
不,可能是tq的原因。 – Alvin 2012-07-31 16:01:00