c# Universal Windows console App, Camera error "This object must be initialised... "

63 Views Asked by At

When I start debugging a Universal Windows console application and initialise the camera I get the following error.

When excute this line: (I execute it in Program.Main )

await mediaCapture.InitializeAsync(captureInitSettings);

See error: "This object must be initialised in order to perform the requested operation."

When I use a normal Universal Windows application it works correctly but in console show error..

Here I have 2 questions.

Why do I get an error in the console app?

and

In case of not being able to use a console application, could I use a normal Universal Windows application by passing parameters to it or will it give me an error in a linux because it does not have a graphical interface?

1

There are 1 best solutions below

0
Roy Li - MSFT On BEST ANSWER

Why do I get an error in the console app?

This behavior is expected, the InitializeAsync should be called from the main UI thread of your app. So you can't call it from a console application.

could I use a normal Universal Windows application by passing parameters to it or will it give me an error in a linux because it does not have a graphical interface?

No, you can't run a normal UWP in linux without a graphical interface.