Closed Davidwang007 closed 3 years ago
I have also experienced this. Or a very similar Issue at least. It stopped occurring when i changed back to ASA version 2.9.0. So you could try that for the time being.
@enfyy Thank you for your reply, i have tried it but with no help
I try to Destroy the Cloud Anchor Session use :
CloudManager.DestroySession();
and recreate the Session use :
await CloudManager.CreateSessionAsync();
until now ,no problem. but when I want to start the Session again use:
await CloudManager.StartSessionAsync();
then the processing hangs indefinitely ,can anyone show me the right direction ?
Hi @Davidwang007 , do you encounter the same problem if you do not call ARSession.reset()?
@oafolabi-msft Thanks for your reply ! During the period of using ASA, no such a serious problem as app crash happened without Session Reset operation. This problem is very easy to reproduce. When use AR Foundation ,after called the ARSession.reset() and CloudManager.ResetSessionAsync() function , just need to send a Anchor location request again, then the application crashes 100%.
Hi @Davidwang007! Thanks for brining this to our attention. We have opened a ticket to look into the source of the crash (#35404221). I think that I have a repro of the issue using the ASA Unity sample application, but I want to check that the behavior is the same for you. If I add the ARSession.Reset()
call I do see a crash when I go to create a watcher, but if I add a CloudManager.DestroySession()
call right after, then starting the session and creating the watcher seems to work.
Can you take the unmodified Unity sample application (or your own app) and change these lines (or the equivalent lines) in AzureSpatialAnchorsBasicDemoScript.cs from:
case AppState.DemoStepStopSession:
currentAppState = AppState.DemoStepBusy;
CloudManager.StopSession();
CleanupSpawnedObjects();
await CloudManager.ResetSessionAsync();
currentAppState = AppState.DemoStepCreateSessionForQuery;
break;
case AppState.DemoStepCreateSessionForQuery:
ConfigureSession();
currentAppState = AppState.DemoStepStartSessionForQuery;
break;
case AppState.DemoStepStartSessionForQuery:
currentAppState = AppState.DemoStepBusy;
await CloudManager.StartSessionAsync();
currentAppState = AppState.DemoStepLookForAnchor;
break;
case AppState.DemoStepLookForAnchor:
currentAppState = AppState.DemoStepLookingForAnchor;
if (currentWatcher != null)
{
currentWatcher.Stop();
currentWatcher = null;
}
currentWatcher = CreateWatcher();
if (currentWatcher == null)
{
Debug.Log("Either cloudmanager or session is null, should not be here!");
feedbackBox.text = "YIKES - couldn't create watcher!";
currentAppState = AppState.DemoStepLookForAnchor;
}
break;
to:
case AppState.DemoStepStopSession:
currentAppState = AppState.DemoStepBusy;
CloudManager.StopSession();
CleanupSpawnedObjects();
ARSession.Reset();
await CloudManager.ResetSessionAsync();
CloudManager.DestroySession();
currentAppState = AppState.DemoStepCreateSessionForQuery;
break;
case AppState.DemoStepCreateSessionForQuery:
ConfigureSession();
currentAppState = AppState.DemoStepStartSessionForQuery;
break;
case AppState.DemoStepStartSessionForQuery:
currentAppState = AppState.DemoStepBusy;
await CloudManager.StartSessionAsync();
currentAppState = AppState.DemoStepLookForAnchor;
break;
case AppState.DemoStepLookForAnchor:
currentAppState = AppState.DemoStepLookingForAnchor;
if (currentWatcher != null)
{
currentWatcher.Stop();
currentWatcher = null;
}
currentWatcher = CreateWatcher();
if (currentWatcher == null)
{
Debug.Log("Either cloudmanager or session is null, should not be here!");
feedbackBox.text = "YIKES - couldn't create watcher!";
currentAppState = AppState.DemoStepLookForAnchor;
}
break;
@msftradford It did solve my problem,thank you very much !
As you said ,after called the ARSession.Reset() function,then use:
await CloudManager.ResetSessionAsync(); CloudManager.DestroySession();
NO CRASHES happen while start another Anchor location request again, and the matching process seems work well.
That is wonderful news! I'm going to go ahead and close this issue but we'll continue to investigate ways to make our system more resilient to resetting the ARSession.
Unity : Unity2020.3.15f ASA: 2.10.2 ARFoundation:4.17 ARCore XR Plugin:4.17 Phone System: Android
When I need to reset the AR Session ,after called the ARSession.reset() and CloudManager.ResetSessionAsync() function ,then start a new Spatial Anchor match processing use:
currentWatcher = CloudManager.Session.CreateWatcher(anchorLocateCriteria);
the app crashes immediately without any debug or exception information.
So ,how to solve this problem if I need to reset the AR Session (we have to reset the Session because some reasons),Any suggestion would be greatly appreciated!
@bratsche @notlaforge
https://github.com/Azure/azure-spatial-anchors-samples/issues/203#issuecomment-671537612
The above link will help if the app crashes after ResetSessionAsync() or the app crash during again locating the object.
To solve the issue, let's start tracking first by AR-Foundation and then initialize the ASA services-related methods.
Unity : Unity2020.3.15f ASA: 2.10.2 ARFoundation:4.17 ARCore XR Plugin:4.17 Phone System: Android
When I need to reset the AR Session ,after called the ARSession.reset() and CloudManager.ResetSessionAsync() function ,then start a new Spatial Anchor match processing use:
currentWatcher = CloudManager.Session.CreateWatcher(anchorLocateCriteria);
the app crashes immediately without any debug or exception information.
So ,how to solve this problem if I need to reset the AR Session (we have to reset the Session because some reasons),Any suggestion would be greatly appreciated!
@bratsche @notlaforge