Main Site Documentation

RTC Read exception


#1

We were having an exception.
After resetting many times. It did the same thing.

Then I figured out that it could be a bad value from the RTC read.
So removed the battery and then reset. The issue went away.

Any suggestions. So we can stop thing from happening in the field.

Log–
Ready.
#### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (2) ####
#### System.DateTime::.ctor [IP: 0000] ####
#### GHIElectronics.NETMF.Hardware.RealTimeClock::GetTime [IP: 001e] ####
#### MicLogger.General::GetDateTime[IP: 0004] ####
00:12:Exception was thrown: System.ArgumentOutOfRangeException
Done.
MSdbgV1Pçí OWaiting for debug commands…


#2

Wrap your RTC code in a try-catch and check that the values make sense before using them. Like the year is not anything less than 2011