Log in or register to post comments

Access violation when enabling Vuforia in Unity

May 16, 2017 - 1:27pm #1

Hey everyone,

We are currently working on our first HoloLens project as part of a student thesis. Our goal is an application that is capable of presenting the user a possible use case with HoloLens within the retail market segment. The app uses both VuMarks and Image Targets in order to recognize and locate real world objects like products or shop inventory. However, getting close to the end of our project, we are still struggling with a hard to reproduce, but randomly reocurring "crash to desktop" in our app. We spent hours of debugging, no luck so far in finding the root cause of this issue. All we can see is that the crash dumps indicate an access violation exception in Vuforia.dll.

Attached dump files show: Unhandled exception at 0x60AA6BA0 (Vuforia.dll) in ...exe.1084.dmp: 0xC0000005: Access violation reading location 0x1171CA44  

The Visual Studio debugger just stops  as soon as the error occurs, we never get the chance to gather any more details (e.g. callstack or the like). Same with the Unity profiler, it doesn't crash but we weren't able to spot anything fishy when analyzing the list of running scripts just before the crash occured.

Luckily, the crash occurs at the same point(s) in our application

  1. User enters mode that requires image recognition
  2. We enable Vuforia using vuforiaCamera.SetActive(true); with"vuforiaCamera" being a reference to our ARCamera game object
  3. Now this is where it gets a little bit tricky, our app either continues working totally fine, crashes right after detecting one of our VuMarks / Image Targets or it crashes with a little delay after first detection (e.g. right after targets gets out of users sight)
  4. Result after crash is always the same: Crash dump with access violation
  5. If the app didn't crash, we disable Vuforia with vuforiaCamera.SetActive(false); after user has left mode that required image recognition

Vuforia is also enabled right after startup, but we didn't observe similar crashes at that point. 

Do you see any problems in

  • Enabling/Disabling Vuforia during runtime?
  • Attaching child objects to the Vuforia target game objects (i.e. something like a visual detection indicator)?
  • Using Vuforia in combination with spatial anchors (i.e. to anchor detected targets)
  • Removing the ARCamera behavior that overwrites the Unity target framerate (as far as we know HoloLens caps the framerate to 30 anyway when the camera is accessed)?
  • Executing a fair amount of code inside the trackable state event listeners (we didn't verify whether events are directly fired from within Vuforia.dll)
  • Looking at targets within a specific timeframe after enabling Vuforia?

Here's our setup:

  • HoloLens (Windows version 14393.1198.x86fre.rs1_release_sec.170427-1353)
  • Unity v5.5.2f1
  • Vuforia v6.2.10 (latest from your website)
  • HoloToolkit v1.5.6.0
  • All our scripts are written in C#

We register for trackable state changes of VuMarks and image targets with

        public void RegisterForTracking(GameObject trackableObject)
        {
            var eventListener = new TrackableEventListener(trackableObject);
            eventListener.OnTrackableStateChanged += OnTrackableStateChanged;
        }
 
        private void OnTrackableStateChanged(TrackableBehaviour source,
            TrackableBehaviour.Status previousStatus,
            TrackableBehaviour.Status newStatus)
        {
            if (newStatus == TrackableBehaviour.Status.DETECTED ||
                newStatus == TrackableBehaviour.Status.TRACKED ||
                newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
            {
                OnTrackableDetected(source);
            }
            else
            {
                OnTrackableLost(source);
            }
        }

We attached three HoloLens dumps from consecutive crashes to this post since we are really running out of ideas on our side. So we decided to ask you guys for a little help. Maybe you can get more information out of the dump file when including the required symbol files for Vuforia.dll.

 

Looking forward to hearing from you.

AttachmentSize
Package icon HoloLens_Crash_Dumps.zip18.21 MB

Access violation when enabling Vuforia in Unity

May 7, 2018 - 3:14pm #5

Was this issue ever resolved?  I'm running into the same thing.  Trying to create a hololens project in unity.  I've tried with unity 2017.2.1f1, 2017.3.1f1, and 2018.1.0f2.  I'm importing Microsoft's mixed reality toolkit, and setting up the project and a scene with just a single cube object.  At that point, I can build and deploy to my hololens, and run the app, and I can see the cube.  If I then simply turn on the Vuforia Augmented Reality option in the player XR settings, when I build/deply/run, the app just crashes with an Access Violation error.

In the debug console in visual studio, the access violation always happens right after the 'StartVuforia' message.

I tried enabling the vuforia delayed initialization option, and manually enabling things later, but with the same results.

Access violation when enabling Vuforia in Unity

May 26, 2017 - 9:51am #4

Hello,

We appreciate your efforts to investigate this issue. Unfortunately it isn't possible for us to hand out the complete source of our app, but it should be possible to create a more simpler repro case. This is probably more useful to you guys anyway. I suggest we'll discuss details via PM and post any results to this thread for people that might run into the same issue, no matter whether it is actually a problem in Vuforia itself or caused by a side effect of the application or by another component .

Thanks again for your time!

 

Access violation when enabling Vuforia in Unity

May 22, 2017 - 11:48am #3

Hello,

We took a look at the dumps but unfortunately it doesn't provide enough information as there is no heap or stack information. We also tried to debug with the mini dump and it looks like there is an exception, but again we are having difficulties isolating.

Would it be possible for you to share a repro case with us? This will be the quickest path for an opportunity for us to reproduce and continue our root cause analysis. If this is acceptable, please reach out to me via PM for more details, or with a link to download the project.

Thanks.

Access violation when enabling Vuforia in Unity

May 19, 2017 - 9:23am #2

Hello,

Thanks for reaching out. We'll start by taking a look at the dumps to see if there are any indicators.

I will respond to this thread with any findings and/or requests.

Thanks.

Log in or register to post comments