LocalJoost / QRCodeService

Show a MRTK2 service to read (and position) QR codes using HoloLens 2
MIT License
76 stars 25 forks source link

Getting Following Exception in SendProgressMessage #6

Closed abhimanyusinghal closed 2 years ago

abhimanyusinghal commented 3 years ago

Getting Following Exception in SendProgressMessage

get_isActiveAndEnabled can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function

Can u help me understand what may be the issue?

LocalJoost commented 3 years ago

Are you running this in HoloLens2 or in the editor? It does not work in the editor, see.

abhimanyusinghal commented 3 years ago

I am running on Hololens 2.

LocalJoost commented 3 years ago

So I assume you get this error message from the Unity logfile that you retrieve from the HoloLens? What is the problem? It does not work at all? If so, what branch have you downloaded and build?

abhimanyusinghal commented 3 years ago

Checking online, suggests that it is a threading issue. The Error is coming only from: QRCodeWatcher_Updated Event Handler. It seems to be creating / running on a separate thread and hence when Updating displayText this exception is being thrown.

LocalJoost commented 3 years ago

I know it's a threading issue, but I still have no idea what you are running, how you have built it - did you follow the build instructions as described here? https://localjoost.github.io/Positioning-QR-codes-in-space-with-HoloLens-2-building-a-'poor-man's-Vuforia'/

abhimanyusinghal commented 3 years ago

I am building using Unity 2020.3 and Visual Studio 2019 1.10.2. UWP 10.0.10240.

I have implemented a new project and added all assets by taking from this project as per the link: https://localjoost.github.io/Reading-QR-codes-with-an-MRTK2-Extension-Service/

It seems to work fine Until a QRCodeWatcher Reads QR Code and Updated Event is invoked.

LocalJoost commented 3 years ago

Upgrading MRTK2 projects from 2019 to 2020 involves quite some work. I have never tested nor deployed this in 2020. If something doesn't work... Well, it's impossible to see from here what steps you may or may not have been taking. I guarantee it works as described in my article, provided you follow the steps and use versions as described. Anything else... Good luck. Sorry.