Mixedrealitytoolkit-unity: MRTK script compilation errors when Microsoft.Windows.MixedReality.DotnetWinRT package is installed

Created on 7 Nov 2019  路  3Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Describe the bug

After installing both MRTK and Microsoft.Windows.MixedReality.DotnetWinRT, script compilation errors occur in MRTK scripts due to references to the Windows namespace. This occurs because the scripts themselves exist inside the Microsoft top-level namespace, so bare references to the Windows namespace within the scripts will bind against the Windows subnamespace from Microsoft.Windows.MixedReality.DotnetWinRT rather than the global Windows namespace. The fix is to qualify these references with global::.

To reproduce

Steps to reproduce the behavior:

  1. Install MRTK
  2. Install Microsoft.Windows.MixedReality.DotnetWinRT per documentation
  3. Wait for Unity to recompile scripts
  4. Observe script compilation errors in the Output window due to missing types in the Microsoft.Windows namespace.

Expected behavior

No compilation errors when both packages are installed.

Screenshots

Unity script compile errors

Your Setup (please complete the following information)

  • Unity Version 2019.2.11f1
  • MRTK Version 2.1

Target Platform (please complete the following information)

  • HoloLens
  • HoloLens 2
  • WMR immersive

Additional context

I believe this conflict has already been addressed in the changes to consume MRTK as a NuGet package, but this fix is needed independent of that so that even consumers who aren't using the NuGet package to acquire MRTK itself can still successfully use Microsoft.Windows.MixedReality.DotnetWinRT and other related packages like Microsoft.MixedReality.QR and Microsoft.MixedReality.SceneUnderstanding.

Bug Release Blocker

All 3 comments

@keveleigh @davidkline-ms FYI.

The Storage fixes went in with #6147

Confirmed this has been resolved in 2.2.0 via #6147

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markgrossnickle picture markgrossnickle  路  3Comments

chrisfromwork picture chrisfromwork  路  3Comments

matatabi-ux picture matatabi-ux  路  3Comments

dustin2711 picture dustin2711  路  3Comments

jimstack picture jimstack  路  3Comments