繁体   English   中英

添加缺少的 dll 后,在 Unity 中获取 COM 异常。 HoloLens 2 的 MixedReality 二维码示例

[英]Getting COM Exception in Unity after adding missing dll. MixedReality QR Code Sample for HoloLens 2

这是我收到的错误消息:

COMException
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (System.Int32 errorCode) (at <9577ac7a62ef43179789031239ba8798>:0)
WinRT.Platform.RoGetActivationFactory (System.IntPtr runtimeClassId, System.Guid& iid) (at <018a8dd1eaa44ac38faac041d704e74c>:0)
WinRT.WinrtModule.GetActivationFactory (WinRT.HString runtimeClassId) (at <018a8dd1eaa44ac38faac041d704e74c>:0)
WinRT.ActivationFactory`1[T]..ctor () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) (at <9577ac7a62ef43179789031239ba8798>:0)
System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <9577ac7a62ef43179789031239ba8798>:0)
System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Activator.CreateInstance[T] () (at <9577ac7a62ef43179789031239ba8798>:0)
WinRT.WeakLazy`1+<>c[T].<.ctor>b__2_0 () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
WinRT.WeakLazy`1[T].get_Value () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
WinRT.ActivationFactory`1[T].As[I] () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
Microsoft.MixedReality.QR.QRCodeWatcher+Statics..ctor () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) (at <9577ac7a62ef43179789031239ba8798>:0)
System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <9577ac7a62ef43179789031239ba8798>:0)
System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Activator.CreateInstance[T] () (at <9577ac7a62ef43179789031239ba8798>:0)
WinRT.WeakLazy`1+<>c[T].<.ctor>b__2_0 () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
WinRT.WeakLazy`1[T].get_Value () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
Microsoft.MixedReality.QR.QRCodeWatcher.RequestAccessAsync () (at <018a8dd1eaa44ac38faac041d704e74c>:0)
QRTracking.QRCodesManager+<Start>d__29.MoveNext () (at Assets/Scripts/QRCodesManager.cs:83)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <e414e10bfe5f45729ff122f3359de21b>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

将 vcruntime140_app.dll 添加到我的插件文件夹后出现错误。

这是似乎导致错误的代码:

        async protected virtual void Start()
        {
            IsSupported = QRCodeWatcher.IsSupported();
            capabilityTask = QRCodeWatcher.RequestAccessAsync();
            accessStatus = await capabilityTask;
            capabilityInitialized = true;
        }

这是来自官方 mc 示例代码 ( https://github.com/microsoft/MixedReality-QRCode-Sample )。 我已经将脚本和预制件导入到一个新的混合现实统一项目中,现在正试图让它工作。

您需要通过NuGet 为 Unity恢复 VC 运行时和二维码 NuGet package。 请随时参考yl-msft/QRTracking: 用于 QRtracking (github.com) 的 MRTK 示例应用来修改您当前的项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM