microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.86k stars 328 forks source link

please provide public intefaces for Windows.ApplicationModel.AppService.* classes #935

Open juwens opened 3 years ago

juwens commented 3 years ago

Proposal: provide public intefaces for Windows.ApplicationModel.AppService.* classes like AppServiceConnection, AppServiceDeferral, etc.

Alternative: let us create instances of AppServiceConnection, AppServiceDeferral and the related classes, which is not possible at the moment

Summary

i developed a small Facade in C# arround the AppServiceConnection which makes it easier to do RPC like messaging across the AppServiceConnection.

Currently you cannot inject an interface of AppServiceConnection, because the available ones are internal and there are no public intefaces available.

im talking about this class:

namespace Windows.ApplicationModel.AppService
{
    //
    // Summary:
    //     Represents a connection to the endpoint for an app service. App services enable
    //     app-to-app communication by allowing you to provide services from your Universal
    //     Windows app to other Universal Windows app.
    [ComImport]
    [ContractVersion(typeof(UniversalApiContract), 65536u)]
    [Activatable(65536u, "Windows.Foundation.UniversalApiContract")]
    [DualApiPartition(version = 1u)]
    [Static(typeof(IAppServiceConnectionStatics), 524288u, "Windows.Foundation.UniversalApiContract")]
    [Threading(ThreadingModel.Both)]
    [MarshalingBehavior(MarshalingType.Agile)]
    public sealed class AppServiceConnection : IAppServiceConnection, IAppServiceConnection2, IDisposable

Also to the alternative, it's not possible to instantiate an AppServiceDeferral.

new AppServiceDeferral() gives CS1729 'AppServiceDeferral' does not contain a constructor that takes 0 arguments `

Rationale

Scope

Capability Priority
This proposal will allow developers to accomplish: automated tests without creating their own wrappers and interfaces around AppServiceConnection Must
btueffers commented 3 years ago

@juwens we appreciate the request. We don't have any plans, but we will take it into consideration for the future.