Windows-rs: Issues attempting to implement IApplicationOverrides

Created on 24 Nov 2020  路  3Comments  路  Source: microsoft/windows-rs

Hello,

I am attempting to implement IApplicationOverrides in an attempt to write a UWP xaml app without requiring the use of xaml islands. I'm basing my attempt off of the code here, specifically how to manually generate an Application class, not the old WRL machinery. My attempt at replicating that setup is here.

However, I'm running into these three errors:

error[E0433]: failed to resolve: use of undeclared crate or module `windows`
 --> src\main.rs:6:1
  |
6 | #[implement(windows::ui::xaml::IApplicationOverrides)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `windows`
  |
  = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: there are too many leading `super` keywords
 --> src\main.rs:6:1
  |
6 | #[implement(windows::ui::xaml::IApplicationOverrides)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ there are too many leading `super` keywords
  |
  = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
 --> src\main.rs:6:1
  |
6 | #[implement(windows::ui::xaml::IApplicationOverrides)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `WindowCreatedEventArgs`, found reference
  |
  = note: expected struct `WindowCreatedEventArgs`
          found reference `&Option<WindowCreatedEventArgs>`
  = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors; 1 warning emitted

Sorry for the code and error dump: if some other format or information would be helpful or would suit you better, I'd be happy to provide it.

The first error has to do with me moving winrt code generation to a bindings crate, which I can undo (although I would love suggestions on how to implement interfaces while retaining it), but the second and third errors are completely opaque to me, as they seem to revolve around proc macro output. Am I implementing something incorrectly, or is this a bug with the new implement feature?

Thanks again for your help!

bug

All 3 comments

Hi Darius, the new implement macro is still very much in development. https://github.com/microsoft/winrt-rs/pull/354 introduced the macro but it only just began working and still needs a lot more development. Rest assured I continue to work furiously on it.

In this particular case, the Xaml API refers to many other namespaces and that trips up the code generation as it assumes the code is relative to the Xaml namespace and injects the super keyword to find the path to those other namespaces. Anyway, I'll get this fixed as soon as possible.

And here's a fix for this issue: https://github.com/microsoft/winrt-rs/pull/363

Thanks for the quick turnaround!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rylev picture rylev  路  4Comments

06393993 picture 06393993  路  3Comments

rylev picture rylev  路  5Comments

ctaggart picture ctaggart  路  4Comments

ZCWorks picture ZCWorks  路  3Comments