Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Visual Studio integration? #1388

Closed
rlewkowicz opened this issue Jan 18, 2024 · 3 comments
Closed

Bug: Visual Studio integration? #1388

rlewkowicz opened this issue Jan 18, 2024 · 3 comments

Comments

@rlewkowicz
Copy link

Version

2.0.240111.5

Summary

I think there's a real bug but I don't know how to constructively articulate that really this whole space just feels like it sucks. The docs suck and the api is esoteric.
docs comment here: MicrosoftDocs/winrt-api#2445

The bug:

Severity	Code	Description	Project	File	Line	Suppression State
Error	C3779	'winrt::impl::consume_Windows_Foundation_IAsyncOperation<winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Devices::Enumeration::DeviceInformationCollection>,TResult>::get': a function that returns 'auto' cannot be used before it is defined	ConsoleApplication1	C:\Users\Ryan\source\repos\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.cpp	17	

Reproducible example

#include <iostream>
#include <winrt/base.h>
#include <winrt/Windows.Graphics.Display.h>
#include <winrt/Windows.Devices.Enumeration.h>
#include <winrt/Windows.Devices.Display.Core.h>

using namespace winrt;
using namespace winrt::Windows::Graphics;
using namespace winrt::Windows::Devices::Display;
using namespace winrt::Windows::Devices::Enumeration;

int main()
{
    init_apartment();

    const auto monitorSelector = DisplayMonitor::GetDeviceSelector();
    const auto devices = DeviceInformation::FindAllAsync(monitorSelector).get();
}

Expected behavior

But it doesn't return auto?
https://learn.microsoft.com/en-us/uwp/api/windows.devices.enumeration.deviceinformation.findallasync?view=winrt-22621

Actual behavior

This should just work?

Additional comments

I'm just exhausted with the WinRT ecosystem. There seems to be literally no meaningful c++ examples for any of it. I don't know where I'm just wrong or things don't work.

@dmachaj
Copy link
Contributor

dmachaj commented Jan 18, 2024

That error indicates that you are missing a necessary #include statement. You need #include <winrt/Windows.Foundation.h> because IAsyncOperation is in the Windows::Foundation namespace.

@kennykerr
Copy link
Collaborator

@rlewkowicz
Copy link
Author

That was it, ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants