Exception on single measurement of TempHumidty device

I am getting an exception cannot request a single measurement whilst continuous measurements are being taken … yet I am not making continuous measurements.

I am taking readings at rate of every 10 seconds and my timer stops when triggered and does not start again until all the readings are done.

Can anyone shed any light on this?

#### Exception System.InvalidOperationException - 0x00000000 (1) ####
#### Message: You cannot request a single measurement while continuous measurements are being taken.
#### Gadgeteer.Modules.GHIElectronics.TempHumidity::RequestSingleMeasurement [IP: 0015] ####
#### wifi.Program::ProcessMeasurements [IP: 0016] ####
#### wifi.Program::measurementTimer_Tick [IP: 0014] ####
#### Microsoft.SPOT.DispatcherTimer::FireTick [IP: 0010] ####
#### Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054] ####
#### Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a] ####
#### Microsoft.SPOT.Dispatcher::Run [IP: 0006] ####
#### Gadgeteer.Program::Run [IP: 001d] ####

A first chance exception of type ‘System.InvalidOperationException’ occurred in GTM.GHIElectronics.TempHumidity.dll
Additional information: You cannot request a single measurement while continuous measurements are being taken.

I assume start taking and stop taking measurements were for continuous measurements? So no I have not done this?

Do I need to start before my singlemeasurement and stop after … or start at the program start …

setupPeripherals - gets called at start
processMeasurements - gets called every 10 seconds on a timer

private void setupPeripherals()
{ Debug.Print(“setupTempHumidtyDevice”);
tempHumidity_One.MeasurementComplete += temperatureHumidity_MeasurementComplete;
}

   void temperatureHumidity_MeasurementComplete(TempHumidity sender, TempHumidity.MeasurementCompleteEventArgs e)
    {
        latestSensorData.temperature = e.Temperature;
        latestSensorData.humidity = e.RelativeHumidity;

        //Debug.Print("Temp=" + e.Temperature.ToString());
        //Debug.Print("Humidity=" + e.RelativeHumidity.ToString());
    }

private void ProcessMeasurements()
{

        try
        {

            tempHumidity_One.RequestSingleMeasurement();
        }
        catch (Exception ex)
        {
            
            Debug.Print("tempHumidity_One.RequestSingleMeasurement Exception: " + ex.Message);
        }

please tell me more about code tags?

Not always … it can run merrily for sometime before creating an exception; I am trying to find out why the program keeps freezing … and this is suspect number 1?

when the measurements are called the timer is stopped; the timer is only restarted when all the measurements are done!

so although my timer is setup so it cannot call the processmeasurements until its complete …

A single measurement creates a thread and could take more than 10seconds to return which means my timer may have restarted by then? Would it take that long to get a measurement?

I see this now … I have built my project from other sources … although I may have interpreted the code wrong!

Now testing continuous measurement!

@ Andre
Thank you … has been running for almost 24 hours…

Now to debug the Azure connection which has dropped … I guess unless I can get it to do this whilst connected to the debugger theres no way else to trace it … maybe write the exception to the SD card!