2017-04-26 66 views
0

我不明白爲什麼這行代碼拋出這個錯誤。帶有FormatException的WebClient.DownloadString(url)錯誤

任何想法,不勝感激。

DateTime Format Exception?

System.FormatException was unhandled 
Message=Input string was not in a correct format. 
Source=mscorlib 
StackTrace: 
    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) 
    at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) 
    at System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info) 
    at micro.Updater.start(Object obj) in C:\Users\Windows\Documents\Visual Studio 2015\Projects\Micro\Updater.cs:line 22 
    at System.Threading._TimerCallback.TimerCallback_Context(Object state) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading._TimerCallback.PerformTimerCallback(Object state) 
+0

請從該對話框中點擊「將異常的詳細信息複製到剪貼板」,然後將其複製的文本作爲編輯內容放入代碼塊中 –

+0

您是否還可以包含'start'方法的完整代碼? –

回答

1

你PDB文件很可能與你的代碼同步。從堆棧跟蹤中,您可以看到錯誤發生在您從start方法調用的System.Double.Parse內部。它認爲您在第22行致電Double.Parse,但第22行是您的網絡客戶端呼叫。

嘗試做一個乾淨的然後重建。還要檢查你的程序是否處於調試模式,而不是釋放模式,這也可能導致它。如果這不能解決問題,您需要手動查看代碼才能找到Double.Parse呼叫。