when try run sensors.windows
sample project microsoft band sdk (1.3.10417.1) on windows 10 machine following exception:
system.argumentexception: value not fall within expected range. @ windows.applicationmodel.store.currentapp.get_appid() @ microsoft.band.storeapplicationplatformprovider`2.getapplicationidasync(cancellationtoken token) @ microsoft.band.bandclient.startorawakestreamingsubscriptiontasks() @ microsoft.band.bandclient.sensorsubscribe(subscriptiontype type) @ microsoft.band.sensors.bandsensorbase`1.<>c__displayclass4.<startreadingsasync>b__3() @ system.threading.tasks.task.innerinvoke() @ system.threading.tasks.task.execute() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.band.sensors.bandsensorbase`1.<startreadingsasync>d__6.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.taskawaiter`1.getresult() @ punchingband.models.punchingmodel.<connect>d__48.movenext()
it looks it's throwing exception because sdk uses currentapp
according remarks section here on currentappsimulator
isn't possible if app isn't listed in windows store.
if sdk needs access currentapp
how can work while developing app? it's not can swap currentapp
currentappsimulator
in pre-compiled assembly.
update: fixed in microsoft band sdk version 1.3.10702. if possible upgrade version otherwise use hack below.
i figured out hack working after investigation .net reflector. set private field called currentappid
on bandclient
, sdk won't attempt currentapp
. right after connection client made , before attempting stream sensors run following:
using (ibandclient bandclient = await bandclientmanager.instance.connectasync(pairedbands[0])) { type.gettype("microsoft.band.bandclient, microsoft.band") .getruntimefields() .first(field => field.name == "currentappid") .setvalue(bandclient, guid.newguid());
be sure include using system.linq
, system.reflection
. hacky workaround it's resolved in future release of band sdk.
Comments
Post a Comment