title: C# : Bluetooth GATT communication. GattCharacteristic.ValueChanged doesnt gets hit after sometime
body: <p>I am working on wpf application that uses GATT for bluetooth communication. I am using GattCharacteristic.ValueChanged to handle any value from device. It works for sometime and the event handler doesnt gets called after 1 minute. This problem observed in windows 8.1, but working in windows 10.</p>
  
  <p>I am made GattCharacteristic member variable, so the GC doesnt collect the variable. Still the problem exists.</p>
  
  <p>Can anyone tell me what could be the potential problem here? </p>
  
  <pre><code>private GattCharacteristic m_DataSenderCharacteristics;
  foreach (var service in serviceInfo)
  {
  var uuid = MjGattDeviceService.UuidFromServiceInformation(service);
  //Battery Service
  if (uuid.ToString() == BatteryUUID)
  {
      var bService = await GattDeviceService.FromIdAsync(service.Id);
      m_Device.batteryService = bService;
  }
  if (uuid.ToString() == CustomServiceUUID)
  {
      m_Device.gattService = await GattDeviceService.FromIdAsync(service.Id);
  
      Guid controlGUID = new Guid(ControlUUID);
      var controlGattCharacteristics =      m_Device.gattService.GetCharacteristics(controlGUID);
      Byte[] bsdata = new Byte[] { 0x0b, 0x00, 0x02 };
      IBuffer buffUTF8 = CryptographicBuffer.CreateFromByteArray(bsdata);
      GattCommunicationStatus status = await controlGattCharacteristics[0].WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);
  
      if (status == GattCommunicationStatus.Unreachable)
      {
          m_Device.isConnected = false;
          nextPage = "Unreachable";
      }
      else if (status == GattCommunicationStatus.Success)
      {
          var ctrlStatus = await controlGattCharacteristics[0].WriteValueAsync(buffUTF8);
          Guid guuid1 = new Guid(DataSenderUUID);
          m_DataSenderCharacteristics = m_Device.gattService.GetCharacteristics(guuid1)[0];
  
          GattCommunicationStatus notifyStatus = await m_DataSenderCharacteristics.
              WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);                   
  
          //This event handler will be called for some 1 minute. After it falls dead
          m_DataSenderCharacteristics[0].ValueChanged += GestureValueChanged;
          if (notifyStatus == GattCommunicationStatus.Success)
          {
              nextPage = "Connected";
          }
      }
  }
  }
  </code></pre>