Playmode tests crash because of Meta SDK

I have a pipeline running in Azure devOps
This pipeline runs editor tests and playmode tests.
Everything was working but after using Meta SDK I am having a crash in the playmode test.
This is pretty weird because of the following.

  • If I open the Unity project in the agent and I run manually the playmode tests, I don’t have any problem
  • If I run the playmode tests in my own laptop by command line, it also works

Anyone with the same issue? any advice?

The command
“Unity.exe” -batchmode -runTests -testPlatform PlayMode

This is the crash log

Summary

UnityEngine.XR.OpenXR.OpenXRLoaderBase:ReceiveNativeEvent (UnityEngine.XR.OpenXR.Features.OpenXRFeature/NativeEvent,ulong) (at ./Library/PackageCache/com.unity.xr.openxr@1.16.1/Runtime/OpenXRLoader.cs:707)
UnityEngine.XR.OpenXR.OpenXRLoaderBase:Deinitialize () (at ./Library/PackageCache/com.unity.xr.openxr@1.16.1/Runtime/OpenXRLoader.cs:481)
UnityEngine.XR.OpenXR.OpenXRLoaderBase:Initialize () (at ./Library/PackageCache/com.unity.xr.openxr@1.16.1/Runtime/OpenXRLoader.cs:213)
UnityEngine.XR.Management.XRManagerSettings:InitializeLoaderSync () (at ./Library/PackageCache/com.unity.xr.management@4.5.4/Runtime/XRManagerSettings.cs:186)
UnityEngine.XR.Management.XRGeneralSettings:InitXRSDK () (at ./Library/PackageCache/com.unity.xr.management@4.5.4/Runtime/XRGeneralSettings.cs:172)
UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () (at ./Library/PackageCache/com.unity.xr.management@4.5.4/Runtime/XRGeneralSettings.cs:145)

(Filename: ./Library/PackageCache/com.meta.xr.sdk.core@83.0.4/Scripts/OpenXRFeatures/MetaXRFeature.cs Line: 296)

[MetaXRFeature] OnInstanceDestroy: 0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object)
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Meta.XR.MetaXRFeature:OnInstanceDestroy (ulong) (at ./Library/PackageCache/com.meta.xr.sdk.core@83.0.4/Scripts/OpenXRFeatures/MetaXRFeature.cs:239)
UnityEngine.XR.OpenXR.Features.OpenXRFeature:ReceiveNativeEvent (UnityEngine.XR.OpenXR.Features.OpenXRFeature/NativeEvent,ulong) (at ./Library/PackageCache/com.unity.xr.openxr@1.16.1/Runtime/Features/OpenXRFeature.cs:724)
UnityEngine.XR.OpenXR.OpenXRLoaderBase:ReceiveNativeEvent (UnityEngine.XR.OpenXR.Features.OpenXRFeature/NativeEvent,ulong) (at ./Library/PackageCache/com.unity.xr.openxr@1.16.1/Runtime/OpenXRLoader.cs:707)
UnityEngine.XR.OpenXR.OpenXRLoaderBase:Deinitialize () (at ./Library/PackageCache/com.unity.xr.openxr@1.16.1/Runtime/OpenXRLoader.cs:481)
UnityEngine.XR.OpenXR.OpenXRLoaderBase:Initialize () (at ./Library/PackageCache/com.unity.xr.openxr@1.16.1/Runtime/OpenXRLoader.cs:213)
UnityEngine.XR.Management.XRManagerSettings:InitializeLoaderSync () (at ./Library/PackageCache/com.unity.xr.management@4.5.4/Runtime/XRManagerSettings.cs:186)
UnityEngine.XR.Management.XRGeneralSettings:InitXRSDK () (at ./Library/PackageCache/com.unity.xr.management@4.5.4/Runtime/XRGeneralSettings.cs:172)
UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () (at ./Library/PackageCache/com.unity.xr.management@4.5.4/Runtime/XRGeneralSettings.cs:145)

(Filename: ./Library/PackageCache/com.meta.xr.sdk.core@83.0.4/Scripts/OpenXRFeatures/MetaXRFeature.cs Line: 239)

=================================================================
Native Crash Reporting

Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

=================================================================
Managed Stacktrace:

  at <unknown> <0xffffffff>
  at Meta.XR.MRUtilityKit.MRUKNative:LoadLibrary <0x00100>
  at Meta.XR.MRUtilityKit.MRUKNative:GetDllHandle <0x000c2>
  at Meta.XR.MRUtilityKit.MRUKNative:LoadMRUKSharedLibrary <0x00262>
  at Meta.XR.MRUtilityKit.MRUK:InitializeSharedLibrary <0x0021a>
  at System.Object:runtime_invoke_void <0x00184>

=================================================================
##[error]Cmd.exe exited with code ‘255’.
[OVRPlugin][ERROR] [XRCMD][failure] [XR_ERROR_RUNTIME_UNAVAILABLE]: xrCreateInstance(&createInfoCorrectOpenXRVersion, instance), arvr\projects\integrations\OVRPlugin\Src\Util\CompositorOpenXR.cpp:19295 (arvr\projects\integrations\OVRPlugin\Src\Util/CompositorOpenXR.h:363)[OVRPlugin][ERROR] Compositor invalid (arvr\projects\integrations\OVRPlugin\Src\OVR_Plugin_UnityOpenXR.cpp:304)
Finishing: RuntimeTest Unity project

You most likely need to push one of the unmanaged libs directly to the build path. This also I would suspect be more of a issue with Azure.

I’ve used Pulumi in the past for my Unity builds with Azure.

If you disable temporarily the XR initialization when running in batchmode, could it work? I think the Meta XR SDK is trying to initialize OpenXR on the pipeline run

Sorry, I don’t fully get your approach

I’ve tried to disable the OpenXR initialization in every way that I could thing but the crash remains.

Funny thing is that if I run exactly the same script in my personal laptop, I don’t have that crash and I can run the playmode tests, so maybe is related with having a dedicated gpu (I doubt that the agent has one). Or maybe because in my personal laptop I’ve installed the Meta Developer Hub

I also have tried with -nographics but still the same crash

If it’s building locally then that means there is, libraries that are failing to be included in the build process.