more G-Labs products

Author Topic: module.Each bug  (Read 494 times)

October 12, 2016, 03:02:49 PM
Read 494 times

wolfgang928

  • *
  • Information
  • Newbie
  • Posts: 10
Hello Gene,

i think i found a bug inside Each function, where the iteration stops after the first module, despite 'return false' statement.
Code: [Select]
const string MODULES_DOMAIN = "Rfm";
var RFM_MODULES = Modules.InDomain(MODULES_DOMAIN).OfDeviceType("Switch");

When.ProgramStopping( () =>
{
  Log("Program stopping routine started");
  // Switch off all controls with enabled parameter 'CentralOff'
  Modules.WithFeature("Rfm.CentralOff").Off();
 
  RFM_MODULES.Each((m) =>  {
      Log("Init " + m.Instance.Name);
    return false;
  });
   

This returns only the name of the first module. In the following part ....
   
Code: [Select]
    var m1 = RFM_MODULES.WithAddress("1").Get();
    Log("M1:" + m1.Instance.Name);
    var m2 = RFM_MODULES.WithAddress("2").Get();
    Log("M2:" + m2.Instance.Name);
    var m3 = RFM_MODULES.WithAddress("3").Get();
    Log("M3:" + m3.Instance.Name);
    var m4 = RFM_MODULES.WithAddress("4").Get();
    Log("M4:" + m4.Instance.Name);
    var m5 = RFM_MODULES.WithAddress("5").Get();
    Log("M5:" + m5.Instance.Name); 

    Log("Program stopping routine finished");
    return true;
});
   

all 5 names of the 5 virtual modules are returned

var RFM_MODULES = Modules.InDomain(MODULES_DOMAIN).OfDeviceType("Switch");

After a lot of try and error i found that the red line seems to forget the module list in case of ProgramStopping or the multi thread calls inside .Each function of ModulesHelper.cs result in problems, but i don't know why. With debugging the attached process in Visual Studio i got sometimes 1 of 5 found modules, sometimes 2 but never the 5, which are existing.

A direct call of
Code: [Select]
Modules.InDomain(MODULES_DOMAIN).OfDeviceType("Switch").Each((m) =>  {...});
works perfect. Hmm, strange, why??? And there is no changing setter of RFM_MODULES in between.


Thanks for an idea.

Regards Wolfgang
« Last Edit: October 13, 2016, 03:12:23 PM by wolfgang928 »


There are no comments for this topic. Do you want to be the first?