Sign up ×  I am currently trying to retrieve a unique device
identifier. Here is my code:  var token = Windows.System.Profile
.HardwareIdentification.getPackageSpecificToken(null); var
reader = Windows.Storage.Streams.DataReader.fromBuffer(;
reader.unicodeEncoding = true; var identifier =
reader.readString(reader.unconsumedBufferLength);   But it
raises following error:  The operation attempted to access data
outside the valid range.  How can I retrieve the size of my
string? I also tried to use, but result is the same.
share|improve this question Depending on what you are using it
for, you should be aware that the id will change, possibly
frequently on some devices. You should probably use a subset of
the constituent components in the id if you need to (more)
reliably identify the device again later. Docs here: – 
Endophage Nov 9 '12 at 21:14  1 Answer 1  up vote 3 down vote
accepted  I can't try to replicate what you're doing at the
moment, but you might try reading it as bytes into array like
this:  var a