microsoft / psi

Platform for Situated Intelligence
https://github.com/microsoft/psi/wiki
Other
538 stars 96 forks source link

`NullReferenceException` in MixedReality.cs #270

Closed austinbhale closed 1 year ago

austinbhale commented 1 year ago

I started the app with the HoloLens 2 off my head and received a null exception for this.stereoKitSpatialCoordinateSystem here: https://github.com/microsoft/psi/blob/39615ade7dca194770cc645c5c46a2da97000ceb/Sources/MixedReality/Microsoft.Psi.MixedReality.UniversalWindows/MixedReality.cs#L179

I believe SpatialAnchor.TryCreateRelativeTo will return null when it fails to localize in the environment: https://github.com/microsoft/psi/blob/39615ade7dca194770cc645c5c46a2da97000ceb/Sources/MixedReality/Microsoft.Psi.MixedReality.UniversalWindows/Operators.cs#L47

It might be helpful to have a null check somewhere for the failed conversion to a spatial coordinate system, or to keep trying: https://github.com/microsoft/psi/blob/39615ade7dca194770cc645c5c46a2da97000ceb/Sources/MixedReality/Microsoft.Psi.MixedReality.UniversalWindows/MixedReality.cs#L144

sandrist commented 1 year ago

Good catch! We will add a fix to handle this situation.