# Can't call function when sender is unrooted

**URL:** <https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566>\
**Category:** General\
**Created:** [March 10, 2016, 7:02pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566 "2016-03-10T19:02:09Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Onur\_Baran](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/onur_baran/32/127_2.png) [@Onur\_Baran](https://forums.fusetools.com/u/Onur_Baran)\
**Post date:** [March 10, 2016, 7:02pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/1 "2016-03-10T19:02:09Z")

</div>

Hi All,

It works fine when it calls the function first. I’m getting the above error when I call a second time. If “Slider.ux”, “value-changed” when it is removed, the statement works seamlessly. Does anyone have an idea?

#### Log

`Preview detected an unhandled exception: System.AggregateException: One or more errors occurred. ---> System.Exception: Can't call function when sender is unrooted`

#### MainView.js

```auto
function send_to_api(device_id, SLIDER_POS) {
    var switch_pos = 0;

    if ((SLIDER_POS == 0) ? switch_pos = 0 : switch_pos = 1);

    var body = { "id" : device_id, "param_value" : SLIDER_POS };

    fetch(DEVICE_URL, { method: 'post',
      body: JSON.stringify(body),
      headers: new Headers({
        'Content-Type': 'application/json',
        'Authorization': 'Token ' + token.value
    })
    })
    .then(function(response) { 
      return response.json(); 
    })
    .then(function(responseObject) {
      if (status.value == 200) {
          api_retval.replaceAll(responseObject);
      }
    }).catch(function (err) {
        msg.value = err;
    });
}

module.exports = {
  ...
  ...
  ...
  SwitchChanged: function (args) {
    switch_pos = args.value;
    if ( (switch_pos == true) ? send_to_api(args.data.id, SLIDER_POS) : send_to_api(args.data.id, 0) );
  },
  SliderValueChanged: function (args) {
    var _slider_pos = 0;

    _slider_pos = args.value;
    SLIDER_POS = _slider_pos.toFixed(0);

    if ( (SLIDER_POS < 1) ? send_to_api(args.data.id, "0") : send_to_api(args.data.id, SLIDER_POS) );
  }
};

```

#### Slider.ux

```auto
<ScrollView>
  <DockPanel>
    <Each Items="{data}">
      <StackPanel Dock="Top" Height="50" Margin="10,5">
        <Panel>
          <Text Font="MainView.RobotoRegular" TextColor="#fff" Opacity=".8" Alignment="VerticalCenter" Value="{name}" />

          <Slider Margin="180,10" Padding="5,10,10,10" Width="145" ValueChanged="{SliderValueChanged}" Value="{slider_value}" Minimum="0" Maximum="255" />

          <Switch Value="False" Name="TheSwitch" ValueChanged="{SwitchChanged}" Alignment="CenterRight" />
          <WhileFloat Value="{slider_value}" GreaterThan="1" LessThan="255">
          <Change TheSwitch.Value="True" />
          </WhileFloat> </Panel>

          <Rectangle Layer="Background" CornerRadius="15" Color="{Resource lightBlue800}" />
      </StackPanel>
    </Each>
  </DockPanel>
</ScrollView>

```

---

<div class="post-metadata">

**Author:** ![Onur\_Baran](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/onur_baran/32/127_2.png) [@Onur\_Baran](https://forums.fusetools.com/u/Onur_Baran)\
**Post date:** [March 10, 2016, 8:54pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/2 "2016-03-10T20:54:06Z")

</div>

When the above procedure carried out on the phone getting the following error message.

```auto
fuse preview -t=Android

```

```auto
I/SmartHome(28763): One or more errors occurred.
I/SmartHome(28763): Preview detected an unhandled exception: Uno.AggregateException: One or more errors occurred.
I/SmartHome(28763): at Fuse.UpdateManager.Update(Fuse.Stage)
I/SmartHome(28763): at Fuse.UpdateManager.Update()
I/SmartHome(28763): at Fuse.AppBase.OnUpdate()
I/SmartHome(28763): at Outracks.Simulator.Application.OnUpdate()
I/SmartHome(28763): at Fuse.App.FrameCallback.doFrame(long)

```

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [March 10, 2016, 9:04pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/3 "2016-03-10T21:04:32Z")

</div>

Onur: Did you try version 0.10 ?

---

<div class="post-metadata">

**Author:** ![Onur\_Baran](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/onur_baran/32/127_2.png) [@Onur\_Baran](https://forums.fusetools.com/u/Onur_Baran)\
**Post date:** [March 10, 2016, 9:06pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/4 "2016-03-10T21:06:47Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [March 10, 2016, 11:35pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/5 "2016-03-10T23:35:52Z")

</div>

Okay, thanks for reporting this.

Can you please upload a complete test case? If you don’t want to upload it here, you can email it to [support@fusetools.com](mailto:support@fusetools.com)

---

<div class="post-metadata">

**Author:** ![Onur\_Baran](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/onur_baran/32/127_2.png) [@Onur\_Baran](https://forums.fusetools.com/u/Onur_Baran)\
**Post date:** [March 11, 2016, 12:53am UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/6 "2016-03-11T00:53:20Z")

</div>

Dear Anders,

I sent the project files. Thank you for your interest.

---

<div class="post-metadata">

**Author:** ![Onur\_Baran](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/onur_baran/32/127_2.png) [@Onur\_Baran](https://forums.fusetools.com/u/Onur_Baran)\
**Post date:** [March 11, 2016, 8:42am UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/7 "2016-03-11T08:42:06Z")

</div>

The source of the problem is definitely the **`WhileFloat`** call. It gives application error when used `WhileFloat`.

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [March 11, 2016, 8:56am UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/8 "2016-03-11T08:56:47Z")

</div>

Thanks for the test case, we will investigate!

---

<div class="post-metadata">

**Author:** ![Onur\_Baran](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/onur_baran/32/127_2.png) [@Onur\_Baran](https://forums.fusetools.com/u/Onur_Baran)\
**Post date:** [March 11, 2016, 2:56pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/9 "2016-03-11T14:56:30Z")

</div>

#### Problem Slider.ux

```auto
<ScrollView>
  <DockPanel>
    <Each Items="{data}">
      <StackPanel Dock="Top" Height="50" Margin="10,5">
        <Panel>
          <Text Font="MainView.RobotoRegular" TextColor="#fff" Opacity=".8" Alignment="VerticalCenter" Value="{name}" />

          <Slider Margin="180,10" Padding="5,10,10,10" Width="145" ValueChanged="{SliderValueChanged}" Value="{slider_value}" Minimum="0" Maximum="255" />

          <Switch Value="False" Name="TheSwitch" ValueChanged="{SwitchChanged}" Alignment="CenterRight" />
          <WhileFloat Value="{slider_value}" GreaterThan="1" LessThan="255">
          <Change TheSwitch.Value="True" />
          </WhileFloat> </Panel>

          <Rectangle Layer="Background" CornerRadius="15" Color="{Resource lightBlue800}" />
      </StackPanel>
    </Each>
  </DockPanel>
</ScrollView>

```

When I removed `<Change>` in `<WhileFloat>` is working properly.

##### Working Slider.ux

```auto
<ScrollView>
  <DockPanel>
    <Each Items="{data}">
      <StackPanel Dock="Top" Height="50" Margin="10,5">
        <Panel>
          <Text Font="MainView.RobotoRegular" TextColor="#fff" Opacity=".8" Alignment="VerticalCenter" Value="{name}" />

          <Slider Margin="180,10" Padding="5,10,10,10" Width="145" ValueChanged="{SliderValueChanged}" Value="{slider_value}" Minimum="0" Maximum="255" />

          <Switch Value="False" Name="TheSwitch" ValueChanged="{SwitchChanged}" Alignment="CenterRight" />

          <WhileFloat Value="{dim_value}" GreaterThan="1" LessThan="255">
              <!-- <Change TheSwitch.Value="True" /> -->
          </WhileFloat>

        </Panel>

          <Rectangle Layer="Background" CornerRadius="15" Color="{Resource lightBlue800}" />
      </StackPanel>
    </Each>
  </DockPanel>
</ScrollView>

```

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [March 14, 2016, 7:57pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/10 "2016-03-14T19:57:12Z")

</div>

Hi!

I have your test case now, but I’m unable to reproduce the issue. Can you please provide exact steps I need to do inside the app to reproduce the error? Including login information, if I need to log into the app to reproduce it.

---

<div class="post-metadata">

**Author:** ![Onur\_Baran](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/onur_baran/32/127_2.png) [@Onur\_Baran](https://forums.fusetools.com/u/Onur_Baran)\
**Post date:** [March 14, 2016, 8:10pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/11 "2016-03-14T20:10:15Z")

</div>

Hi,

I sent the login information present in an email.

###### steps

- Login
- Select Location
- Select Lamp from menu
- Exit Lamp
- Select Location
- Select Lamp from menu again (will crash)

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [March 14, 2016, 8:13pm UTC](https://forums.fusetools.com/t/cant-call-function-when-sender-is-unrooted/1566/12 "2016-03-14T20:13:47Z")

</div>

Do I need a specific username/password to log in? I get wrong username/password
