简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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