Jeffrey L. Roberts
Jeffrey L. Roberts

Reputation: 2984

WebClient.DownloadString(url) Errors with FormatException

I don't understand why this line of code is throwing this error.

Any ideas are greatly appreciated.

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)

Upvotes: 0

Views: 283

Answers (1)

Scott Chamberlain
Scott Chamberlain

Reputation: 127543

Your PDB file is likely out of sync with your code. From your stack trace you can see the error is happening inside of the System.Double.Parse you call from your start method. It thinks that you call Double.Parse on line 22 but line 22 is your web client call.

Try doing a clean then rebuild. Also check that your program is in Debug mode instead of Release mode, that can cause it too. If that does not fix it you will need to look at the code by hand to find that Double.Parse call.

Upvotes: 1

Related Questions